obspy.io.sac.sactrace.SACTrace.to_obspy_trace

SACTrace.to_obspy_trace(debug_headers=False, encoding='ASCII')[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.

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