5.14. sfile_util

Part of the EQcorrscan module to read nordic format s-files and write them. Maps between Nordic format and obspy Event objects.

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 implemented any handling of focal mechanism solutions between the two formats.


Pick time-residuals 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).

>>> 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:EQcorrscan developers.
license:GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

5.14.1. Functions

blanksfile Generate an empty s-file with a populated header for a given waveform.
eventtosfile Write an obspy.event to a nordic formatted s-file.
nordpick Format information from an obspy.event class to nordic string format.
populatesfile Populate a blank nordic format S-file with pick information.
readheader Read header information from a seisan nordic format S-file.
readpicks Read all pick information from the s-file to an obspy.event.Catalog type.
readwavename Extract the waveform filename from the s-file.
stationtoseisan Convert obspy inventory to string formatted for Seisan STATION0.HYP file.

5.14.2. Private Functions

Note that these functions are not designed for public use and may change at any point.

_evmagtonor Switch from obspy event magnitude types to seisan syntax.
_float_conv Convenience tool to convert from string to float.
_int_conv Convenience tool to convert from string to integer.
_nortoevmag Switch from nordic type magnitude notation to obspy event magnitudes.
_str_conv Convenience tool to convert a number, either float or int into a string.