Package llnl.gnem.core.io.SAC
Class SACHeader
java.lang.Object
llnl.gnem.core.io.SAC.SACHeader
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
Modifier and TypeFieldDescriptionfloat
float
float
float
float
float
float
float
float
float
float
float
float
float
float
float
float
static final float
float
float
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
int
static final int
int
static final int
static final int
static final int
static final int
int
static final int
static final int
static final int
static final int
static final int
static final int
int
int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
String[]
int
int
int
int
float
int
int
int
int
int
int
int
int
int
int
int
int
int
int
float
float
float[]
float
float
float
float
float
float
float
static final String
float[]
float
float
float
int
int
int
int
int
int
int
int
int
int
int
float
float
float
float
float[]
float
float
float
float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
chAllt
(float value) reproduces the ch allt modifications to the time variablesvoid
changeHeader
(String type, String value) Equivalent to the ch command in SACvoid
changeTimePick
(String type, String value) Equivalent to the ch command in SAC Checking two possibilities here 1.) generic: e.g.boolean
void
Clear all designated time picks and their identifiers resets to default the values: t[0-10], kt[0-10], tf and kfvoid
close()
int
method to replace an undefined evid with a unique number based on the origin or reference timeGet the begin Epoch time as a TimeT objectGet the end Epoch time as a TimeT objectfloat
getItype
(int itype) Get the origin Epoch time as a TimeT objectConvert the date header fields into a TimeT object Note: if the nzyear...Object[]
getTimePick
(int index) A simple method for retrieving pick times and namesfloat
getTimePick
(String phase) Look for a specific pick Note both kt[] and t[] must be defined for this to return successfully e.g.Collect all the Time Picks as a Vector of Strings pickstring = "Pn 452.2" To extract the result use StringTokenizer;Make a treemap of all the defined variablesstatic boolean
isDefault
(float variable) static boolean
isDefault
(int variable) static boolean
listHeader
(String type) Equivalent to the lh command in SACstatic String
void
Calculate the source-receiver azimuth and backazimuth if they aren't calculated alreadyvoid
setBeginTime
(TimeT begintime) b is defined by the start of the seismogram relative to the reference time (nzyear, ...,nzmsec) NOTE the reference time should be already be definedvoid
Calculate the source-receiver distance if it isn't calculated alreadyvoid
setEventLocation
(float evla, float evlo, float evel, float evdp) int
void
void
setOriginTime
(TimeT origintime) Set the origin time relative to the sac file's reference timevoid
setStationLocation
(float stla, float stlo, float stel, float stdp) void
Set the nz(date) fields based on a TimeT objectvoid
setTimePick
(int index, float value, String pickname) A simple method for defining pick times and namesvoid
setVariableMap
(TreeMap<String, Object> variablemap) assign variables based on a treemapvoid
validate()
Certain variables are interrelated - make sure that any changes are applied to eachvoid
write
(DataOutput outputStream) void
write
(RandomAccessFile sacout) Write the header at the start of a RandomAccessFile Note the sacout.length() at the conclusion will be 158*4 = 632.
-
Field Details
-
a
public float a -
az
public float az -
b
public float b -
baz
public float baz -
cmpaz
public float cmpaz -
cmpinc
public float cmpinc -
delta
public float delta -
depmax
public float depmax -
depmen
public float depmen -
depmin
public float depmin -
dist
public float dist -
e
public float e -
evdp
public float evdp -
evel
public float evel -
evla
public float evla -
evlo
public float evlo -
f
public float f -
fmt
public float fmt -
gcarc
public float gcarc -
idep
public int idep -
ievreg
public int ievreg -
ievtyp
public int ievtyp -
iftype
public int iftype -
iinst
public int iinst -
imagsrc
public int imagsrc -
imagtyp
public int imagtyp -
instreg
public int instreg -
iqual
public int iqual -
isynth
public int isynth -
ka
-
kcmpnm
-
kdatrd
-
kevnm
-
kf
-
khole
-
kinst
-
knetwk
-
ko
-
kstnm
-
kt
-
kuser0
-
kuser1
-
kuser2
-
lcalda
public int lcalda -
leven
public int leven -
lovrok
public int lovrok -
lpspol
public int lpspol -
mag
public float mag -
nevid
public int nevid -
norid
public int norid -
npts
public int npts -
nsnpts
public int nsnpts -
nvhdr
public int nvhdr -
nwfid
public int nwfid -
nxsize
public int nxsize -
nysize
public int nysize -
nzhour
public int nzhour -
nzjday
public int nzjday -
nzmin
public int nzmin -
nzmsec
public int nzmsec -
nzsec
public int nzsec -
nzyear
public int nzyear -
o
public float o -
odelta
public float odelta -
resp
public float[] resp -
sb
public float sb -
scale
public float scale -
sdelta
public float sdelta -
stdp
public float stdp -
stel
public float stel -
stla
public float stla -
stlo
public float stlo -
t
public float[] t -
unused10
public float unused10 -
unused11
public float unused11 -
unused12
public float unused12 -
unused15
public int unused15 -
unused16
public int unused16 -
unused19
public int unused19 -
unused20
public int unused20 -
unused21
public int unused21 -
unused22
public int unused22 -
unused23
public int unused23 -
unused24
public int unused24 -
unused25
public int unused25 -
unused26
public int unused26 -
unused27
public int unused27 -
unused6
public float unused6 -
unused7
public float unused7 -
unused8
public float unused8 -
unused9
public float unused9 -
user
public float[] user -
xmaximum
public float xmaximum -
xminimum
public float xminimum -
ymaximum
public float ymaximum -
yminimum
public float yminimum -
FLOATDEFAULT
public static final float FLOATDEFAULT- See Also:
-
INTDEFAULT
public static final int INTDEFAULT- See Also:
-
STRINGDEFAULT
- See Also:
-
ia
public static final int ia- See Also:
-
iacc
public static final int iacc- See Also:
-
iamph
public static final int iamph- See Also:
-
ib
public static final int ib- See Also:
-
ibrk
public static final int ibrk- See Also:
-
icaltech
public static final int icaltech- See Also:
-
ichem
public static final int ichem- See Also:
-
iday
public static final int iday- See Also:
-
idisp
public static final int idisp- See Also:
-
idown
public static final int idown- See Also:
-
idrop
public static final int idrop- See Also:
-
ieast
public static final int ieast- See Also:
-
ieq
public static final int ieq- See Also:
-
ieq1
public static final int ieq1- See Also:
-
ieq2
public static final int ieq2- See Also:
-
ievloc
public static final int ievloc- See Also:
-
iex
public static final int iex- See Also:
-
iglch
public static final int iglch- See Also:
-
igood
public static final int igood- See Also:
-
ihglp
public static final int ihglp- See Also:
-
ihorza
public static final int ihorza- See Also:
-
iisc
public static final int iisc- See Also:
-
ijsop
public static final int ijsop- See Also:
-
il
public static final int il- See Also:
-
illlbb
public static final int illlbb- See Also:
-
illnl
public static final int illnl- See Also:
-
ilowsn
public static final int ilowsn- See Also:
-
imb
public static final int imb- See Also:
-
imd
public static final int imd- See Also:
-
ime
public static final int ime- See Also:
-
iml
public static final int iml- See Also:
-
ims
public static final int ims- See Also:
-
imw
public static final int imw- See Also:
-
imx
public static final int imx- See Also:
-
inc
public static final int inc- See Also:
-
ineic
public static final int ineic- See Also:
-
inorth
public static final int inorth- See Also:
-
inu
public static final int inu- See Also:
-
inucl
public static final int inucl- See Also:
-
io
public static final int io- See Also:
-
io_
public static final int io_- See Also:
-
iother
public static final int iother- See Also:
-
ipde
public static final int ipde- See Also:
-
ipostn
public static final int ipostn- See Also:
-
ipostq
public static final int ipostq- See Also:
-
ipren
public static final int ipren- See Also:
-
ipreq
public static final int ipreq- See Also:
-
iqb
public static final int iqb- See Also:
-
iqb1
public static final int iqb1- See Also:
-
iqb2
public static final int iqb2- See Also:
-
iqbx
public static final int iqbx- See Also:
-
iqmt
public static final int iqmt- See Also:
-
iquake
public static final int iquake- See Also:
-
ir
public static final int ir- See Also:
-
iradev
public static final int iradev- See Also:
-
iradnv
public static final int iradnv- See Also:
-
ireb
public static final int ireb- See Also:
-
irldta
public static final int irldta- See Also:
-
irlim
public static final int irlim- See Also:
-
isro
public static final int isro- See Also:
-
it
public static final int it- See Also:
-
it0
public static final int it0- See Also:
-
it1
public static final int it1- See Also:
-
it2
public static final int it2- See Also:
-
it3
public static final int it3- See Also:
-
it4
public static final int it4- See Also:
-
it5
public static final int it5- See Also:
-
it6
public static final int it6- See Also:
-
it7
public static final int it7- See Also:
-
it8
public static final int it8- See Also:
-
it9
public static final int it9- See Also:
-
itanev
public static final int itanev- See Also:
-
itannv
public static final int itannv- See Also:
-
itime
public static final int itime- See Also:
-
iu
public static final int iu- See Also:
-
iunkn
public static final int iunkn- See Also:
-
iunknown
public static final int iunknown- See Also:
-
iup
public static final int iup- See Also:
-
iuser
public static final int iuser- See Also:
-
iusgs
public static final int iusgs- See Also:
-
ivel
public static final int ivel- See Also:
-
ivolts
public static final int ivolts- See Also:
-
iwwsn1
public static final int iwwsn1- See Also:
-
iwwsn2
public static final int iwwsn2- See Also:
-
ixy
public static final int ixy- See Also:
-
ixyz
public static final int ixyz- See Also:
-
-
Constructor Details
-
SACHeader
public SACHeader() -
SACHeader
- Throws:
IOException
-
SACHeader
- Throws:
IOException
-
SACHeader
- Throws:
IOException
-
SACHeader
- Throws:
IOException
-
-
Method Details
-
isDefault
public static boolean isDefault(int variable) -
isDefault
public static boolean isDefault(float variable) -
isDefault
-
padTo
-
chAllt
public void chAllt(float value) reproduces the ch allt modifications to the time variables- Parameters:
value
- - the added time in seconds
-
changeHeader
Equivalent to the ch command in SAC- Parameters:
type
- : the header variable namevalue
- : a String version of the value being assigned to the header
-
changeTimePick
Equivalent to the ch command in SAC Checking two possibilities here 1.) generic: e.g. 'ch t0 100 ' will change the "t0" header to 100 2.) specific:e.g. 'ch Lg 100 ' will change all picks labelled "Lg" to 100- Parameters:
type
- : the time pick header variable namevalue
- : a String version of the float value being assigned to the header
-
checkByteSwap
public boolean checkByteSwap() -
clearTimePicks
public void clearTimePicks()Clear all designated time picks and their identifiers resets to default the values: t[0-10], kt[0-10], tf and kf -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
createEvid
public int createEvid()method to replace an undefined evid with a unique number based on the origin or reference time- Returns:
- the nevid value
-
getBeginTime
Get the begin Epoch time as a TimeT object -
getEndTime
Get the end Epoch time as a TimeT object -
getEventCoordinates
- Throws:
Exception
-
getFloatDefault
public float getFloatDefault() -
getItype
-
getIztype
-
getOriginTime
Get the origin Epoch time as a TimeT object -
getReferenceTime
Convert the date header fields into a TimeT object Note: if the nzyear... variables are not set - return null -
getStationCoordinates
- Throws:
Exception
-
getTimePick
A simple method for retrieving pick times and names- Parameters:
index
- Object[] timepick = sfh.getTimePick(0); Float value = (Float) timepick[0]; String pickname = (String) timepick[1];
-
getTimePick
Look for a specific pick Note both kt[] and t[] must be defined for this to return successfully e.g. float time = getTimePick("Pn");- Parameters:
phase
- the name of the phase searched for - kt[ii] must be the same - including capitalization- Returns:
- the pick time value, or the default value
-
getTimePicks
Collect all the Time Picks as a Vector of Strings pickstring = "Pn 452.2" To extract the result use StringTokenizer; -
getVariableMap
Make a treemap of all the defined variables- Returns:
- a treemap of defined variables
-
listHeader
Equivalent to the lh command in SAC- Parameters:
type
- : the header variable name- Returns:
- result: a String version of the value being assigned to the header
-
setAzimuths
public void setAzimuths()Calculate the source-receiver azimuth and backazimuth if they aren't calculated already -
setBeginTime
b is defined by the start of the seismogram relative to the reference time (nzyear, ...,nzmsec) NOTE the reference time should be already be defined -
setDistances
public void setDistances()Calculate the source-receiver distance if it isn't calculated already -
setEventLocation
public void setEventLocation(float evla, float evlo, float evel, float evdp) -
setItype
-
setIztype
-
setOriginTime
Set the origin time relative to the sac file's reference time- Parameters:
origintime
- - a TimeT version of the event
-
setStationLocation
public void setStationLocation(float stla, float stlo, float stel, float stdp) -
setTime
Set the nz(date) fields based on a TimeT object- Parameters:
timet
- : The time as a TimeT object
-
setTimePick
A simple method for defining pick times and names- Parameters:
index
-value
-pickname
-
-
setVariableMap
assign variables based on a treemap- Parameters:
variablemap
- contains all the variables that are not default valued
-
validate
public void validate()Certain variables are interrelated - make sure that any changes are applied to each -
write
Write the header at the start of a RandomAccessFile Note the sacout.length() at the conclusion will be 158*4 = 632. Data is written starting at sacout.seek(632)- Parameters:
sacout
-
-
write
-