Cell Measures, Ancillary Variables, and Cell Methods lost when performing magic methods on cubes (e.g. `__iadd__`, `__div__`)

Aperta
#7,378 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start in lib/iris/cube.py at the linked magic-method implementation, then trace how cube attributes, ancillary variables, and cell methods are handled during arithmetic. Check the single-cube array case as well as operations between cubes, and identify the relevant tests before changing behavior. Done means the applicable operations preserve metadata that remains valid and tests cover the cases reported.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

https://github.com/SciTools/iris/blob/2c05b4cc8e77c02748fd4caa2e46e49474408b31/lib/iris/cube.py#L155

I believe that 2 cubes cannot be added when their grids do not line up, so it is strange that common attributes like cell_area and ancillary variables like land_area_fraction are lost, and need to be manually added back in. Can this be fixed?

I have noticed the problem for __add__,__idiv__ and __div__ as well, and would guess that it applies to all magic operations on multiple cubes, whether in place (__iadd__,__imul__, __isub__, __idiv__ , and __itruediv__) or not (__add__,__mul__, __sub__, __div__ , and __truediv__)

I have also used __imul__ with an array of the same shape as the cube, which should implicitly only work because we assume the grid is the same, and cell_area is also lost! Furthermore, records of Cell Methods that were used (0 | time: mean) were also dropped.

Perhaps other attributes are getting dropped as well -- it would be good for someone to thoroughly check.

(FYI @valeriupredoi )

Lingua principale
Python
Stelle
730
Fork
323
Merge medio
3g 21h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SciTools/iris

Tutte le issue di SciTools/iris

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.