openquake.hmtk package#

Subpackages#

Submodules#

openquake.hmtk.models module#

Simple objects models to represent elements of NRML artifacts. These models are intended to be produced by NRML XML parsers and consumed by NRML XML serializers.

class openquake.hmtk.models.AreaGeometry(wkt=None, upper_seismo_depth=None, lower_seismo_depth=None)[source]#

Bases: PointGeometry

Basic object representation of a geometry for a PointSource.

Parameters:
  • wkt (str) – WKT representing the area geometry (a POLYGON).

  • upper_seismo_depth (float) – Upper seismogenic depth.

  • lower_seismo_depth (float) – Lower siesmogenic depth.

class openquake.hmtk.models.AreaSource(id=None, name=None, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, nodal_plane_dist=None, hypo_depth_dist=None)[source]#

Bases: PointSource

Basic object representation of an Area Source.

Parameters:
  • id (str) – Source identifier, unique within a given model.

  • name (str) – Human-readable name for the source.

  • trt (str) – Tectonic Region Type.

  • geometryAreaGeometry instance.

  • mag_scale_rel (str) – Magnitude Scaling Relationship.

  • rupt_aspect_ratio (float) – Rupture Aspect Ratio.

  • mfd – Magnitude Frequency Distribution. An instance of IncrementalMFD or TGRMFD.

  • nodal_plane_dist (list) – list of NodalPlane objects which make up a Nodal Plane Distribution.

  • hypo_depth_dist (list) – list of HypocentralDepth instances which make up a Hypocentral Depth Distribution.

class openquake.hmtk.models.CharacteristicSource(id=None, name=None, trt=None, mfd=None, rake=None, surface=None)[source]#

Bases: SeismicSource

Basic object representation of a characteristic fault source.

Parameters:
class openquake.hmtk.models.ComplexFaultGeometry(top_edge_wkt=None, bottom_edge_wkt=None, int_edges=None)[source]#

Bases: object

Basic object representation of a geometry for a ComplexFaultSource.

Parameters:
  • top_edge_wkt (str) – WKT representing the fault top edge (a LINESTRING).

  • bottom_edge_wkt (str) – WKT representing the fault bottom edge (a LINESTRING).

  • int_edges (list) –

    Intermediate fault edges, between the top edge and bottom edge. A list of str objects representing the WKT for each intermediate fault edge (each is a LINESTRING).

    This parameter is optional.

class openquake.hmtk.models.ComplexFaultRuptureModel(id=None, magnitude=None, rake=None, hypocenter=None, geometry=None)[source]#

Bases: SimpleFaultRuptureModel

Basic object representation of a Complex Fault Rupture.

Parameters:
  • id (str) – Rupture identifier, unique within a given model.

  • magnitude (float) – Magnitude.

  • rake (float) – Rake angle.

  • hypocenter (list) – Floats representing lon, lat and depth.

  • geometryComplexFaultGeometry object.

class openquake.hmtk.models.ComplexFaultSource(id=None, name=None, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, rake=None)[source]#

Bases: SimpleFaultSource

Basic object representation of a Complex Fault Source.

Parameters:
  • id (str) – Source identifier, unique within a given model.

  • name (str) – Human-readable name for the source.

  • trt (str) – Tectonic Region Type.

  • geometryComplexFaultGeometry object.

  • mag_scale_rel (str) – Magnitude Scaling Relationship.

  • rupt_aspect_ratio (float) – Rupture Aspect Ratio.

  • mfd – Magnitude Frequency Distribution. An instance of IncrementalMFD or TGRMFD.

  • rake (float) – Rake angle.

class openquake.hmtk.models.HazardCurveData(location, poes)#

Bases: tuple

location#

Alias for field number 0

poes#

Alias for field number 1

class openquake.hmtk.models.HazardCurveModel(**metadata)[source]#

Bases: object

Simple container for hazard curve objects. The accepted arguments are:

