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 a4a13e1 commit 45fe2a5Copy full SHA for 45fe2a5
climada/util/yearsets.py
@@ -202,7 +202,8 @@ def sample_events(events_per_year, freqs_orig):
202
203
#add the original indices and frequencies to the pool if there are less events
204
#in the pool than needed to fill the year one is sampling for
205
- if len(np.unique(indices)) < amount_events:
+ #or if the pool is empty (not covered in case amount_events is 0)
206
+ if len(np.unique(indices)) < amount_events or len(indices) == 0:
207
indices = np.append(indices, indices_orig)
208
freqs = np.append(freqs, freqs_orig)
209
0 commit comments