Skip to content

zonal_mean() and azimuthal_mean() drop the coordinates associated with other dimensions #1295

@jpan84

Description

@jpan84

Version

v2025.3.0

How did you install UXarray?

Conda

What happened?

The UxDataarray that is returned by zonal_mean() retains the original time dimension but not the time coordinates.

What did you expect to happen?

Coordinates of the output from zonal_mean() should behave the same as the original input UxDataarray. This should be fixable by changing the coords kwarg at https://github.com/jpan84/uxarray/blob/302c7f0a3339474e0b517202ecfb4dd68d9ebdc1/uxarray/core/dataarray.py#L493

Can you provide a MCVE to repoduce the bug?

import uxarray as ux
uxds = ux.open_dataset('/glade/p/cesmdata/inputdata/share/scripgrids/ne120np4_pentagons_100310.nc', '/glade/work/jpan/azim_test_data.nc')
zm=uxds['PS'].zonal_mean()

print(uxds['PS'].time.dt.days_in_month)
print(zm.time)
print(zm.time.dt.days_in_month) #results in an error because there is no time coordinate array

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions