Skip to content

Commit 58a0e6d

Browse files
committed
add tags at frequency curve class. add error when exceed max_matrix size.
1 parent 03ba48c commit 58a0e6d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

climada/engine/impact.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def calc_freq_curve(self):
5757
ImpactFreqCurve
5858
"""
5959
ifc = ImpactFreqCurve()
60+
ifc.exposures_tag = self.exposures_tag
61+
ifc.impact_funcs_tag = self.impact_funcs_tag
62+
ifc.hazard_tag = self.hazard_tag
6063
# Sort descendingly the impacts per events
6164
sort_idxs = np.argsort(self.at_event)[::-1]
6265
# Calculate exceedence frequency
@@ -137,7 +140,11 @@ def calc(self, exposures, impact_funcs, hazard):
137140
# get indices of all the exposures with this impact function
138141
exp_iimp = np.where(exposures.impact_id[exp_idx] == imp_fun.id)[0]
139142
exp_step = int(CONFIG['impact']['max_matrix_size']/num_events)
140-
# separte in chunks if too many exposures
143+
if not exp_step:
144+
LOGGER.error('Increase max_matrix_size configuration parameter'\
145+
'to > %s', str(num_events))
146+
raise ValueError
147+
# separte in chunks
141148
chk = -1
142149
for chk in range(int(exp_iimp.size/exp_step)):
143150
self._exp_impact( \
@@ -238,6 +245,9 @@ class ImpactFreqCurve():
238245
label (str): string describing source data
239246
"""
240247
def __init__(self):
248+
self.exposures_tag = Tag()
249+
self.impact_funcs_tag = Tag()
250+
self.hazard_tag = TagHazard()
241251
self.return_per = np.array([])
242252
self.impact = np.array([])
243253
self.unit = ''

0 commit comments

Comments
 (0)