openquake.hmtk.sources package

Submodules

openquake.hmtk.sources.area_source module

Defines the openquake.hmtk.sources.mtk_area_source.mtkAreaSource which represents the openquake.hmtk defition of an area source.

class openquake.hmtk.sources.area_source.mtkAreaSource(identifier, name, trt=None, geometry=None, upper_depth=None, lower_depth=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, nodal_plane_dist=None, hypo_depth_dist=None)[source]

Bases: object

Describes the Area Source

Parameters:
  • identifier (str) – ID code for the source
  • name (str) – Source name
  • trt (str) – Tectonic region type
  • geometry – Instance of :class: nhlib.geo.polygon.Polygon class
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
  • mag_scale_rel (str) – Magnitude scaling relationsip
  • rupt_aspect_ratio (float) – Rupture aspect ratio
  • mfd – Magnitude frequency distribution as instance of :class: nrml.models.IncrementalMFD or :class: nrml.models.TGRMFD
  • nodal_plane_dist (list) – List of :class: nrml.models.NodalPlane objects representing nodal plane distribution
  • hypo_depth_dist (list) – List of :class: nrml.models.HypocentralDepth instances describing the hypocentral depth distribution
  • catalogue – Earthquake catalogue associated to source as instance of openquake.hmtk.seismicity.catalogue.Catalogue object
create_geometry(input_geometry, upper_depth, lower_depth)[source]

If geometry is defined as a numpy array then create instance of nhlib.geo.polygon.Polygon class, otherwise if already instance of class accept class

Parameters:
  • input_geometry – Input geometry (polygon) as either i) instance of nhlib.geo.polygon.Polygon class ii) numpy.ndarray [Longitude, Latitude]
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
create_oqhazardlib_source(tom, mesh_spacing, area_discretisation, use_defaults=False)[source]

Converts the source model into an instance of the :class: openquake.hazardlib.source.area.AreaSource

Parameters:
  • tom – Temporal Occurrence model as instance of :class: openquake.hazardlib.tom.TOM
  • mesh_spacing (float) – Mesh spacing
select_catalogue(selector, distance=None)[source]

Selects the catalogue of earthquakes attributable to the source

Parameters:

openquake.hmtk.sources.complex_fault_source module

Defines the :class: openquake.hmtk.sources.complex_fault_source.mtkComplexFaultSource, which represents the openquake.hmtk defition of a complex fault source. This extends the nrml.models.ComplexFaultSource

class openquake.hmtk.sources.complex_fault_source.mtkComplexFaultSource(identifier, name, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, rake=None)[source]

Bases: object

New class to describe the mtk complex fault source object

Parameters:
  • identifier (str) – ID code for the source
  • name (str) – Source name
  • trt (str) – Tectonic region type
  • geometry – Instance of :class: nhlib.geo.surface.complex_fault.ComplexFaultSource
  • mag_scale_rel (str) – Magnitude scaling relationsip
  • rupt_aspect_ratio (float) – Rupture aspect ratio
  • mfd – Magnitude frequency distribution as instance of nrml.models.IncrementalMFD or nrml.models.TGRMFD
  • rake (float) – Rake of fault
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
  • catalogue – Earthquake catalogue associated to source as instance of openquake.hmtk.seismicity.catalogue.Catalogue object
create_geometry(input_geometry, mesh_spacing=1.0)[source]

If geometry is defined as a numpy array then create instance of nhlib.geo.line.Line class, otherwise if already instance of class accept class

Parameters:
  • input_geometry – List of at least two fault edges of the fault source from shallowest to deepest. Each edge can be represented as as either i) instance of nhlib.geo.polygon.Polygon class ii) numpy.ndarray [Longitude, Latitude, Depth]
  • mesh_spacing (float) – Spacing of the fault mesh (km) {default = 1.0}
create_oqhazardlib_source(tom, mesh_spacing, use_defaults=False)[source]

Creates an instance of the source model as :class: openquake.hazardlib.source.complex_fault.ComplexFaultSource

select_catalogue(selector, distance, distance_metric='joyner-boore', upper_eq_depth=None, lower_eq_depth=None)[source]

Selects earthquakes within a distance of the fault

Parameters:
  • selector – Populated instance of :class: openquake.hmtk.seismicity.selector.CatalogueSelector
  • distance – Distance from point (km) for selection
:param str distance_metric
Choice of fault source distance metric ‘joyner-boore’ or ‘rupture’
Parameters:
  • upper_eq_depth (float) – Upper hypocentral depth of hypocentres to be selected
  • lower_eq_depth (float) – Lower hypocentral depth of hypocentres to be selected

openquake.hmtk.sources.point_source module

