obspy.io.hypodd.pha._read_pha
- _read_pha(filename, eventid_map=None, encoding='utf-8', **kwargs)[source]
Read a HypoDD PHA file and returns an ObsPy Catalog object.
Warning
This function should NOT be called directly, it registers via the ObsPy
read_events()
function, call this instead.- Parameters:
filename (str) – File or file-like object in text mode.
ph2comp (dict) – mapping of phases to components (default: {‘P’: ‘Z’, ‘S’: ‘N’})
eventid_map (dict) – Desired mapping of hypodd event ids (dict values) to event resource ids (dict keys). The returned dictionary of the HYPODDPHA writing operation can be used. By default, ids are not mapped.
encoding (str) – encoding used (default: utf-8)
- Return type:
- Returns:
An ObsPy Catalog object.
The following parameters deal with the problem, that the format only stores station names for the picks, but the Pick object expects a SEED id. The SEED id is looked up for every pick by the following procedure:
look at seedid_map for a direct station name match and use the specified template
if 1 did not succeed, look if the station is present in inventory and use its first channel as template
if 1 and 2 did not succeed, use specified default template (default_seedid)
- Parameters:
inventory (
Inventory
) – Inventory used to retrieve network code, location code and channel code of stations (SEED id).seedid_map (dict) – Default templates for each station (example: seedid_map={‘MOX’: ‘GR.{}..HH{}’). The values must contain three dots and two {} which are substituted by station code and component.
default_seedid (str) – Default SEED id template. The value must contain three dots and two {} which are substituted by station code and component.
warn (bool) – Whether or not to warn on failed look ups (no matching data found or ambiguous results) in the inventory
ph2comp (dict) – mapping of phases to components if format does not specify the component or if the component ends with ‘?’. Set it to None for no mapping of components. (default: {‘P’: ‘Z’, ‘S’: ‘N’})