Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion uxarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,19 @@ def zonal_mean(self, lat=(-90, 90, 10), conservative: bool = False, **kwargs):
dims = list(self.dims)
dims[face_axis] = "latitudes"

# Assign coords from `self` to the result except one that corresponds to `dims[face_axis]`
new_coords = {
k: v
for k, v in self.coords.items()
if self.dims[face_axis] not in v.dims
}
# Add latitudes to the resulting coords
new_coords["latitudes"] = centers

return xr.DataArray(
res,
dims=dims,
coords={"latitudes": centers},
coords=new_coords,
name=self.name + "_zonal_mean"
if self.name is not None
else "zonal_mean",
Expand Down
Loading