pysep.utils.mt ============== .. py:module:: pysep.utils.mt .. autoapi-nested-parse:: Moment Tensor related functions for grabbing moment tensors, appending them to existing event objects, and writing them out in specific formats such as the CMTSOLUTION format required by SPECFEM Functions --------- .. autoapisummary:: pysep.utils.mt.seismic_moment pysep.utils.mt.moment_magnitude pysep.utils.mt.half_duration_from_m0 pysep.utils.mt.mt_transform pysep.utils.mt.get_gcmt_moment_tensor pysep.utils.mt.get_usgs_moment_tensor pysep.utils.mt.get_geonet_mt pysep.utils.mt.query_geonet_mt_catalog pysep.utils.mt.append_focal_mechanism_to_event Module Contents --------------- .. py:function:: seismic_moment(mt) Return the seismic moment based on a moment tensor. Can take a list of tensor components, or a Tensor object from ObsPy. :type mt: list of floats or obspy.core.event.source.Tensor :param mt: the components of the moment tensor M_ij :rtype: float :return: the seismic moment, in units of N*m .. py:function:: moment_magnitude(moment, c=10.7) Return the moment magitude, M_w, based on a seismic moment. Equation from Hanks & Kanamori (1979) :type c: float :param c: correction factor for conversion, 10.7 for units of N*m, 16.1 for units of dyne*cm :type moment: float :param moment: the seismic moment, in units of N*m :rtype: float :return: moment magnitude, M_w .. py:function:: half_duration_from_m0(moment) Empirical formula for half duration used by Harvard CMT, stated in Dahlen and Tromp (1998, p.178). :type moment: float :param moment: seismic moment in N*m :rtype: float :return: empirically scaled half duration in unit seconds .. py:function:: mt_transform(mt, method) Transform moment tensor between XYZ and RTP coordinates. Used primarily to transform GeoNet (John Ristau) moment tensors into the correct coordinate system for use in SPECFEM Based on Equation from 'Aki and Richards: Quantitative Seismology' book .. note:: Acceptable formats for the parameter `mt`: 1) [m11, m22, m33, m12, m13, m23] 2) [mxx, myy, mzz, mxy, mxz, myz] 3) [mrr, mtt, mpp, mrt, mrp, mtp] :type mt: dict :param mt: moment tensor in format above :type method: str :param method: type of conversion, "rtp2xyz" or "xyz2rtp" :rtype: dict :return: converted moment tensor dictionary .. py:function:: get_gcmt_moment_tensor(event=None, origintime=None, magnitude=None, time_wiggle_sec=120, magnitude_wiggle=0.5) Query online GCMT moment tensor catalog via URL access for moment tensor components of a given event. Searches based on origin time and magnitude of an event with a given amount of wiggle room for catalog mismatch of origin time and magnitude. .. note:: input is either `event` OR `origintime` AND `magnitude` :type event: obspy.core.event.Event :param event: Event to use to query for moment tensor :type origintime: UTCDateTime or str :param origintime: event origin time :type magnitude: float :param magnitude: centroid moment magnitude for event lookup :type time_wiggle_sec: int :param time_wiggle_sec: padding on catalog filtering criteria realted to event origin time :type magnitude_wiggle: float :param magnitude_wiggle: padding on catalog filter for magnitude :rtype: obspy.core.event.Event :return: event object for given earthquake .. py:function:: get_usgs_moment_tensor(event, time_wiggle_sec=120.0, magnitude_wiggle=0.5, latitude_wiggle_deg=1.0, longitude_wiggle_deg=1.0, depth_wiggle_km=5.0, **kwargs) Query FDSN webservices USGS client for moment tensors using the current event definition, which may or may not have been collected via USGS. Kwargs passed to Client.get_events() for additional event constraint pars :type event: obspy.core.event.Event :param event: Event to use to query for moment tensor :type time_wiggle_sec: float :param time_wiggle_sec: padding on catalog filtering criteria realted to event origin time :type magnitude_wiggle: float :param magnitude_wiggle: +/- padding on magnitude search :type latitude_wiggle_deg: float :param latitude_wiggle_deg: +/- padding on latitude search :type longitude_wiggle_deg: float :param longitude_wiggle_deg: +/- padding on longitude search :type depth_wiggle_km: float :param depth_wiggle_km: +/- padding on depth search :rtype: obspy.core.event.Event :return: event object for given earthquake .. py:function:: get_geonet_mt(event_id, units, csv_fid=None) Focal mechanisms created by John Ristau are written to a .csv file located on Github. This function will append information from the .csv file onto the Obspy event object so that all the information can be located in a single object :type event_id: str :param event_id: unique event identifier :type units: str :param units: output units of the focal mechanism, either: 'dynecm': for dyne*cm or 'nm': for Newton*meter :type csv_fid: str :param csv_fid: optional local path to .csv file containing Ristau catalog of moment tensors. If not given, will search a default online URL where the catalog is assumed to be stored :rtype focal_mechanism: obspy.core.event.FocalMechanism :return focal_mechanism: generated focal mechanism .. py:function:: query_geonet_mt_catalog(event_id, csv_fid=None) Get moment tensor information from a internal csv file, or from an external github repository query. Only relevant to the new zealand tomography problem. Geonet moment tensors stored with a specific column format. :type event_id: str :param event_id: unique event identifier :type csv_fid: str :param csv_fid: optional path to GeoNet CMT solution file that is stored locally on disk, will be accessed before querying web service :rtype moment_tensor: dict :return moment_tensor: dictionary created from rows of csv file .. py:function:: append_focal_mechanism_to_event(event, method='all', overwrite_focmec=False, overwrite_event=False, client=None) Attempt to find focal mechanism information with a given ObsPy Event object. .. note:: FDSN fetched events are devoid of a few bits of information that are useful for our applications, e.g. moment tensor, focal mechanisms. This function will perform the conversions and append the necessary information to the event located in the dataset. :type event: obspy.core.event.Event :param event: Event object to append a focal mechanism to. :type method: bool :param method: try to find correspondig focal mechanism using various public catalogs. Currently available: 'all': Try all available options in order until MT is found 'USGS': Search the USGS moment tensor catalog 'GCMT': Search the GCMT moment tensor catalog False: Don't attempt to search for moment tensors :type client: str :param client: Specific `client`s come built-in with specific MT catalogs If matching client, will ignore other MT choices: 'GEONET': will search John Ristau catalog for moment tensors, :type overwrite_focmec: bool :param overwrite_focmec: If the event already has a focal mechanism, overwrite the existing focal mechanism. :type overwrite_event: bool :param overwrite_event: A new event object is usually retrieved when gathering MT from USGS or GCMT. Often the locations/timing of this event are less accurate than the input event (which is usually sourced from a regional catalog). This parameter controls which event object is taken. If `True`, takes the USGS or GCMT catalog information, if `False` only takes the focal mechanism attribute. :rtype event: obspy.core.event.Event :return event: Event with a new focal mechanism if one was found :raises TypeError: if event is not provided as an obspy.core.event.Event