sac-format 0.6.0 C++20 SAC (Seismic Analysis Code) File Library  | 
This section provides a centralized description of the SAC file format.
The official and up-to-date documentation for the SAC-file format is available from the EarthScope Consortium (formerly IRIS/UNAVCO) here. The following subsections constitute my notes on the format. Below is a quick guide: all credit for the creation of, and documentation for, the SAC file-format belongs to its developers and maintainers (details here).
32-bit (1 word, 4 bytes)
Pre-data word 001.
Minimum value of the dependent variable (displacement/velocity/acceleration/volts/counts).
Pre-data word 057.
Mean value of the dependent variable.
Pre-data word 002.
Maximum value of the dependent variable.
Pre-data word 004.
Modified (observational) value of delta.
Pre-data words 021–030.
Instrument response parameters (poles, zeros, and a constant).
Not used by SAC they're free for other purposes.
Pre-data word 033.
Station elevation in meters above sea level (m.a.s.l).
Not used by SAC free for other purposes.
Pre-data word 034.
Station depth in meters below surface (borehole/buried vault).
Not used by SAC free for other purposes.
Pre-data word 037.
Event elevation m.a.s.l.
Not used by SAC free for other purposes.
Pre-data word 038.
Event depth in kilometers (previously meters) below surface.
Pre-data word 039.
Event magnitude.
Pre-data words 040–049.
Storage for user-defined values.
Pre-data word 050.
Station-Event distance in kilometers.
Pre-data word 051.
Azimuth 
, decimal degrees from North.
Pre-data word 052.
Back-azimuth 
, decimal degrees from North.
Pre-data word 053.
Station-Event great circle arc-length, decimal degrees.
Pre-data word 057.
Instrument measurement azimuth, decimal degrees from North.
| Value | Direction | 
|---|---|
| 0° | North | 
| 90° | East | 
| 180° | South | 
| 270° | West | 
| Other | 1/2/3 | 
Pre-data word 058.
Instrument measurement incident angle, decimal degrees from upward vertical (incident 0° = dip -90°).
| Value | Direction | 
|---|---|
| 0° | Up | 
| 90° | Horizontal | 
| 180° | Down | 
| 270° | Horizontal | 
NOTE: SEED/MINISEED use dip angle, decimal degrees down from horizontal (dip 0° = incident 90°).
Pre-data word 059.
Spectral-only equivalent of depmin ( 
 or 
).
Pre-data word 060.
Spectral-only equivalent of depmax ( 
 or 
).
Pre-data word 061.
Spectral-only equivalent of b.
Pre-data word 062.
Spectral-only equivalent of e.
64-bit (2 words, 8 bytes)
NOTE: in the header section these are floats; they're doubles in the footer section of v7 SAC-files. In memory they're stored as doubles regardless of the SAC-file version.
Pre-data word 000, post-data words 00-01.
Increment between evenly spaced samples ( 
 for timeseries, 
 or 
 for spectra).
Pre-data word 005, post-data words 02-03.
First value (begin) of independent variable ( 
).
Pre-data word 006, post-data words 04-05.
Final value (end) of independent variable ( 
).
Pre-data word 007, post-data words 06-07.
Event origin time, in seconds relative to the reference time.
Pre-data word 008, post-data words 08-09.
Event first arrival time, in seconds relative to the reference time.
Pre-data words 010–019, post-data words 10–29.
User defined time values, in seconds relative to the reference time.
Pre-data word 020, post-data words 30-31.
Event end (fini) time, in seconds relative to the reference time.
Pre-data word 031, post-data words 36-37.
Station latitude in decimal degrees, N/S - positive/negative.
sac-format automatically enforces 
.
Pre-data word 032, post-data words 38-39.
Station longitude in decimal degrees, E/W - positive/negative.
sac-format automatically enforces 
.
Pre-data word 035, post-data words 32-33.
Event latitude in decimal degrees, N/S - positive/negative.
sac-format automatically enforces 
.
Pre-data word 036, post-data words 34-35.
Event longitude in decimal degrees, E/W - positive/negative.
sac-format automatically enforces 
.
Pre-data word 054, post-data words 40-41.
Original (saved) b value.
Pre-data word 055, post-data words 42-43.
Original (saved) delta value.
32-bit (1 word, 4 bytes)
Pre-data word 070.
Reference time GMT year.
Pre-data word 071.
Reference time GMT day-of-year (often called Julian Date) (1–366).
Pre-data word 072.
Reference time GMT hour (0–23).
Pre-data word 073.
Reference time GMT minute (0–59).
Pre-data word 074.
Reference time GMT second (0–59).
Pre-data word 075.
Reference time GMT Millisecond (0–999).
Pre-data word 076.
SAC-file version.
| Version | Description | 
|---|---|
v7 | Footer (2020+, sac 102.0+) | 
v6 | No footer (pre-2020, sac 101.6a-) | 
Pre-data word 077.
Origin ID.
Pre-data word 078.
Event ID.
Pre-data word 079.
Number of points in data.
Pre-data word 080.
Original (saved) npts.
Pre-data word 081.
Waveform ID.
Pre-data word 082.
Spectral-only equivalent of npts (length of spectrum).
Pre-data word 083.
Spectral-only, width of spectrum.
Pre-data word 085.
File type.
| Value | Type | Description | 
|---|---|---|
| 01 | ITIME | Time-series | 
| 02 | IRLIM | Spectral (real/imaginary) | 
| 03 | IAMPH | Spectral (amplitude/phase) | 
| 04 | IXY | General XY file | 
| ?? | IXYZ∗ | General XYZ file | 
∗Value not listed in the standard.
Pre-data word 086.
Dependent variable type.
| Value | Type | Description | 
|---|---|---|
| 05 | IUNKN | Unknown | 
| 06 | IDISP | Displacement (nm) | 
| 07 | IVEL | Velocity  | 
| 08 | IACC | Acceleration  | 
| 50 | IVOLTS | Velocity (volts) | 
Pre-data word 087.
Reference time equivalent.
| Value | Type | Description | 
|---|---|---|
| 05 | IUNKN | Unknown | 
| 09 | IB | Recording start time | 
| 10 | IDAY | Midnight reference GMT day | 
| 11 | IO | Event origin time | 
| 12 | IA | First arrival time | 
| 13-22 | IT(0-9) | User defined time (t) pick | 
Pre-data word 089.
Recording instrument type.
Not used by SAC: free for other purposes.
Pre-data word 090.
Station geographic region.
Not used by SAC: free for other purposes.
Pre-data word 091.
Event geographic region.
Not used by SAC: free for other purposes.
Pre-data word 092.
Event type.
| Value | Type | Description | 
|---|---|---|
| 05 | IUNKN | Unknown | 
| 11 | IO | Other source of known origin | 
| 37 | INUCL | Nuclear | 
| 38 | IPREN | Nuclear pre-shot | 
| 39 | IPOSTN | Nuclear post-shot | 
| 40 | IQUAKE | Earthquake | 
| 41 | IPREQ | Foreshock | 
| 42 | IPOSTQ | Aftershock | 
| 43 | ICHEM | Chemical explosion | 
| 44 | IOTHER | Other | 
| 72 | IQB | Quarry/mine blast: confirmed by quarry/mine | 
| 73 | IQB1 | Quarry/mine blast: designed shot info-ripple fired | 
| 74 | IQB2 | Quarry/mine blast: observed shot info-ripple fired | 
| 75 | IQBX | Quarry/mine blast: single shot | 
| 76 | IQMT | Quarry/mining induced events: tremor and rockbursts | 
| 77 | IEQ | Earthquake | 
| 78 | IEQ1 | Earthquake in a swarm or in an aftershock sequence | 
| 79 | IEQ2 | Felt earthquake | 
| 80 | IME | Marine explosion | 
| 81 | IEX | Other explosion | 
| 82 | INU | Nuclear explosion | 
| 83 | INC | Nuclear cavity collapse | 
| 85 | IL | Local event of unknown origin | 
| 86 | IR | Region event of unknown origin | 
| 87 | IT | Teleseismic event of unknown origin | 
| 88 | IU | Undetermined/conflicting information | 
Pre-data word 093.
Quality of data.
| Value | Type | Description | 
|---|---|---|
| 44 | IOTHER | Other | 
| 45 | IGOOD | Good | 
| 46 | IGLCH | Glitches | 
| 47 | IDROP | Dropouts | 
| 48 | ILOWSN | Low signal-to-noise ratio | 
Not used by SAC: free for other purposes.
Pre-data word 094.
Synthetic data flag.
| Value | Type | Description | 
|---|---|---|
| 49 | IRLDATA | Real data | 
| XX | ∗ | Synthetic | 
∗Values and types not listed in the standard.
Pre-data word 095.
Magnitude type.
| Value | Type | Description | 
|---|---|---|
| 52 | IMB | Body-wave magnitude (  | 
| 53 | IMS | Surface-wave magnitude (  | 
| 54 | IML | Local magnitude (  | 
| 55 | IMW | Moment magnitude (  | 
| 56 | IMD | Duration magnitude (  | 
| 57 | IMX | User-defined magnitude (  | 
Pre-data word 096.
Source of magnitude information.
| Value | Type | Description | 
|---|---|---|
| 58 | INEIC | National Earthquake Information Center | 
| 61 | IPDE | Preliminary Determination of Epicenter | 
| 62 | IISC | Internation Seismological Centre | 
| 63 | IREB | Reviewed Event Bulletin | 
| 64 | IUSGS | U.S. Geological Survey | 
| 65 | IBRK | UC Berkeley | 
| 66 | ICALTECH | California Institute of Technology | 
| 67 | ILLNL | Lawrence Livermore National Laboratory | 
| 68 | IEVLOC | Event location (computer program) | 
| 69 | IJSOP | Joint Seismic Observation Program | 
| 70 | IUSER | The user | 
| 71 | IUNKNOWN | Unknown | 
Pre-data word 097.
Body/spheroid definition used to calculate distances.
| Value | Type | Name | Semi-major axis (a [m]) | Inverse Flattening (f) | 
|---|---|---|---|---|
| -12345 | UNDEF | Earth (Historic) | 6378160.0 | 0.00335293 | 
| 98 | ISUN | Sun | 696000000.0 | 8.189e-6 | 
| 99 | IMERCURY | Mercury | 2439700.0 | 0.0 | 
| 100 | IVENUS | Venus | 6051800.0 | 0.0 | 
| 101 | IEARTH | Earth (WGS84) | 6378137.0 | 0.0033528106647474805 | 
| 102 | IMOON | Moon | 1737400.0 | 0.0 | 
| 103 | IMARS | Mars | 3396190.0 | 0.005886007555525457 | 
Pre-data word 105.
32-bit (1 word, 4 bytes) in-file/8-bit (1 byte) in-memory
Pre-data word 106.
REQUIRED Evenly-spaced data flag.
If true, then data is evenly spaced.
Pre-data word 107.
Station polarity flag.
If true, then station has positive-polarity; it follows the left-hand convention (for example, North-East-Up [NEZ]).
Pre-data word 108.
File overwrite flag.
If true, then it's okay to overwrite the file.
Pre-data word 109.
Calculate geometry flag.
If true, then calculate dist, az, baz, and gcarc from stla, stlo, evla, and evlo.
32/64-bit (2/4 words, 8/16 bytes, 8/16 characters)
Pre-data words 110–111.
Station name.
Pre-data words 112–115.
Event name.
∗This is the only four word (16 character) string.
Pre-data words 116–117.
Nuclear: Hole identifier.
Other: Location identifier (LOCID).
Pre-data words 118–119.
Text for o.
Pre-data words 120–121.
Text for a.
Pre-data words 112–141.
Text for t(0--9).
Pre-data words 142–143.
Text for f.
Pre-data words 144–149.
Text for the first three of user(0--9).
Pre-data words 150–151.
Component name.
Pre-data words 152–153.
Network name.
Pre-data words 154–155.
Date the data was read onto a computer.
Pre-data words 156–157.
Text for iinst.
32-bit (2 words, 8 bytes) in-file/64-bit (4 words, 16 bytes) in-memory
Stored as floating-point (32-bit) values in SAC-files; stored as double-precision in memory.
Words 158–(158 + npts)
The first data vector—**always** present in a SAC-file and begins at word 158.
Words (158 + 1 + npts)–(159 + (2 * npts))
The second data vector—**conditionally** present and begins after data1.
Required if leven is false, or if iftype is spectral/XY/XYZ.