INGV / qquake

A plugin for QGIS 3.x that relies on web services for loading seismological data
https://www.emidius.eu/qquake/
GNU General Public License v3.0
7 stars 3 forks source link

Python error when loading intensity data of an earthquake w/o magnitude or epicentre #72

Closed MarioLocati closed 11 months ago

MarioLocati commented 11 months ago

When trying to load the extended output (QuakeML 2.0) from a macroseismic service and the magnitude (or epicentre) is missing the plugin throw the following Python error:

KeyError: None Traceback (most recent call last): File "C:\Users/mario/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qquake\gui\qquake_dialog.py", line 970, in _fetcher_finished layer = self.fetcher.create_mdp_layer() File "C:\Users/mario/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qquake\fetcher.py", line 783, in create_mdp_layer return self.mdpset_to_layer(self.result) File "C:\Users/mario/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qquake\fetcher.py", line 678, in mdpset_to_layer for f in parser.create_mdp_features(self.output_fields, self.preferred_mdp_only): File "C:\Users/mario/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qquake\quakeml\parser.py", line 387, in create_mdp_features source_obj = self.magnitudes[event.preferredMagnitudeID]

The code involved is https://github.com/INGV/qquake/blob/master/qquake/quakeml/parser.py#L387

The error can be reproduced using the "INGV ASMI-DBMI" macroseismic service using the folowing Event IDs:

MarioLocati commented 11 months ago

Tried to solve the issue with https://github.com/INGV/qquake/commit/8efd12d29b75f4701f0c72801e89389e4da2e8de

Please @GiorgioMariaDeSantis can you please check the validity of such a commit?

MarioLocati commented 11 months ago

Solved with https://github.com/INGV/qquake/commit/e0c1efbdd8f3ef03d00c475b6f440aad61665164