openquake.hmtk.parsers.catalogue package#

Submodules#

openquake.hmtk.parsers.catalogue.base module#

Module openquake.hmtk.parsers.catalogue.base defines an abstract base class for CatalogueParser.

class openquake.hmtk.parsers.catalogue.base.BaseCatalogueParser(input_file)[source]#

Bases: object

A base class for a Catalogue Parser

abstract read_file()[source]#

Return an instance of the class Catalogue

class openquake.hmtk.parsers.catalogue.base.BaseCatalogueWriter(output_file)[source]#

Bases: object

A base class for a Catalogue writer

abstract write_file()[source]#

Return an instance of the class Catalogue

openquake.hmtk.parsers.catalogue.csv_catalogue_parser module#

Module openquake.hmtk.parsers.catalogue.csv_catalogue_parser implements CsvCatalogueParser.

class openquake.hmtk.parsers.catalogue.csv_catalogue_parser.CsvCatalogueParser(input_file)[source]#

Bases: BaseCatalogueParser

CSV Catalogue Parser Class

read_file(start_year=None, end_year=None)[source]#
class openquake.hmtk.parsers.catalogue.csv_catalogue_parser.CsvCatalogueWriter(output_file)[source]#

Bases: BaseCatalogueWriter

Writes catalogue to csv file

OUTPUT_LIST = ['eventID', 'Agency', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeError', 'longitude', 'latitude', 'SemiMajor90', 'SemiMinor90', 'ErrorStrike', 'depth', 'depthError', 'magnitude', 'sigmaMagnitude', 'magnitudeType']#
apply_purging(catalogue, flag_vector, magnitude_table)[source]#

Apply all the various purging conditions, if specified.

Parameters:
  • catalogue – Earthquake catalogue as instance of openquake.hmtk.seismicity.catalogue.Catalogue

  • flag_vector (numpy.array) – Boolean vector specifying whether each event is valid (therefore written) or otherwise

  • magnitude_table (numpy.ndarray) – Magnitude-time table specifying the year and magnitudes of completeness

write_file(catalogue, flag_vector=None, magnitude_table=None)[source]#

Writes the catalogue to file, purging events if necessary.

Parameters:
  • catalogue – Earthquake catalogue as instance of :class: openquake.hmtk.seismicity.catalogue.Catalogue

  • flag_vector (numpy.array) – Boolean vector specifying whether each event is valid (therefore written) or otherwise

  • magnitude_table (numpy.ndarray) – Magnitude-time table specifying the year and magnitudes of completeness

class openquake.hmtk.parsers.catalogue.csv_catalogue_parser.CsvGCMTCatalogueWriter(output_file)[source]#

Bases: CsvCatalogueWriter

Writes GCMT catalogue to csv file

OUTPUT_LIST = ['eventID', 'centroidID', 'Agency', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeError', 'longitude', 'latitude', 'depth', 'depthError', 'magnitude', 'sigmaMagnitude', 'magnitudeType', 'moment', 'SemiMajor90', 'SemiMinor90', 'ErrorStrike', 'strike1', 'rake1', 'dip1', 'strike2', 'rake2', 'dip2', 'f_clvd', 'e_rel', 'eigenvalue_b', 'azimuth_b', 'plunge_b', 'eigenvalue_p', 'azimuth_p', 'plunge_p', 'eigenvalue_t', 'azimuth_t', 'plunge_t']#
apply_purging(catalogue, flag_vector, magnitude_table)[source]#

Apply all the various purging conditions, if specified.

Parameters:
  • catalogue – Earthquake catalogue as instance of :class: openquake.hmtk.seismicity.catalogue.Catalogue:

  • flag_vector (numpy.array) – Boolean vector specifying whether each event is valid (therefore written) or otherwise

  • magnitude_table (numpy.ndarray) – Magnitude-time table specifying the year and magnitudes of completeness

write_file(catalogue, flag_vector=None, magnitude_table=None)[source]#

Writes the catalogue to file, purging events if necessary.

Parameters:
  • catalogue – Earthquake catalogue as instance of :class: openquake.hmtk.seismicity.catalogue.Catalogue

  • flag_vector (numpy.array) – Boolean vector specifying whether each event is valid (therefore written) or otherwise

  • magnitude_table (numpy.ndarray) – Magnitude-time table specifying the year and magnitudes of completeness

class openquake.hmtk.parsers.catalogue.csv_catalogue_parser.GCMTCsvCatalogueParser(input_file)[source]#

Bases: CsvCatalogueParser

openquake.hmtk.parsers.catalogue.gcmt_ndk_parser module#

Parser for moment tensor catalogue in GCMT format into a set of GCMT classes

class openquake.hmtk.parsers.catalogue.gcmt_ndk_parser.ParseNDKtoGCMT(filename)[source]#

Bases: object

Implements the parser to read a file in ndk format to the GCMT catalogue

read_file(start_year=None, end_year=None, use_centroid=False)[source]#

Reads the file

read_ndk_event(raw_data, id0)[source]#

Reads a 5-line batch of data into a set of GCMTs

to_hmtk(use_centroid=True)[source]#

Convert the content of the GCMT catalogue to a HMTK catalogue.

Module contents#

Package openquake.hmtk.parsers.catalogue contains base classes and implementations of catalogue parsers.