openquake.hmtk.seismicity.smoothing package

Submodules

openquake.hmtk.seismicity.smoothing.smoothed_seismicity module

Module :mod: openquake.hmtk.seismicity.smoothing.smoothed_seismicity implements the :class: openquake.hmtk.seismicity.smoothing.smoothed_seismicity.SmoothedSeismicity, a general class for implementing seismicity smoothing algorithms

class openquake.hmtk.seismicity.smoothing.smoothed_seismicity.Grid[source]

Bases: collections.OrderedDict

as_list()[source]
as_polygon()[source]
dilate(width)[source]
classmethod make_from_catalogue(catalogue, spacing, dilate)[source]

Defines the grid on the basis of the catalogue

classmethod make_from_list(grid_limits)[source]
class openquake.hmtk.seismicity.smoothing.smoothed_seismicity.IsotropicGaussianMethod[source]

Bases: object

run(catalogue, config, completeness=None)[source]
class openquake.hmtk.seismicity.smoothing.smoothed_seismicity.SmoothedSeismicity(grid_limits, use_3d=False, bvalue=None)[source]

Bases: object

Class to implement an analysis of Smoothed Seismicity, including the grid counting of data and the smoothing.

Parameters:
  • grid (np.ndarray) – Observed count in each cell [Long., Lat., Depth., Count]
  • catalogue – Valid instance of the :class: openquake.hmtk.seismicity.catalogue.Catalogue
  • use_3d (bool) – Decide if analysis is 2-D (False) or 3-D (True). If 3-D then distances will use hypocentral distance, otherwise epicentral distance
  • bval (float) – b-value
  • beta (float) – Beta value for exponential form (beta = bval * log(10.))
  • data (np.ndarray) – Smoothed seismicity output
  • grid_limits (dict) – Limits ot the grid used for defining the cells
create_2D_grid_simple(longitude, latitude, year, magnitude, completeness_table, t_f=1.0, mag_inc=0.1)[source]

Generates the grid from the limits using an approach closer to that of Frankel (1995)

Parameters:
  • longitude (numpy.ndarray) – Vector of earthquake longitudes
  • latitude (numpy.ndarray) – Vector of earthquake latitudes
  • year (numpy.ndarray) – Vector of earthquake years
  • magnitude (numpy.ndarray) – Vector of earthquake magnitudes
  • completeness_table (numpy.ndarray) – Completeness table
  • t_f (float) – Weichert adjustment factor
Returns:

Two-dimensional spatial grid of observed rates

create_3D_grid(catalogue, completeness_table, t_f=1.0, mag_inc=0.1)[source]

Counts the earthquakes observed in a three dimensional grid

Parameters:
  • catalogue – Instance of the openquake.hmtk.seismicity.catalogue.Catalogue class catalogue.data dictionary containing the following - ‘year’ - numpy.ndarray vector of years ‘longitude’ - numpy.ndarray vector of longitudes ‘latitude’ - numpy.ndarray vector of latitudes ‘depth’ - numpy.ndarray vector of depths
  • completeness_table (np.ndarray) – Completeness of the catalogue assuming evenly spaced magnitudes from most recent bin to oldest bin [year, magnitude]
  • t_f (float) – Weichert adjustment factor
  • mag_inc (float) – Increment of the completeness magnitude (rendered 0.1)
Returns:

Three-dimensional spatial grid of observed rates (or two dimensional if only one depth layer is considered)

run_analysis(catalogue, config, completeness_table=None, smoothing_kernel=None)[source]

Runs an analysis of smoothed seismicity in the manner originally implemented by Frankel (1995)

Parameters:
  • catalogue – Instance of the openquake.hmtk.seismicity.catalogue.Catalogue class catalogue.data dictionary containing the following - ‘year’ - numpy.ndarray vector of years ‘longitude’ - numpy.ndarray vector of longitudes ‘latitude’ - numpy.ndarray vector of latitudes ‘depth’ - numpy.ndarray vector of depths
  • config (dict) – Configuration settings of the algorithm: * ‘Length_Limit’ - Maximum number of bandwidths for use in smoothing (Float) * ‘BandWidth’ - Bandwidth (km) of the Smoothing Kernel (Float) * ‘increment’ - Output incremental (True) or cumulative a-value (False)
  • completeness_table (np.ndarray) – Completeness of the catalogue assuming evenly spaced magnitudes from most recent bin to oldest bin [year, magnitude]
  • smoothing_kernel – Smoothing kernel as instance of :class: openquake.hmtk.seismicity.smoothing.kernels.base.BaseSmoothingKernel
Returns:

Full smoothed seismicity data as np.ndarray, of the form [Longitude, Latitude, Depth, Observed, Smoothed]

write_to_csv(filename)[source]

Exports to simple csv

Parameters:filename (str) – Path to file for export
openquake.hmtk.seismicity.smoothing.smoothed_seismicity.get_catalogue_bounding_polygon(catalogue)[source]

Returns a polygon containing the bounding box of the catalogue

openquake.hmtk.seismicity.smoothing.utils module

Module openquake.hmtk.seismicity.smoothing.utils implements utility functions for smoothed seismicity analysis

openquake.hmtk.seismicity.smoothing.utils.check_completeness_table(completeness_table, catalogue)[source]

Check to ensure completeness table is in the correct format completeness_table = np.array([[year_, mag_i]]) for i in number of bins

Parameters:
  • completeness_table (np.ndarray) – Completeness table in format [[year, mag]]
  • catalogue – Instance of openquake.hmtk.seismicity.catalogue.Catalogue class
Returns:

Correct completeness table

openquake.hmtk.seismicity.smoothing.utils.get_even_magnitude_completeness(completeness_table, catalogue=None)[source]

To make the magnitudes evenly spaced, render to a constant 0.1 magnitude unit

Parameters:
  • completeness_table (np.ndarray) – Completeness table in format [[year, mag]]
  • catalogue – Instance of openquake.hmtk.seismicity.catalogue.Catalogue class
Returns:

Correct completeness table

openquake.hmtk.seismicity.smoothing.utils.get_weichert_factor(beta, cmag, cyear, end_year)[source]

Gets the Weichert adjustment factor for each the magnitude bins

Parameters:
  • beta (float) – Beta value of Gutenberg & Richter parameter (b * log(10.))
  • cmag (np.ndarray) – Magnitude values of the completeness table
  • cyear (np.ndarray) – Year values of the completeness table
  • end_year (float) – Last year for consideration in the catalogue
Returns:

Weichert adjustment factor (float)

openquake.hmtk.seismicity.smoothing.utils.hermann_adjustment_factors(bval, min_mag, mag_inc)[source]

Returns the adjustment factors (fval, fival) proposed by Hermann (1978)

Parameters:
  • bval (float) – Gutenberg & Richter (1944) b-value
  • min_mag (np.ndarray) – Minimum magnitude of completeness table
  • float mag_inc (non-negative) – Magnitude increment of the completeness table
openquake.hmtk.seismicity.smoothing.utils.incremental_a_value(bval, min_mag, mag_inc)[source]

Incremental a-value from cumulative - using the version of the Hermann (1979) formula described in Wesson et al. (2003)

Parameters:
  • bval (float) – Gutenberg & Richter (1944) b-value
  • min_mag (np.ndarray) – Minimum magnitude of completeness table
  • mag_inc (float) – Magnitude increment of the completeness table

Module contents