obspy.io.sac.sactrace.SACTrace.to_obspy_trace
- SACTrace.to_obspy_trace(debug_headers=False, encoding='ASCII', round_sampling_interval=True)[source]
Return an ObsPy Trace instance.
Required headers: nz-time fields, npts, delta, calib, kcmpnm, kstnm, …?
- Parameters:
debug_headers (bool) – Include _all_ SAC headers into the Trace.stats.sac dictionary.
encoding (str) – Encoding string that passes the user specified encoding scheme.
round_sampling_interval (bool) – Whether to round sampling interval to microseconds before calculating sampling rate to avoid floating point accuracy issues with some SAC files (see #3408)
Example
>>> from obspy.core.util import get_example_file >>> file_ = get_example_file("test.sac") >>> sac = SACTrace.read(file_, headonly=True) >>> tr = sac.to_obspy_trace() >>> print(tr) .STA..Q | 1978-07-18T08:00:10.000000Z - ... | 1.0 Hz, 100 samples