From 940c86b0f664c0b441fd97626267bf9a6713565b Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Fri, 10 Jan 2025 14:34:04 +0100 Subject: [PATCH] Add also the selector for the event id, after the realization has been chosen --- svir/dialogs/load_gmf_data_as_layer_dialog.py | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/svir/dialogs/load_gmf_data_as_layer_dialog.py b/svir/dialogs/load_gmf_data_as_layer_dialog.py index b41587fcf..4ec373007 100644 --- a/svir/dialogs/load_gmf_data_as_layer_dialog.py +++ b/svir/dialogs/load_gmf_data_as_layer_dialog.py @@ -92,33 +92,15 @@ def set_eid(self, events_npz): events = events_npz['array'] events = events[events['rlz_id'] == self.rlz_id] - # FIXME: add selector for the event id - self.eid = events['id'][0] - - log_msg('Extracting ground motion fields.' - ' Watch progress in QGIS task bar', - level='I', message_bar=self.iface.messageBar()) - self.extract_npz_task = ExtractNpzTask( - 'Extract ground motion fields', QgsTask.CanCancel, self.session, - self.hostname, self.calc_id, self.output_type, self.finalize_init, - self.on_extract_error, params={'event_id': self.eid}) - QgsApplication.taskManager().addTask(self.extract_npz_task) - - def get_eid_FIXME(self, events_npz): - self.events_npz = events_npz - events = events_npz['array'] - self.eid = -1 # assuming events start from 0 if 'GEM_QGIS_TEST' in os.environ: - self.eid = self.get_closest_element(self.eid, events['id']) + self.eid = events['id'][0] ok = True elif 'scenario' in self.calculation_mode: - ids_str = '' - for gsim_idx, gsim in enumerate(self.gsims): - ids = events[events['rlz_id'] == gsim_idx]['id'] - ids_str += '\n%s: %s' % (gsim, ids) - input_msg = "Events:%s" % ids_str + input_msg = f"Events: {events['id']}" else: input_msg = "Range (%s - %s)" % (events[0]['id'], events[-1]['id']) + + self.eid = -1 # assuming events start from 0 if 'GEM_QGIS_TEST' not in os.environ: while self.eid not in events['id']: if self.eid == -1: @@ -142,6 +124,7 @@ def get_eid_FIXME(self, events_npz): if not ok: self.reject() return + log_msg('Extracting ground motion fields.' ' Watch progress in QGIS task bar', level='I', message_bar=self.iface.messageBar())