Skip to content

Shouldn't zonal_mean return xarray.DataArray instead of UxDataArray? #1370

Closed

Description

@erogluorhan

Similar to the comment here and the following conversation and corresponding implementation, zonal_mean also needs some re-design regarding the returned data type:

Currently it returns uxarray.UxDataArray, but it should only be a list of average values, without any Grid topology attempted to be preserved/created I believe.

How it is currently showcased in our user guides seems to kind of support this as well because all the resulting zonal means needed to be used with line or scatter plots and no use of grid topology at all.

All that said, I think a return type of xarray.DataArray would be better here.

@philipc2, feel free to chime in since you were there in the original convo above.

@rajeeja , if we agree with this way forward, would you mind looking into this since you're already working on zonal_mean for conservative averaging?

Activity

  1. added
    improvement
    on Sep 15, 2025
  2. philipc2 commented on Sep 15, 2025

    @philipc2
    Member

    Good point! It makes more sense to return an xr.DataArray

  3. rajeeja commented on Sep 15, 2025

    @rajeeja
    Contributor

    Thanks for raising this issue. —I'll switch zonal_mean to return an xr.DataArray (1D over 'latitudes', no grid topology), preserve attrs (conservative, lat_band_edges)

  4. erogluorhan commented on Sep 15, 2025

    @erogluorhan
    MemberAuthor

    Sounds great; thanks @rajeeja !

  5. moved this from 📚 Backlog to 📝 To-Do in UXarray Developmenton Sep 15, 2025
  6. moved this from 📝 To-Do to ✅ Done in UXarray Developmenton Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

improvement

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions