Los Alamos National Laboratory

Los Alamos National Laboratory

Delivering science and technology to protect our nation and promote world stability

PySAC

A Python interface to the Seismic Analysis Code (SAC) file format

Contact Us  

  • Seismoacoustics Software Team
  • Email

PySAC is a Python interface to the Seismic Analysis Code (SAC) file format, supporting little and big-endian binary and alphanumeric format, containing evenly-sampled time-series data.

PySAC emphasizes intuitive header access, header consistency, and ObsPy support.

Features

  1. Read and write SAC binary or ASCII
    • autodetect or specify expected byteorder
    • optional file size checking and/or header consistency checks
    • header-only reading and writing
    • “overwrite OK” checking (‘lovrok’ header)
  2. Convenient access and manipulation of relative and absolute time headers
  3. User-friendly header printing/viewing
  4. Fast access to header values from attributes
    • With type checking, null handling, and enumerated value checking
  5. With type checking, null handling, and enumerated value checking
    • Conversion from ObsPy Trace to SAC trace retains detected previous SAC header values.
    • Conversion to ObsPy Trace retains the complete SAC header.