Skip to content

Commit

Permalink
Callback PlotHistogram breaks if only one variable is specified. (ecm…
Browse files Browse the repository at this point in the history
…wf#165)

* enable plothistogram and plotspectrum for only one variable
  • Loading branch information
sahahner authored Nov 26, 2024
1 parent 1abb65e commit fa43078
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Keep it human-readable, your future self will thank you!
## [Unreleased](https://github.com/ecmwf/anemoi-training/compare/0.3.0...HEAD)
### Fixed

Fixed bug in power spectra plotting for the n320 resolution.
- Fixed bug in power spectra plotting for the n320 resolution.
- Allow histogram and spectrum plot for one variable [#165](https://github.com/ecmwf/anemoi-training/pull/165)

### Added
- Introduce variable to configure (Cosine Annealing) optimizer warm up [#155](https://github.com/ecmwf/anemoi-training/pull/155)
Expand Down
4 changes: 4 additions & 0 deletions src/anemoi/training/diagnostics/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def plot_power_spectrum(

figsize = (n_plots_y * 4, n_plots_x * 3)
fig, ax = plt.subplots(n_plots_x, n_plots_y, figsize=figsize, layout=LAYOUT)
if n_plots_x == 1:
ax = [ax]

pc_lat, pc_lon = equirectangular_projection(latlons)

Expand Down Expand Up @@ -293,6 +295,8 @@ def plot_histogram(

figsize = (n_plots_y * 4, n_plots_x * 3)
fig, ax = plt.subplots(n_plots_x, n_plots_y, figsize=figsize, layout=LAYOUT)
if n_plots_x == 1:
ax = [ax]

for plot_idx, (variable_idx, (variable_name, output_only)) in enumerate(parameters.items()):
yt = y_true[..., variable_idx].squeeze()
Expand Down

0 comments on commit fa43078

Please sign in to comment.