Package edu.sc.seis.seisFile.sac
Class SacTimeSeries
java.lang.Object
edu.sc.seis.seisFile.sac.SacTimeSeries
Class that represents a sac file. All headers are have the same names as
within the Sac program. Can read the whole file or just the header as well as
write a file.
This reflects the sac header as of version 101.4 in utils/sac.h
Notes: Key to comment flags describing each field: Column 1: R required by
SAC (blank) optional Column 2: A = settable from a priori knowledge D =
available in data F = available in or derivable from SEED fixed data header T
= available in SEED header tables (blank) = not directly available from SEED
data, header tables, or elsewhere
-
Constructor Summary
ConstructorsConstructorDescriptionSacTimeSeries
(SacHeader header) SacTimeSeries
(SacHeader header, float[] data) create a new SAC timeseries from the given header and data. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendData
(File outfile, float[] data) float[]
getAmp()
float[]
int
float[]
getPhase()
float[]
getReal()
Create source id from knetwk, kstnm, khole and kcmpnm header values.float[]
getX()
float[]
getY()
void
printHeader
(PrintWriter out) static SacTimeSeries
static SacTimeSeries
static SacTimeSeries
reads the sac file specified by the filename.protected static SacTimeSeries
read the data portion of the given Filestatic void
readSomeData
(DataInput dataIn, float[] data, boolean byteOrder) reads data.length floats.void
setAmp
(float[] amp) void
setImaginary
(float[] imaginary) void
setPhase
(float[] phase) void
setReal
(float[] real) void
setX
(float[] x) void
setY
(float[] y) static int
skipSamples
(DataInput dataIn, int samplesToSkip) skips samplesToSkip data points.void
writes this object out as a sac file.void
writes this object out as a sac file.void
writeData
(DataOutput dos)
-
Constructor Details
-
SacTimeSeries
-
SacTimeSeries
create a new SAC timeseries from the given header and data. The header values related to the data are set correctly:- npts=data.length
- e=b+(npts-1)*delta
- iftype=ITIME
- leven=TRUE
- Parameters:
header
-data
-
-
-
Method Details
-
getY
public float[] getY() -
setY
public void setY(float[] y) -
getX
public float[] getX() -
setX
public void setX(float[] x) -
getReal
public float[] getReal() -
setReal
public void setReal(float[] real) -
getImaginary
public float[] getImaginary() -
setImaginary
public void setImaginary(float[] imaginary) -
getAmp
public float[] getAmp() -
setAmp
public void setAmp(float[] amp) -
getPhase
public float[] getPhase() -
setPhase
public void setPhase(float[] phase) -
getHeader
-
getSourceId
Create source id from knetwk, kstnm, khole and kcmpnm header values.- Returns:
- Channel identifier as an FDSN SourceId.
- Throws:
FDSNSourceIdException
-
printHeader
-
getNumPtsRead
public int getNumPtsRead() -
read
reads the sac file specified by the filename. Only a very simple check is made to be sure the file really is a sac file.- Throws:
FileNotFoundException
- if the file cannot be foundIOException
- if it isn't a sac file or if it happens :)
-
read
- Throws:
FileNotFoundException
IOException
-
read
- Throws:
IOException
-
readData
read the data portion of the given File- Throws:
IOException
-
readSomeData
public static void readSomeData(DataInput dataIn, float[] data, boolean byteOrder) throws IOException reads data.length floats. It is up to the caller to insure that the type of SAC file (iftype = LEVEN, IRLIM, IAMPH) and how many data points remain are compatible with the size of the float array to be read.- Throws:
IOException
-
skipSamples
skips samplesToSkip data points. It is up to the caller to insure that the type of SAC file (iftype = LEVEN, IRLIM, IAMPH) and how many data points remain are compatible with the size of the float array to be read.- Throws:
IOException
-
write
writes this object out as a sac file.- Throws:
FileNotFoundException
IOException
-
write
writes this object out as a sac file.- Throws:
FileNotFoundException
IOException
-
writeData
- Throws:
IOException
-
appendData
- Throws:
IOException
-