Skip to content

Commit

Permalink
Merge pull request #849 from gem/event_based_damage
Browse files Browse the repository at this point in the history
Add visualization of aggcurves and aggcurves-stats for event_based_damage
  • Loading branch information
ptormene authored Oct 23, 2023
2 parents 229ed25 + 98fa7dc commit e94216f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions svir/dialogs/drive_oq_engine_server_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ def show_output_list(self, output_list, calculation_mode):
# see note above
not (output['type'] == 'avg_losses-rlzs'
and 'avg_losses-stats' in output_types) and
not (output['type'] in ('aggcurves', 'aggcurves-stats')
and calculation_mode == 'event_based_damage') and
output['type'] in (OQ_TO_LAYER_TYPES |
OQ_RST_TYPES |
OQ_EXTRACT_TO_VIEW_TYPES)):
Expand Down
8 changes: 5 additions & 3 deletions svir/dialogs/viewer_dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def filter_agg_curves(self):
else:
raise NotImplementedError(self.output_type)
if self.aggregate_by is not None and len(self.aggregate_by):
for tag_name in self.aggregate_by:
for tag_name in sorted(self.aggregate_by):
tag_value = [val for val in self.tags[tag_name]['values']
if self.tags[tag_name]['values'][val]][0]
# NOTE: the oq-engine makes a urlencode on tag values
Expand Down Expand Up @@ -967,7 +967,7 @@ def load_agg_curves(
if 'aggregate_by' in oqparam and len(oqparam['aggregate_by']):
self._build_tags()
self.aggregate_by = oqparam['aggregate_by'][0]
for tag_name in self.aggregate_by:
for tag_name in sorted(self.aggregate_by):
tag_values = self.tags[tag_name]['values'].keys()
self.create_tag_values_selector(
tag_name,
Expand Down Expand Up @@ -1074,7 +1074,9 @@ def draw_agg_curves(self, output_type):
self._get_idxs(output_type)
try:
ordinates = self.agg_curves['array']
except KeyError:
if not numpy.any(ordinates):
raise ValueError
except (KeyError, ValueError):
msg = 'No data corresponds to the current selection'
log_msg(msg, level='W', message_bar=self.iface.messageBar(),
duration=5)
Expand Down
1 change: 1 addition & 0 deletions svir/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ [email protected]
# Uncomment the following line and add your changelog entries:
changelog=
3.18.0
* Added visualization of aggcurves and aggcurves-stats for event_based_damage oq-engine calculations
* When only one realization is extracted from the engine, it is considered as the mean
* Increased numpy.load parameter max_header_size to 100000 in order to prevent errors extracting some hazard curves
* Added visualization of OEP and AEP for event-based risk and damage calculations
Expand Down
3 changes: 0 additions & 3 deletions svir/test/integration/test_drive_oq_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,6 @@ def load_calc_output(
n_simulations=None):
calc_id = calc['id']
for output in self.output_list[calc_id]:
if (selected_output_type == 'aggcurves' and
calc['calculation_mode'] == 'event_based_damage'):
continue
if (output['type'] != selected_output_type and
"%s_aggr" % output['type'] != selected_output_type):
continue
Expand Down

0 comments on commit e94216f

Please sign in to comment.