* investigation_time
* imt
* imls
* statistics
* quantile_value
* sa_period
* sa_damping
* data_iter (optional), an iterable returning pairs with the form
  (poes_array, location).
class openquake.hmtk.models.HypocentralDepth(probability=None, depth=None)[source]#

Bases: object

Basic object representation of a single node in a Hypocentral Depth Distribution.

Parameters:
  • probability – Probability for this node in a Hypocentral Depth Distribution, as a float.

  • depth (float) – Depth (in km).

property attrib#

An dict of XML element attribute for this HypocentralDepth.

class openquake.hmtk.models.IncrementalMFD(min_mag=None, bin_width=None, occur_rates=None)[source]#

Bases: object

Basic object representation of an Incremental Magnitude Frequency Distribtion.

Parameters:
  • min_mag (float) – The lowest possible magnitude for this MFD.

  • bin_width (float) – Width of a single histogram bin.

  • occur_rates (list) – list of occurrence rates (float values).

property attrib#

A dict of XML element attributes for this MFD.

class openquake.hmtk.models.Location(x, y)#

Bases: tuple

x#

Alias for field number 0

y#

Alias for field number 1

class openquake.hmtk.models.NodalPlane(probability=None, strike=None, dip=None, rake=None)[source]#

Bases: object

Basic object representation of a single node in a Nodal Plane Distribution.

Parameters:
  • probability – Probability for this node in a Nodal Plane Distribution, as a float.

  • strike (float) – Strike angle.

  • dip (float) – Dip angle.

  • rake (float) – Rake angle.

property attrib#

A dict of XML element attributes for this NodalPlane.

class openquake.hmtk.models.PlanarSurface(strike=None, dip=None, top_left=None, top_right=None, bottom_left=None, bottom_right=None)[source]#

Bases: object

Parameters:
  • strike – Strike angle.

  • dip – Dip angle.

  • top_left,top_right,bottom_left,bottom_right – Corner points of the planar surface, represented by Point objects.

class openquake.hmtk.models.Point(longitude=None, latitude=None, depth=None)[source]#

Bases: object

A simple representation of longitude, latitude, and depth.

Parameters:
  • longitude – Longitude

  • latitude – Latitude

  • depth – Depth

class openquake.hmtk.models.PointGeometry(wkt=None, upper_seismo_depth=None, lower_seismo_depth=None)[source]#

Bases: object

Basic object representation of a geometry for a PointSource.

Parameters:
  • wkt (str) – WKT representing the point geometry (a POINT).

  • upper_seismo_depth (float) – Upper seismogenic depth.

  • lower_seismo_depth (float) – Lower siesmogenic depth.

class openquake.hmtk.models.PointSource(id=None, name=None, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, nodal_plane_dist=None, hypo_depth_dist=None)[source]#

Bases: SeismicSource

Basic object representation of a Point Source.

Parameters:
  • id (str) – Source identifier, unique within a given model.

  • name (str) – Human-readable name for the source.

  • trt (str) – Tectonic Region Type.

  • geometryPointGeometry instance.

  • mag_scale_rel (str) – Magnitude Scaling Relationship.

  • rupt_aspect_ratio (float) – Rupture Aspect Ratio.

  • mfd – Magnitude Frequency Distribution. An instance of IncrementalMFD or TGRMFD.

  • nodal_plane_dist (list) – list of NodalPlane objects which make up a Nodal Plane Distribution.

  • hypo_depth_dist (list) – list of HypocentralDepth instances which make up a Hypocentral Depth Distribution.

class openquake.hmtk.models.SeismicSource(id=None, name=None, trt=None)[source]#

Bases: object

General base class for seismic sources.

property attrib#

General XML element attributes for a seismic source, as a dict.

class openquake.hmtk.models.SimpleFaultGeometry(id=None, name=None, wkt=None, dip=None, upper_seismo_depth=None, lower_seismo_depth=None)[source]#

Bases: object

Basic object representation of a geometry for a SimpleFaultSource.

