sac-format 0.6.0
C++20 SAC (Seismic Analysis Code) File Library
Loading...
Searching...
No Matches
SAC-file format

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).

Floating-point (39)

32-bit (1 word, 4 bytes)

depmin

Pre-data word 001.

Minimum value of the dependent variable (displacement/velocity/acceleration/volts/counts).

depmen

Pre-data word 057.

Mean value of the dependent variable.

depmax

Pre-data word 002.

Maximum value of the dependent variable.

odelta

Pre-data word 004.

Modified (observational) value of delta.

resp(0–9)

Pre-data words 021–030.

Instrument response parameters (poles, zeros, and a constant).

Not used by SAC they're free for other purposes.

stel

Pre-data word 033.

Station elevation in meters above sea level (m.a.s.l).

Not used by SAC free for other purposes.

stdp

Pre-data word 034.

Station depth in meters below surface (borehole/buried vault).

Not used by SAC free for other purposes.

evel

Pre-data word 037.

Event elevation m.a.s.l.

Not used by SAC free for other purposes.

evdp

Pre-data word 038.

Event depth in kilometers (previously meters) below surface.

mag

Pre-data word 039.

Event magnitude.

user(0–9)

Pre-data words 040–049.

Storage for user-defined values.

dist

Pre-data word 050.

Station-Event distance in kilometers.

az

Pre-data word 051.

Azimuth $\color{orange}\mathrm{\left(Event \to Station\right)}$, decimal degrees from North.

baz

Pre-data word 052.

Back-azimuth $\color{orange}\mathrm{\left(Station \to Event\right)}$, decimal degrees from North.

gcarc

Pre-data word 053.

Station-Event great circle arc-length, decimal degrees.

cmpaz

Pre-data word 057.

Instrument measurement azimuth, decimal degrees from North.

ValueDirection
North
90°East
180°South
270°West
Other1/2/3

cmpinc

Pre-data word 058.

Instrument measurement incident angle, decimal degrees from upward vertical (incident 0° = dip -90°).

ValueDirection
Up
90°Horizontal
180°Down
270°Horizontal

NOTE: SEED/MINISEED use dip angle, decimal degrees down from horizontal (dip 0° = incident 90°).

xminimum

Pre-data word 059.

Spectral-only equivalent of depmin ( $\color{orange}f_{0}$ or $\color{orange}\omega_{0}$).

xmaximum

Pre-data word 060.

Spectral-only equivalent of depmax ( $\color{orange}f_{max}$ or $\color{orange}\omega_{max}$).

yminimum

Pre-data word 061.

Spectral-only equivalent of b.

ymaximum

Pre-data word 062.

Spectral-only equivalent of e.

Double (22)

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.

delta

Pre-data word 000, post-data words 00-01.

Increment between evenly spaced samples ( $\color{orange}\Delta t$ for timeseries, $\color{orange}\Delta f$ or $\color{orange}\Delta\omega$ for spectra).

b

Pre-data word 005, post-data words 02-03.

First value (begin) of independent variable ( $\color{orange}t_{0}$).

e

Pre-data word 006, post-data words 04-05.

Final value (end) of independent variable ( $\color{orange}t_{max}$).

o

Pre-data word 007, post-data words 06-07.

Event origin time, in seconds relative to the reference time.

a

Pre-data word 008, post-data words 08-09.

Event first arrival time, in seconds relative to the reference time.

t(0–9)

Pre-data words 010–019, post-data words 10–29.

User defined time values, in seconds relative to the reference time.

f

Pre-data word 020, post-data words 30-31.

Event end (fini) time, in seconds relative to the reference time.

stla

Pre-data word 031, post-data words 36-37.

Station latitude in decimal degrees, N/S - positive/negative.

sac-format automatically enforces $\color{orange}\mathrm{stla}\in[-90, 90]$.

stlo

Pre-data word 032, post-data words 38-39.

Station longitude in decimal degrees, E/W - positive/negative.

sac-format automatically enforces $\color{orange}\mathrm{stlo}\in[-180,
180]$.

evla

Pre-data word 035, post-data words 32-33.

Event latitude in decimal degrees, N/S - positive/negative.

sac-format automatically enforces $\color{orange}\mathrm{evla}\in[-90, 90]$.

evlo

Pre-data word 036, post-data words 34-35.

Event longitude in decimal degrees, E/W - positive/negative.

sac-format automatically enforces $\color{orange}\mathrm{evlo}\in[-180,
180]$.

sb

Pre-data word 054, post-data words 40-41.

Original (saved) b value.

sdelta

Pre-data word 055, post-data words 42-43.

Original (saved) delta value.

Integer (26)

32-bit (1 word, 4 bytes)

nzyear

Pre-data word 070.

Reference time GMT year.

nzjday

Pre-data word 071.

Reference time GMT day-of-year (often called Julian Date) (1–366).

nzhour

Pre-data word 072.

Reference time GMT hour (0–23).

nzmin

Pre-data word 073.

Reference time GMT minute (0–59).

nzsec

Pre-data word 074.

Reference time GMT second (0–59).

nzmsec

Pre-data word 075.

Reference time GMT Millisecond (0–999).

nvhdr

Pre-data word 076.

SAC-file version.

VersionDescription
v7Footer (2020+, sac 102.0+)
v6No footer (pre-2020, sac 101.6a-)

norid

Pre-data word 077.

Origin ID.

nevid

Pre-data word 078.

Event ID.

npts

Pre-data word 079.

Number of points in data.

nsnpts

Pre-data word 080.

Original (saved) npts.

nwfid

Pre-data word 081.

Waveform ID.

nxsize

Pre-data word 082.

Spectral-only equivalent of npts (length of spectrum).

nysize

Pre-data word 083.

Spectral-only, width of spectrum.

iftype

Pre-data word 085.

File type.

ValueTypeDescription
01ITIMETime-series
02IRLIMSpectral (real/imaginary)
03IAMPHSpectral (amplitude/phase)
04IXYGeneral XY file
??IXYZ∗General XYZ file

∗Value not listed in the standard.

idep

Pre-data word 086.

Dependent variable type.

ValueTypeDescription
05IUNKNUnknown
06IDISPDisplacement (nm)
07IVELVelocity $\color{orange}\mathrm{\left(\frac{nm}{s}\right)}$
08IACCAcceleration $\color{orange}\mathrm{\left(\frac{nm}{s^{2}}\right)}$
50IVOLTSVelocity (volts)

iztype

Pre-data word 087.

Reference time equivalent.

ValueTypeDescription
05IUNKNUnknown
09IBRecording start time
10IDAYMidnight reference GMT day
11IOEvent origin time
12IAFirst arrival time
13-22IT(0-9)User defined time (t) pick

iinst

Pre-data word 089.

Recording instrument type.

Not used by SAC: free for other purposes.

istreg

Pre-data word 090.

Station geographic region.

Not used by SAC: free for other purposes.

ievreg

Pre-data word 091.

Event geographic region.

Not used by SAC: free for other purposes.

ievtyp

Pre-data word 092.

Event type.

ValueTypeDescription
05IUNKNUnknown
11IOOther source of known origin
37INUCLNuclear
38IPRENNuclear pre-shot
39IPOSTNNuclear post-shot
40IQUAKEEarthquake
41IPREQForeshock
42IPOSTQAftershock
43ICHEMChemical explosion
44IOTHEROther
72IQBQuarry/mine blast: confirmed by quarry/mine
73IQB1Quarry/mine blast: designed shot info-ripple fired
74IQB2Quarry/mine blast: observed shot info-ripple fired
75IQBXQuarry/mine blast: single shot
76IQMTQuarry/mining induced events: tremor and rockbursts
77IEQEarthquake
78IEQ1Earthquake in a swarm or in an aftershock sequence
79IEQ2Felt earthquake
80IMEMarine explosion
81IEXOther explosion
82INUNuclear explosion
83INCNuclear cavity collapse
85ILLocal event of unknown origin
86IRRegion event of unknown origin
87ITTeleseismic event of unknown origin
88IUUndetermined/conflicting information

