Skip to content

Commit

Permalink
MNT: Work around pydata/xarray#9043
Browse files Browse the repository at this point in the history
Add some item() calls to get true scalars to pass for image extent in
declarative.
  • Loading branch information
dopplershift committed Aug 22, 2024
1 parent 9cf5e25 commit 2329aa4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,9 @@ def _build(self):
# If we're on a map, we use min/max for y and manually figure out origin to try to
# avoid upside down images created by images where y[0] > y[-1], as well as
# specifying the transform
kwargs['extent'] = (x_like[0], x_like[-1], y_like.min(), y_like.max())
# TODO item() shouldn't be necessary, but is until pydata/xarray#9043 is fixed.
kwargs['extent'] = (x_like[0].item(), x_like[-1].item(),
y_like.min().item(), y_like.max().item())
kwargs['origin'] = 'upper' if y_like[0] > y_like[-1] else 'lower'
kwargs.setdefault('cmap', self._cmap_obj)
kwargs.setdefault('norm', self._norm_obj)
Expand Down

0 comments on commit 2329aa4

Please sign in to comment.