obspy.io.sac.arrayio.read_sac

read_sac(source, headonly=False, byteorder=None, checksize=False)[source]

Read a SAC binary file.

Parameters:
  • source (str or file) Full path string for File-like object from a SAC binary file on disk. If it is an open File object, open ‘rb’.
  • headonly (bool) If headonly is True, only read the header arrays not the data array.
  • byteorder (str {‘little’, ‘big’}, optional) If omitted or None, automatic byte-order checking is done, starting with native order. If byteorder is specified and incorrect, a SacIOError is raised.
  • checksize (bool) If True, check that the theoretical file size from the header matches the size on disk.
Returns:

The float, integer, and string header arrays, and data array, in that order. Data array will be None if headonly is True.

Return type:

tuple of numpy.ndarray

Raises:

ValueError if unrecognized byte order. IOError if file not found, incorrect specified byteorder, theoretical file size doesn’t match header, or header arrays are incorrect length.