Implements classes to handle Regionalization and assignment of ground motion models

For shakemap applications a set of ground motion models (and their corresponding weights) needs to be defined for each earthquake. Though these can be defined manually, it also desirable to define a Regionalization, i.e. a set of geographical regions each with their own associated set of ground motion models. This is explained in #7 (closed)

This MR implements two classes for handling regionalizations at any scale:

  1. A Regionalization class, that loads and stores a given regionalisation and can, for a given earthquake, apply the geographical selection procedure to identify the region to which the earthquake is associated and its corresponding ground motion models.

  2. A RegionalizationSet class, that manages multiple regionalizations, the order of which defines their own hierarchy. For example, a different regionalization may be required for A) a country, B) a continent (the spatial domain of which may include part or all of the country A), and C) a global scale regionalization. The order in which the Regionalization objects are input into the RegionalizationSet defines the hierarchy, e.g. if the three regionalizations are input in the order A B C then regionalization A will be applied if the earthquake falls within its domain, then B or C otherwise. If the order were reversed (C B A) then the global regionalization (C) would be applied in favour of the local regionalizations (A or B).

The geographical regions are managed within the Regionalization class as a GeoPandas GeoDataFrame, which must include the attributes id, REGION, LOWER DEPTH, UPPER DEPTH and geometry. The ground motion model mapping is manages as a dictionary, the structure of which reflects the json definition explained in #7 (closed).

A classmethod is include in both Regionalization and RegionalizationSet that allows the user to define the regionalization in the form of a GeoJSON, and the corresponding ground motion model mapping as a standard json. If a region type is found in the GeoJSON for which the ground motion model mapping is not defined in then an error is raised. A set of files defining the "standard GFZ" ground motion model is also included, though further edits to these may be made in future merge requests.

For the geometry configurations tested so far, a reasonable amount of speed is gained by using Rtree for spatial indexing in order to determine the polygon in which the earthquake falls. This dependency is added to the file.

Edited by Graeme Weatherill

Merge request reports