We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42816d2 commit a3cab42Copy full SHA for a3cab42
climada/util/yearsets.py
@@ -199,6 +199,10 @@ def sample_events(events_per_year, freqs_orig):
199
200
#sample events for each sampled year
201
for amount_events in events_per_year:
202
+ #if there are not enough input events, choice with no replace will fail
203
+ if amount_events > len(freqs_orig):
204
+ raise ValueError(f"cannot sample {amount_events} distinct events for a single year"
205
+ f" when there are only {len(freqs_orig)} input events")
206
207
#add the original indices and frequencies to the pool if there are less events
208
#in the pool than needed to fill the year one is sampling for
0 commit comments