Skip to content

Commit e1e1c46

Browse files
committed
Merge remote-tracking branch 'origin/main' into rajeeja/yac
2 parents d0febae + ec344fe commit e1e1c46

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

uxarray/core/dataarray.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,19 @@ def zonal_mean(self, lat=(-90, 90, 10), conservative: bool = False, **kwargs):
745745
dims = list(self.dims)
746746
dims[face_axis] = "latitudes"
747747

748+
# Assign coords from `self` to the result except one that corresponds to `dims[face_axis]`
749+
new_coords = {
750+
k: v
751+
for k, v in self.coords.items()
752+
if self.dims[face_axis] not in v.dims
753+
}
754+
# Add latitudes to the resulting coords
755+
new_coords["latitudes"] = centers
756+
748757
return xr.DataArray(
749758
res,
750759
dims=dims,
751-
coords={"latitudes": centers},
760+
coords=new_coords,
752761
name=self.name + "_zonal_mean"
753762
if self.name is not None
754763
else "zonal_mean",

0 commit comments

Comments
 (0)