diff --git a/openquake/calculators/extract.py b/openquake/calculators/extract.py index ef2d7a950e3..501e63072bd 100644 --- a/openquake/calculators/extract.py +++ b/openquake/calculators/extract.py @@ -852,8 +852,12 @@ def extract_agg_damages(dstore, what): number of damage states, or an array of length 0 if there is no data for the given tags """ - loss_type, what = what.rsplit('?', 1) # loss_type in mandatory - tags = what.split('&') if what else [] + if '?' in what: + loss_type, what = what.rsplit('?', 1) + tags = what.split('&') if what else [] + else: + loss_type = what + tags = [] if 'damages-rlzs' in dstore: oq = dstore['oqparam'] li = oq.lti[loss_type] diff --git a/openquake/calculators/tests/scenario_damage_test.py b/openquake/calculators/tests/scenario_damage_test.py index c4af7d138da..bf34d84ac6e 100644 --- a/openquake/calculators/tests/scenario_damage_test.py +++ b/openquake/calculators/tests/scenario_damage_test.py @@ -88,7 +88,7 @@ def test_case_1c(self): delta=1E-5) # check agg_damages extraction - total = extract(self.calc.datastore, 'agg_damages/structural?') + total = extract(self.calc.datastore, 'agg_damages/structural') aac(total, [[27652.219, 28132.8, 9511.933, 2870.9312, 11832.913]], atol=.1)