Skip to content

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

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

Activity

  1. added
    bug
    on Jun 10, 2025
  2. erogluorhan commented on Jun 13, 2025

    @erogluorhan
    Member

    @rajeeja @philipc2 any chance either of you could have a look into this soon?

  3. self-assigned this
    on Jun 13, 2025
  4. moved this from 📚 Backlog to 📝 To-Do in UXarray Developmenton Feb 19, 2026
  5. moved this from 📝 To-Do to ✅ Done in UXarray Developmenton Feb 26, 2026
  6. erogluorhan commented on Feb 26, 2026

    @erogluorhan
    Member

    @jpan84 This is now fixed; feel free to pull from main and test it or wait for our next release

  7. rajeeja commented on Mar 26, 2026

    @rajeeja
    Contributor

    @erogluorhan conservative zonal_mean() path not yet preserving non-face coords like #1460 - we should fix that also.

  8. moved this from ✅ Done to 🏗 In progress in UXarray Developmenton Mar 26, 2026
  9. erogluorhan commented on Mar 26, 2026

    @erogluorhan
    Member

    @erogluorhan conservative zonal_mean() path not yet preserving non-face coords like #1460 - we should fix that also.

    Great catch; I don't know how I missed that. Opened #1471

  10. moved this from 🏗 In progress to ✅ Done in UXarray Developmenton Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions