zonal_mean() and weighted_mean() should return the same type of object

Aperta Adatta ai principianti
#1,733 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia eseguendo la MCVE fornita con UxDataArray.zonal_mean() e weighted_mean(), quindi individua le implementazioni di entrambi i metodi e confronta il modo in cui costruiscono i risultati. Conferma quale tipo restituito il progetto prevede per i risultati senza dimensioni della griglia e aggiungi o aggiorna la copertura in modo che entrambi i metodi restituiscano coerentemente quel tipo.

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

Descrizione

bug
Version

v2026.08.1

How did you install UXarray?

Source

What happened?

When calling UxDataArray.zonal_mean(), the output is an xarray.DataArray.
When calling UxDataArray.weighted_mean(), the output is a UxDataArray.

What did you expect to happen?

I expected these two functions to return the same type of object.

My guess is that both methods should return an xarray.DataArray because the result no longer contains any grid dimensions, and I've been thinking of "the data lives on the grid" as a core principle of UxDataArray and UxDataset objects. But, maybe that is wrong, and it should be UxDataArray for some reason?

Either way, I would definitely expect them to either both return xarray.DataArray objects or both return UxDataArray objects, because both functions produce results without any grid dimension.

Can you provide a MCVE to repoduce the bug?
import uxarray as ux
arr = ux.tutorial.open_dataset('quad-hexagon')['t2m']
arr.zonal_mean()  # this is an xarray.DataArray
arr.weighted_mean()  # this is a UxDataArray
Lingua principale
Python
Stelle
228
Fork
55
Merge medio
5g 1h
PR unite (30g)
14

Guida per i contributori

Apri la guida per i contributori

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 UXARRAY/uxarray

Tutte le issue di UXARRAY/uxarray

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.