Parameters:
  • wkt (str) – WKT representing the fault trace of a simple fault (a LINESTRING).

  • upper_seismo_depth (float) – Upper seismogenic depth.

  • lower_seismo_depth (float) – Lower siesmogenic depth.

class openquake.hmtk.models.SimpleFaultRuptureModel(id=None, magnitude=None, rake=None, hypocenter=None, geometry=None)[source]#

Bases: object

Basic object representation of a Simple Fault Rupture.

Parameters:
  • id (str) – Rupture identifier, unique within a given model.

  • magnitude (float) – Magnitude.

  • rake (float) – Rake angle.

  • hypocenter (list) – Floats representing lon, lat and depth.

  • geometrySimpleFaultGeometry object.

class openquake.hmtk.models.SimpleFaultSource(id=None, name=None, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, rake=None)[source]#

Bases: SeismicSource

Basic object representation of a Simple Fault Source.

Parameters:
  • id (str) – Source identifier, unique within a given model.

  • name (str) – Human-readable name for the source.

  • trt (str) – Tectonic Region Type.

  • geometrySimpleFaultGeometry object.

  • mag_scale_rel (str) – Magnitude Scaling Relationship.

  • rupt_aspect_ratio (float) – Rupture Aspect Ratio.

  • mfd – Magnitude Frequency Distribution. An instance of IncrementalMFD or TGRMFD.

  • rake (float) – Rake angle.

class openquake.hmtk.models.SiteModel(vs30=None, vs30_type=None, z1pt0=None, z2pt5=None, wkt=None)[source]#

Bases: object

Basic object representation of a single node in a model of site-specific parameters.

Parameters:
  • vs30 (float) – Average shear wave velocity for top 30 m. Units m/s.

  • vs30_type (str) – ‘measured’ or ‘inferred’. Identifies if vs30 value has been measured or inferred.

  • z1pt0 (float) – Depth to shear wave velocity of 1.0 km/s. Units m.

  • z2pt5 (float) – Depth to shear wave velocity of 2.5 km/s. Units km.

  • wkt – Well-known text (POINT) represeting the location of these parameters.

class openquake.hmtk.models.SourceModel(name=None, sources=None)[source]#

Bases: object

Simple container for source objects, plus metadata.

Parameters:
class openquake.hmtk.models.TGRMFD(a_val=None, b_val=None, min_mag=None, max_mag=None)[source]#

Bases: object

Basic object representation of a Truncated Gutenberg-Richter Magnitude Frequency Distribution.

Parameters:
  • a_val (float) – 10 ** a_val is the number of of earthquakes per year with magnitude greater than or equal to 0.

  • b_val (float) – Decay rate of the exponential distribution.

  • min_mag (float) – The lowest possible magnitude for this MFD.

  • max_mag (float) – The highest possible magnitude for this MFD.

property attrib#

An dict of XML element attributes for this MFD.

openquake.hmtk.registry module#

class openquake.hmtk.registry.CatalogueFunctionRegistry[source]#

Bases: dict

A collection of methods/functions working on catalogues.

The registry also holds information about the type of the input arguments

add(method_name, completeness=False, **fields)[source]#

Class decorator.

Decorate method_name by adding a call to set_defaults and check_config. Then, save into the registry a callable function with the same signature of the original method.

Parameters:
  • method_name (str) – the method to decorate

  • completeness (bool) – True if the method accepts in input an optional parameter for the completeness table

  • fields – a dictionary of field spec corresponding to the keys expected to be present in the config dictionary for the decorated method, e.g. time_bin=float, b_value=1E-6

add_function(completeness=False, **fields)[source]#

Function decorator.

Decorate a function by adding a call to set_defaults and check_config. Then, save into the registry a callable function with the same signature of the original method

Parameters:

fields – a dictionary of field spec, e.g. time_bin=float, b_value=1E-6

check_config(config, fields_spec)[source]#

Check that config has each field in fields_spec if a default has not been provided.

set_defaults(config, fields_spec)[source]#

Set default values got from fields_spec into the config dictionary

Module contents#