Skip to content

Commit

Permalink
Merge pull request #59 from ecmwf/162-datashader-does-not-handle-well…
Browse files Browse the repository at this point in the history
…-nans-in-ocean-plots

fix(training, plots) Exclude nans from error colorbars
  • Loading branch information
anaprietonem authored Jan 7, 2025
2 parents f8e5b39 + 8dd3b11 commit 69c9f58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions training/src/anemoi/training/diagnostics/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def error_plot_in_degrees(array1: np.ndarray, array2: np.ndarray) -> np.ndarray:
# For 'errors', only persistence and increments need identical colorbar-limits
combined_error = np.concatenate(((pred - input_), (truth - input_)))
norm = Normalize(vmin=np.nanmin(combined_data), vmax=np.nanmax(combined_data))
norm_error = TwoSlopeNorm(vmin=np.nanmin(combined_error), vcenter=0.0, vmax=np.nanmax(combined_error))
single_plot(fig, ax[1], lon, lat, truth, norm=norm, title=f"{vname} target", datashader=datashader)
single_plot(fig, ax[2], lon, lat, pred, norm=norm, title=f"{vname} pred", datashader=datashader)
single_plot(
Expand Down Expand Up @@ -688,7 +689,7 @@ def error_plot_in_degrees(array1: np.ndarray, array2: np.ndarray) -> np.ndarray:
lat,
pred - input_,
cmap="bwr",
norm=TwoSlopeNorm(vmin=combined_error.min(), vcenter=0.0, vmax=combined_error.max()),
norm=norm_error,
title=f"{vname} increment [pred - input]",
datashader=datashader,
)
Expand All @@ -699,7 +700,7 @@ def error_plot_in_degrees(array1: np.ndarray, array2: np.ndarray) -> np.ndarray:
lat,
truth - input_,
cmap="bwr",
norm=TwoSlopeNorm(vmin=combined_error.min(), vcenter=0.0, vmax=combined_error.max()),
norm=norm_error,
title=f"{vname} persist err",
datashader=datashader,
)
Expand Down

0 comments on commit 69c9f58

Please sign in to comment.