Skip to content

Commit

Permalink
Require --quantiles set if 'quantile' in --stats. This prevents a…
Browse files Browse the repository at this point in the history
… mysterious `ZeroDivisionError`.

PiperOrigin-RevId: 631445591
  • Loading branch information
langmore authored and Weatherbench2 authors committed May 7, 2024
1 parent 1f0a1d6 commit a050b1a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/compute_climatology.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ def _compute_seeps(kv):
if stat not in ['seeps', 'mean']:
for var in raw_vars:
if stat == 'quantile':
if not quantiles:
raise ValueError(
'Cannot compute stat `quantile` without specifying --quantiles.'
)
quantile_dim = xr.DataArray(
quantiles, name='quantile', dims=['quantile']
)
Expand Down

0 comments on commit a050b1a

Please sign in to comment.