Module implements openquake.hmtk.sources.point_source.mtkPointSource class, which represents the mtk implementation of the point source typology. This extends the class nrml.models.PointSource

class openquake.hmtk.sources.point_source.mtkPointSource(identifier, name, trt=None, geometry=None, upper_depth=None, lower_depth=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, nodal_plane_dist=None, hypo_depth_dist=None)[source]

Bases: object

New class to describe the mtkPointsource object

Parameters:
  • identifier (str) – ID code for the source
  • name (str) – Source name
  • trt (str) – Tectonic region type
  • geometry – Instance of :class: nhlib.geo.point.Point class
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
  • mag_scale_rel (str) – Magnitude scaling relationsip
  • rupt_aspect_ratio (float) – Rupture aspect ratio
  • mfd – Magnitude frequency distribution as instance of :class: openquake.hazardlib.mfd.BaseMFD
  • nodal_plane_dist (list) – List of :class: openquake.hazardlib.geo.nodal_plane.NodalPlane objects representing nodal plane distribution
  • hypo_depth_dist (list) – List of :class: nrml.models.HypocentralDepth instances describing the hypocentral depth distribution
  • catalogue – Earthquake catalogue associated to source as instance of openquake.hmtk.seismicity.catalogue.Catalogue object
create_geometry(input_geometry, upper_depth, lower_depth)[source]

If geometry is defined as a numpy array then create instance of nhlib.geo.point.Point class, otherwise if already instance of class accept class

Parameters:
  • input_geometry – Input geometry (point) as either i) instance of nhlib.geo.point.Point class ii) numpy.ndarray [Longitude, Latitude]
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
create_oqhazardlib_source(tom, mesh_spacing, use_defaults=False)[source]

Converts the point source model into an instance of the :class: openquake.hazardlib.source.point_source.PointSource

Parameters:use_defaults (bool) – If set to true, will use put in default values for magitude scaling relation, rupture aspect ratio, nodal plane distribution or hypocentral depth distribution where missing. If set to False then value errors will be raised when information is missing.
select_catalogue(selector, distance, selector_type='circle', distance_metric='epicentral', point_depth=None, upper_eq_depth=None, lower_eq_depth=None)[source]

Selects the catalogue associated to the point source. Effectively a wrapper to the two functions select catalogue within a distance of the point and select catalogue within cell centred on point

Parameters:
  • selector – Populated instance of :class: openquake.hmtk.seismicity.selector.CatalogueSelector
  • distance (float) – Distance from point (km) for selection
  • selector_type (str) – Chooses whether to select within {‘circle’} or within a {‘square’}.
  • distance_metric (str) – ‘epicentral’ or ‘hypocentral’ (only for ‘circle’ selector type)
  • point_depth (float) – Assumed hypocentral depth of the point (only applied to ‘circle’ distance type)
  • upper_depth (float) – Upper seismogenic depth (km) (only for ‘square’)
  • lower_depth (float) – Lower seismogenic depth (km) (only for ‘square’)
select_catalogue_within_cell(selector, distance, upper_depth=None, lower_depth=None)[source]

Selects catalogue of earthquakes within distance from point

Parameters:
  • selector – Populated instance of :class: openquake.hmtk.seismicity.selector.CatalogueSelector
  • distance – Distance from point (km) for selection
select_catalogue_within_distance(selector, distance, distance_metric='epicentral', point_depth=None)[source]

Selects catalogue of earthquakes within distance from point

Parameters:
  • selector – Populated instance of :class: openquake.hmtk.seismicity.selector.CatalogueSelector
  • distance – Distance from point (km) for selection
  • distance_metric (str) – Choice of point source distance metric ‘epicentral’ or ‘hypocentral’

openquake.hmtk.sources.simple_fault_source module

Defines the :class openquake.hmtk.sources.simple_fault_source.mtkSimpleFaultSource, which represents the openquake.hmtk defition of a simple fault source. This extends the :class: nrml.models.SimpleFaultSource

class openquake.hmtk.sources.simple_fault_source.mtkSimpleFaultSource(identifier, name, trt=None, geometry=None, dip=None, upper_depth=None, lower_depth=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, rake=None)[source]

Bases: object

New class to describe the mtk Simple fault source object

Parameters:
  • identifier (str) – ID code for the source
  • name (str) – Source name
  • trt (str) – Tectonic region type
  • geometry – Instance of :class: openquake.hazardlib.geo.surface.simple_fault.SimpleFaultSource
  • dip (float) – Dip of the fault surface
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
  • mag_scale_rel (str) – Magnitude scaling relationsip
  • rupt_aspect_ratio (float) – Rupture aspect ratio
  • mfd – Magnitude frequency distribution as instance of :class: openquake.hazardlib.mfd.base.BaseMFD
  • rake (float) – Rake of fault
  • catalogue – Earthquake catalogue associated to source as instance of openquake.hmtk.seismicity.catalogue.Catalogue object
