Skip to content

Commit

Permalink
Fix array handling in contour level calculation
Browse files Browse the repository at this point in the history
Previously, the contour level calculation used non-scalar types directly,
causing errors. Added `.values` to ensure proper handling of scalar values
extracted from xarray objects. This issue arose with the change to `numpy>=2`.
  • Loading branch information
douglatornell committed Jan 22, 2025
1 parent 6963bd6 commit 24d9e79
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 49 deletions.
86 changes: 39 additions & 47 deletions notebooks/figures/research/TestBaynesSoundAGRIF.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions nowcast/figures/research/baynes_sound_agrif.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ def _plot_surface_field(ax, ss_var, bs_var, cmap, ss_grid, bs_grid, theme):
"""
plain_crs = cartopy.crs.PlateCarree()
clevels = numpy.linspace(
numpy.floor(bs_var.where(bs_var > 0).min()),
numpy.ceil(bs_var.where(bs_var > 0).max()),
numpy.floor(bs_var.where(bs_var > 0).min()).values,
numpy.ceil(bs_var.where(bs_var > 0).max()).values,
20,
)
ax.contourf(
Expand Down

0 comments on commit 24d9e79

Please sign in to comment.