obspy.io.sac.core._write_sac

_write_sac(stream, filename, byteorder='<', **kwargs)[source]

Writes a SAC file.

Warning

This function should NOT be called directly, it registers via the the write() method of an ObsPy Stream object, call this instead.

Parameters:
  • stream (Stream) The ObsPy Stream object to write.
  • filename (str, open file, or file-like object) Name of file to write. In case an open file or file-like object is passed, this function only supports writing Stream objects containing a single Trace. This is a limitation of the SAC file format. An exception will be raised in case it’s necessary.
  • byteorder (int or str) Must be either 0 or '<' for LSBF or little-endian, 1 or '>' for MSBF or big-endian. Defaults to little endian.

Example

>>> from obspy import read
>>> st = read()
>>> st.write("test.sac", format="SAC")