iqual

Pre-data word 093.

Quality of data.

ValueTypeDescription
44IOTHEROther
45IGOODGood
46IGLCHGlitches
47IDROPDropouts
48ILOWSNLow signal-to-noise ratio

Not used by SAC: free for other purposes.

isynth

Pre-data word 094.

Synthetic data flag.

ValueTypeDescription
49IRLDATAReal data
XXSynthetic

∗Values and types not listed in the standard.

imagtyp

Pre-data word 095.

Magnitude type.

ValueTypeDescription
52IMBBody-wave magnitude ( $\color{orange}M_{b}$)
53IMSSurface-wave magnitude ( $\color{orange}M_{s}$)
54IMLLocal magnitude ( $\color{orange}M_{l}$)
55IMWMoment magnitude ( $\color{orange}M_{w}$)
56IMDDuration magnitude ( $\color{orange}M_{d}$)
57IMXUser-defined magnitude ( $\color{orange}M_{x}$)

imagsrc

Pre-data word 096.

Source of magnitude information.

ValueTypeDescription
58INEICNational Earthquake Information Center
61IPDEPreliminary Determination of Epicenter
62IISCInternation Seismological Centre
63IREBReviewed Event Bulletin
64IUSGSU.S. Geological Survey
65IBRKUC Berkeley
66ICALTECHCalifornia Institute of Technology
67ILLNLLawrence Livermore National Laboratory
68IEVLOCEvent location (computer program)
69IJSOPJoint Seismic Observation Program
70IUSERThe user
71IUNKNOWNUnknown

ibody

Pre-data word 097.

Body/spheroid definition used to calculate distances.

ValueTypeNameSemi-major axis (a [m])Inverse Flattening (f)
-12345UNDEFEarth (Historic)6378160.00.00335293
98ISUNSun696000000.08.189e-6
99IMERCURYMercury2439700.00.0
100IVENUSVenus6051800.00.0
101IEARTHEarth (WGS84)6378137.00.0033528106647474805
102IMOONMoon1737400.00.0
103IMARSMars3396190.00.005886007555525457

Boolean (4)

Pre-data word 105.

32-bit (1 word, 4 bytes) in-file/8-bit (1 byte) in-memory

leven

Pre-data word 106.

REQUIRED Evenly-spaced data flag.

If true, then data is evenly spaced.

lpspol

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]).

lovrok

Pre-data word 108.

File overwrite flag.

If true, then it's okay to overwrite the file.

lcalda

Pre-data word 109.

Calculate geometry flag.

If true, then calculate dist, az, baz, and gcarc from stla, stlo, evla, and evlo.

String (23)

32/64-bit (2/4 words, 8/16 bytes, 8/16 characters)

kstnm

Pre-data words 110–111.

Station name.

kevnm

Pre-data words 112–115.

Event name.

∗This is the only four word (16 character) string.

khole

Pre-data words 116–117.

Nuclear: Hole identifier.

Other: Location identifier (LOCID).

ko

Pre-data words 118–119.

Text for o.

ka

Pre-data words 120–121.

Text for a.

kt(0–9)

Pre-data words 112–141.

Text for t(0--9).

kf

Pre-data words 142–143.

Text for f.

kuser(0–2)

Pre-data words 144–149.

Text for the first three of user(0--9).

kcmpnm

Pre-data words 150–151.

Component name.

knetwk

Pre-data words 152–153.

Network name.

kdatrd

Pre-data words 154–155.

Date the data was read onto a computer.

kinst

Pre-data words 156–157.

Text for iinst.

Data (2)

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.

data1

Words 158–(158 + npts)

The first data vector—**always** present in a SAC-file and begins at word 158.

data2

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.