Bases: object
Class for SAC file IO.
Functions are given below, attributes/header fields (described below) can be directly accessed (via the __getattr__() method, see the link for an example).
Field Name | Type | Description |
---|---|---|
npts | N | Number of points per data component. [required] |
nvhdr | N | Header version number. Current value is the integer 6. Older version data (NVHDR < 6) are automatically updated when read into sac. [required] |
b | F | Beginning value of the independent variable. [required] |
e | F | Ending value of the independent variable. [required] |
iftype | I |
|
leven | L | TRUE if data is evenly spaced. [required] |
delta | F | Increment between evenly spaced samples (nominal value). [required] |
odelta | F | Observed increment if different from nominal value. |
idep | I |
|
scale | F | Multiplying scale factor for dependent variable [not currently used] |
depmin | F | Minimum value of dependent variable. |
depmax | F | Maximum value of dependent variable. |
depmen | F | Mean value of dependent variable. |
nzyear | N | GMT year corresponding to reference (zero) time in file. |
nyjday | N | GMT julian day. |
nyhour | N | GMT hour. |
nzmin | N | GMT minute. |
nzsec | N | GMT second. |
nzmsec | N | GMT millisecond. |
iztype | I |
|
o | F | Event origin time (seconds relative to reference time.) |
a | F | First arrival time (seconds relative to reference time.) |
ka | K | First arrival time identification. |
f | F | Fini or end of event time (seconds relative to reference time.) |
tn | F | User defined time {ai n}=0,9 (seconds picks or markers relative to reference time). |
kt{ai n} | K | A User defined time {ai n}=0,9. pick identifications |
kinst | K | Generic name of recording instrument |
iinst | I | Type of recording instrument. [currently not used] |
knetwk | K | Name of seismic network. |
kstnm | K | Station name. |
istreg | I | Station geographic region. [not currently used] |
stla | F | Station latitude (degrees, north positive) |
stlo | F | Station longitude (degrees, east positive). |
stel | F | Station elevation (meters). [not currently used] |
stdp | F | Station depth below surface (meters). [not currently used] |
cmpaz | F | Component azimuth (degrees, clockwise from north). |
cmpinc | F | Component incident angle (degrees, from vertical). |
kcmpnm | K | Component name. |
lpspol | L | TRUE if station components have a positive polarity (left-hand rule). |
kevnm | K | Event name. |
ievreg | I | Event geographic region. [not currently used] |
evla | F | Event latitude (degrees north positive). |
evlo | F | Event longitude (degrees east positive). |
evel | F | Event elevation (meters). [not currently used] |
evdp | F | Event depth below surface (meters). [not currently used] |
mag | F | Event magnitude. |
imagtyp | I |
|
imagsrc | I |
|
ievtyp | I |
|
nevid | N | Event ID (CSS 3.0) |
norid | N | Origin ID (CSS 3.0) |
nwfid | N | Waveform ID (CSS 3.0) |
khole | k | Hole identification if nuclear event. |
dist | F | Station to event distance (km). |
az | F | Event to station azimuth (degrees). |
baz | F | Station to event azimuth (degrees). |
gcarc | F | Station to event great circle arc length (degrees). |
lcalda | L | TRUE if DIST AZ BAZ and GCARC are to be calculated from st event coordinates. |
iqual | I |
|
isynth | I |
|
user{ai n} | F | User defined variable storage area {ai n}=0,9. |
kuser{ai n} | K | User defined variable storage area {ai n}=0,2. |
lovrok | L | TRUE if it is okay to overwrite this file on disk. |
Attributes
__dict__ | |
__doc__ | str(object=’‘) -> string |
__module__ | str(object=’‘) -> string |
__weakref__ | list of weak references to the object (if defined) |
Public Methods
GetHvalue | Read SAC-header variable. |
GetHvalueFromFile | Quick access to a specific header item in specified file. |
InitArrays | Function to initialize the floating, character and integer header arrays (self.hf, self.hs, self.hi) with dummy values. |
IsSACfile | Test for a valid SAC file using arrays. |
IsValidSacFile | Quick test for a valid SAC binary file (wraps ‘IsSACfile’). |
IsValidXYSacFile | Quick test for a valid SAC ascii file. |
ListStdValues | Convenience function for printing common header values. |
PrintFValue | Convenience function for printing undefined float header values. |
PrintIValue | Convenience function for printing undefined integer header values. |
PrintSValue | Convenience function for printing undefined string header values. |
ReadSacFile | Read read in the header and data in a SAC file |
ReadSacHeader | Reads only the header portion of a binary SAC-file. |
ReadSacXY | Read SAC XY files (ascii) |
ReadSacXYHeader | Read SAC XY files (ascii) |
SetHvalue | Assign new value to SAC-header variable. |
SetHvalueInFile | Quick access to change a specific header item in a specified file. |
WriteSacBinary | Write a SAC binary file using the head arrays and array seis. |
WriteSacHeader | Writes an updated header to an |
WriteSacXY | Write SAC XY file (ascii) |
fromarray | Create a SAC file from an numpy.ndarray instance |
get_obspy_header | Return a dictionary that can be used as a header in creating a new |
readTrace | Fill in SacIO object with data from obspy trace. |
swap_byte_order | Swap byte order of SAC-file in memory. |
Private Methods
_chck_header | If trace changed since read, adapt header values |
_get_date | If date header values are set calculate date in julian seconds |
_get_dist | calculate distance from station and event coordinates |
Special Methods
__getattr__ | convenience function to access header values |
__init__ |