create_geometry(input_geometry, dip, upper_depth, lower_depth, mesh_spacing=1.0)[source]

If geometry is defined as a numpy array then create instance of nhlib.geo.line.Line class, otherwise if already instance of class accept class

Parameters:
  • input_geometry – Trace (line) of the fault source as either i) instance of nhlib.geo.line.Line class ii) numpy.ndarray [Longitude, Latitude]
  • dip (float) – Dip of fault surface (in degrees)
  • upper_depth (float) – Upper seismogenic depth (km)
  • lower_depth (float) – Lower seismogenic depth (km)
  • mesh_spacing (float) – Spacing of the fault mesh (km) {default = 1.0}
create_oqhazardlib_source(tom, mesh_spacing, use_defaults=False)[source]

Returns an instance of the :class: openquake.hazardlib.source.simple_fault.SimpleFaultSource

Parameters:
  • tom – Temporal occurrance model
  • mesh_spacing (float) – Mesh spacing
select_catalogue(selector, distance, distance_metric='joyner-boore', upper_eq_depth=None, lower_eq_depth=None)[source]

Selects earthquakes within a distance of the fault

Parameters:
  • selector – Populated instance of :class: openquake.hmtk.seismicity.selector.CatalogueSelector
  • distance – Distance from point (km) for selection
:param str distance_metric
Choice of fault source distance metric ‘joyner-boore’ or ‘rupture’
Parameters:
  • upper_eq_depth (float) – Upper hypocentral depth of hypocentres to be selected
  • lower_eq_depth (float) – Lower hypocentral depth of hypocentres to be selected

openquake.hmtk.sources.source_conversion_utils module

openquake.hmtk.sources.source_conversion_utils.hdd_to_pmf(hypo_depth_dist, use_default=False)[source]

Returns the hypocentral depth distribtuion as an instance of the :class: openquake.hazardlib.pmf.

openquake.hmtk.sources.source_conversion_utils.mag_scale_rel_to_hazardlib(mag_scale_rel, use_default=False)[source]

Returns the magnitude scaling relation in a format readable by openquake.hazardlib

openquake.hmtk.sources.source_conversion_utils.npd_to_pmf(nodal_plane_dist, use_default=False)[source]

Returns the nodal plane distribution as an instance of the PMF class

openquake.hmtk.sources.source_conversion_utils.render_aspect_ratio(aspect_ratio, use_default=False)[source]

Returns the aspect ratio if one is defined for the source, otherwise if defaults are accepted a default value of 1.0 is returned or else a ValueError is raised

Parameters:
  • aspect_ratio (float) – Ratio of along strike-length to down-dip width of the rupture
  • use_default (bool) – If true, when aspect_ratio is undefined will return default value of 1.0, otherwise will raise an error.
openquake.hmtk.sources.source_conversion_utils.simple_edge_to_wkt_linestring(edge)[source]

Coverts a simple fault trace to well-known text format

Parameters:trace – Fault trace as instance of :class: openquake.hazardlib.geo.line.Line
Returns:Well-known text (WKT) Linstring representation of the trace
openquake.hmtk.sources.source_conversion_utils.simple_trace_to_wkt_linestring(trace)[source]

Coverts a simple fault trace to well-known text format

Parameters:trace – Fault trace as instance of :class: openquake.hazardlib.geo.line.Line
Returns:Well-known text (WKT) Linstring representation of the trace

openquake.hmtk.sources.source_model module

Module implements openquake.hmtk.sources.source_model.mtkSourceModel, the general class to describe a set of seismogenic sources

class openquake.hmtk.sources.source_model.mtkSourceModel(identifier=None, name=None, sources=None)[source]

Bases: object

Object to describe a seismogenic source model (composite of multiple sources with mixed typologies)

Parameters:
  • id (str) – Identifier for the source model
  • name (str) – Source model name
  • sources (list) – List of seismogenic sources
convert_to_oqhazardlib(tom, simple_mesh_spacing=1.0, complex_mesh_spacing=2.0, area_discretisation=10.0, use_defaults=False)[source]

Converts the source model to an iterator of sources of :class: openquake.hazardlib.source.base.BaseSeismicSource

get_number_sources()[source]

Returns the number of sources in the model

serialise_to_nrml(filename, complex_mesh_spacing=2, use_defaults=False)[source]

Writes the source model to a nrml source model file given by the filename

Parameters:
  • filename (str) – Path to output file
  • use_defaults (bool) – Boolean to indicate whether to use default values (True) or not. If set to False, ValueErrors will be raised when an essential attribute is missing.

Module contents