Class SacTimeSeries


  • public class SacTimeSeries
    extends java.lang.Object
    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 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
        Setting of all other headers is the responsibility of the caller.
        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)
      • 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 found
        java.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.FileNotFoundException
        java.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.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:
        java.io.IOException
      • skipSamples

        public static int skipSamples​(java.io.DataInput dataIn,
                                      int samplesToSkip)
                               throws java.io.IOException
        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:
        java.io.IOException
      • write

        public void write​(java.lang.String filename)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
        writes this object out as a sac file.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • write

        public void write​(java.io.File file)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
        writes this object out as a sac file.
        Throws:
        java.io.FileNotFoundException
        java.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