Package edu.sc.seis.seisFile.sac
Class SacTimeSeries
- java.lang.Object
-
- edu.sc.seis.seisFile.sac.SacTimeSeries
-
public class SacTimeSeries extends java.lang.ObjectClass 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
Constructors Constructor Description SacTimeSeries(SacHeader header)SacTimeSeries(SacHeader header, float[] data)create a new SAC timeseries from the given header and data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidappendData(java.io.File outfile, float[] data)float[]getAmp()SacHeadergetHeader()float[]getImaginary()intgetNumPtsRead()float[]getPhase()float[]getReal()float[]getX()float[]getY()voidprintHeader(java.io.PrintWriter out)static SacTimeSeriesread(java.io.DataInput dis)static SacTimeSeriesread(java.io.File sacFile)static SacTimeSeriesread(java.lang.String filename)reads the sac file specified by the filename.protected static SacTimeSeriesreadData(SacHeader header, java.io.DataInput fis)read the data portion of the given Filestatic voidreadSomeData(java.io.DataInput dataIn, float[] data, boolean byteOrder)reads data.length floats.voidsetAmp(float[] amp)voidsetImaginary(float[] imaginary)voidsetPhase(float[] phase)voidsetReal(float[] real)voidsetX(float[] x)voidsetY(float[] y)static intskipSamples(java.io.DataInput dataIn, int samplesToSkip)skips samplesToSkip data points.voidwrite(java.io.File file)writes this object out as a sac file.voidwrite(java.lang.String filename)writes this object out as a sac file.voidwriteData(java.io.DataOutput dos)
-
-
-
Constructor Detail
-
SacTimeSeries
public SacTimeSeries(SacHeader header)
-
SacTimeSeries
public SacTimeSeries(SacHeader header, float[] data)
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 Detail
-
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
public SacHeader getHeader()
-
printHeader
public void printHeader(java.io.PrintWriter out)
-
getNumPtsRead
public int getNumPtsRead()
-
read
public static SacTimeSeries read(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
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:
java.io.FileNotFoundException- if the file cannot be foundjava.io.IOException- if it isn't a sac file or if it happens :)
-
read
public static SacTimeSeries read(java.io.File sacFile) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
read
public static SacTimeSeries read(java.io.DataInput dis) throws java.io.IOException
- Throws:
java.io.IOException
-
readData
protected static SacTimeSeries readData(SacHeader header, java.io.DataInput fis) throws java.io.IOException
read the data portion of the given File- Throws:
java.io.IOException
-
readSomeData
public static void readSomeData(java.io.DataInput dataIn, float[] data, boolean byteOrder) throws java.io.IOExceptionreads 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:
java.io.IOException
-
skipSamples
public static int skipSamples(java.io.DataInput dataIn, int samplesToSkip) throws java.io.IOExceptionskips 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:
java.io.IOException
-
write
public void write(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOExceptionwrites this object out as a sac file.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
write
public void write(java.io.File file) throws java.io.FileNotFoundException, java.io.IOExceptionwrites this object out as a sac file.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
writeData
public void writeData(java.io.DataOutput dos) throws java.io.IOException- Throws:
java.io.IOException
-
appendData
public static void appendData(java.io.File outfile, float[] data) throws java.io.IOException- Throws:
java.io.IOException
-
-