CF coordinates get forgotten after operation modifying coordinates

Aperta
#396 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start by reproducing the shown DataArray example and compare d.cf.coordinates with d.mean("time").cf.coordinates. Trace how CF coordinates are identified before and after the time reduction; done means the reduced result keeps TLON as longitude and TLAT as latitude without adding ULON or ULAT.

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

Descrizione

I have a DataArray that's similar, but not quite the same as the popds example dataset (the axes aren't labelled, and it has a time dimension):

<xarray.DataArray 'Tair_m' (time: 1, nj: 1080, ni: 1440)>
array([[[nan, nan, ..., nan, nan],
        [nan, nan, ..., nan, nan],
        ...,
        [nan, nan, ..., nan, nan],
        [nan, nan, ..., nan, nan]]], dtype=float32)
Coordinates:
  * time     (time) datetime64[ns] 2255-01-01
    TLON     (nj, ni) float32 nan nan nan nan nan nan ... nan nan nan nan nan
    TLAT     (nj, ni) float32 nan nan nan nan nan nan ... nan nan nan nan nan
    ULON     (nj, ni) float32 nan nan nan nan nan nan ... nan nan nan nan nan
    ULAT     (nj, ni) float32 nan nan nan nan nan nan ... nan nan nan nan nan
Dimensions without coordinates: nj, ni
Attributes:
    units:          C
    long_name:      air temperature
    cell_measures:  area: tarea
    cell_methods:   time: mean
    time_rep:       averaged

And of course, the coordinates get correctly decoded:

>>> d.cf.coordinates
{'longitude': ['TLON'], 'latitude': ['TLAT']}

But if I take the time mean of this dataset, the correct coordinates get forgotten:

>>> d.mean("time").cf.coordinates
{'longitude': ['TLON', 'ULON'], 'latitude': ['TLAT', 'ULAT']}
Lingua principale
Python
Stelle
181
Fork
49
Merge medio
43m
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 xarray-contrib/cf-xarray

Tutte le issue di xarray-contrib/cf-xarray

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.