Skip to content

Commit

Permalink
More dimension bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Dec 15, 2023
1 parent 04bb76d commit 8487510
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xpublish_wms/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def mask(
if "time" in mask.cf.coords:
mask = mask.cf.isel(time=0).squeeze(drop=True).cf.drop_vars("time")
else:
mask = mask.cf.squeeze(drop=True).cf
mask = mask.cf.squeeze(drop=True)

mask[:-1, :] = mask[:-1, :].where(mask[1:, :] == 1, 0)
mask[:, :-1] = mask[:, :-1].where(mask[:, 1:] == 1, 0)
Expand Down
5 changes: 3 additions & 2 deletions xpublish_wms/wms/get_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ def select_time(self, da: xr.DataArray) -> xr.DataArray:
elif self.TIME_CF_NAME in da.cf.coords:
da = da.cf.isel({self.TIME_CF_NAME: -1})

return da

def select_elevation(self, ds: xr.Dataset, da: xr.DataArray) -> xr.DataArray:
"""
Ensure elevation selection
Expand Down Expand Up @@ -285,6 +283,9 @@ def render(
y_range=(self.bbox[1], self.bbox[3]),
)

# Squeeze single value dimensions
da = da.squeeze()

if ds.gridded.render_method == RenderMethod.Quad:
mesh = cvs.quadmesh(
da,
Expand Down

0 comments on commit 8487510

Please sign in to comment.