5.9. sfile_util¶
Part of the EQcorrscan module to read nordic format s-files and write them EQcorrscan is a python module designed to run match filter routines for seismology, within it are routines for integration to seisan and obspy. With obspy integration (which is necessary) all main waveform formats can be read in and output.
Note that these functions do not provide full functionality between quakeML and seisan s-files. Currently (as of version 0.1.1) these only convert pick times and phase information, along with amplitude information for local magnitudes between seisan and quakeML. Location information including hypocentre, origin time and magnitudes are also handled.
A series of wrappers and conversions is included between the legacy PICK and EVENTINFO classes, however these will be depreciated along with these classes for version 0.1.0. Users should transition to using obspy.core.event classes as these have more support and functionality.
We have not implimented any handling of focal mechanism solutions between the two formats.
Note
Pick time-residauls are handled in event.origins[0].arrivals, with the arrival.pick_id linking the arrival (which contain calculated information) with the pick.resource_id (where the pick contains only physical measured information).
Example: |
---|
>>> from eqcorrscan.utils import sfile_util
>>> event = sfile_util.readpicks('eqcorrscan/tests/test_data/REA/TEST_/' +
... '01-0411-15L.S201309')
>>> pick = event.picks[0]
>>> time_rms = [arrival.time_residual for arrival in event.origins[0].arrivals
... if arrival.pick_id == pick.resource_id]
copyright: | Calum Chamberlain, Chet Hopp. |
---|---|
license: | GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html) |
5.9.1. Classes & Functions¶
EVENTINFO |
Header information for seisan events, again all fields can be left blank for a default empty header. |
PICK |
Pick information for seisan implimentation, note all fields can be left blank to obtain a default pick: picks have a print function which will print them as they would be seen in an S-file. |
blanksfile |
Module to generate an empty s-file with a populated header for a given waveform. |
eventtopick |
Wrapper function to convert from obspy.core.event to legacy PICK and EVENT classes. |
eventtosfile |
Function to take an obspy.event and write the relevant information to a nordic formatted s-file |
nordpick |
Function to print information from an obspy.event class to nordic format. |
picktoevent |
Wrapper function to convert from EVENTINFO and PICK classes to obspy.core.event.Event. |
populatesfile |
Module to populate a blank nordic format S-file with pick information, arguments required are the filename of the blank s-file and the picks where picks is a dictionary of picks including station, channel, impulsivity, phase, weight, polarity, time, coda, amplitude, peri, azimuth, velocity, SNR, azimuth residual, Time-residual, final weight, epicentral distance & azimuth from event to station. |
readheader |
Function to read the header information from a seisan nordic format S-file. |
readpicks |
Function to read pick information from the s-file and store this in an obspy.event.Catalog type. |
readwavename |
Convenience function to extract the waveform filename from the s-file, returns a list of waveform names found in the s-file as multiples can be present. |
stationtoseisan |
Convert obspy station inventory to simple string to copy in to STATION0.HYP file for seisan locations. |
5.9.2. Private Functions¶
Note that these functions are not designed for public use and may change at any point.
_evmagtonor |
Convenience tool to switch from obspy event magnitude types to seisan syntax |
_float_conv |
Convenience tool to convert from string to float, if empty string return NaN rather than an error |
_int_conv |
Convenience tool to convert from string to integer, if empty string return a 999 rather than an error. |
_nortoevmag |
Convenience tool to switch from nordic type magnitude notation to obspy event magnitudes. |
_str_conv |
Convenience tool to convert a number, either float or into into a string, if the int is 999, or the float is NaN, returns empty string. |