edu.sc.seis.TauP
Class SacTimeSeries

java.lang.Object
  extended byedu.sc.seis.TauP.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.

Version:
1.1 Wed Feb 2 20:40:49 GMT 2000
Author:
H. Philip Crotwell

Field Summary
 float a
           
 float[] amp
           
 float az
           
 float b
           
 float baz
           
 boolean byteOrder
           
 float cmpaz
           
 float cmpinc
           
static int data_offset
           
static java.text.DecimalFormat decimalFormat
           
 float delta
           
 float depmax
           
 float depmen
           
 float depmin
           
 float dist
           
 float e
           
 float evdp
           
 float evel
           
 float evla
           
 float evlo
           
 float f
           
static int FALSE
           
static float FLOAT_UNDEF
           
 float fmt
           
 float gcarc
           
static int IA
           
static int IACC
           
static int IAMPH
           
static int IB
           
static int ICHEM
           
static int IDAY
           
 int idep
           
static int IDISP
           
static int IDOWN
           
static int IDROP
           
static int IEAST
           
 int ievreg
           
 int ievtyp
           
 int iftype
           
static int IGLCH
           
static int IGOOD
           
static int IHGLP
           
static int IHORZA
           
 int iinst
           
static int ILLLBB
           
static int ILOWSN
           
 float[] imaginary
           
 int imagsrc
           
 int imagtyp
           
static int INIV51
           
static int INIV52
           
static int INIV53
           
static int INIV54
           
static int INIV55
           
static int INIV56
           
static int INIV57
           
static int INIV58
           
static int INIV59
           
static int INIV60
           
static int INORTH
           
static int INT_UNDEF
           
static boolean IntelByteOrder
           
static int INUCL
           
static int IO
           
static int IOTHER
           
static int IPOSTN
           
static int IPOSTQ
           
static int IPREN
           
static int IPREQ
           
static int IQUAKE
           
 int iqual
           
static int IRADEV
           
static int IRADNV
           
static int IREAL
           
static int IRLDTA
           
static int IRLIM
           
static int ISRO
           
 int istreg
           
 int isynth
           
static int IT0
           
static int IT1
           
static int IT2
           
static int IT3
           
static int IT4
           
static int IT5
           
static int IT6
           
static int IT7
           
static int IT8
           
static int IT9
           
static int ITANEV
           
static int ITANNV
           
static int ITIME
           
static int IUNKN
           
static int IUP
           
static int IVEL
           
static int IVOLTS
           
static int IWWSN1
           
static int IWWSN2
           
static int IXY
           
 int iztype
           
 java.lang.String ka
           
 java.lang.String kcmpnm
           
 java.lang.String kdatrd
           
 java.lang.String kevnm
           
 java.lang.String kf
           
 java.lang.String khole
           
 java.lang.String kinst
           
 java.lang.String knetwk
           
 java.lang.String ko
           
 java.lang.String kstnm
           
 java.lang.String kt0
           
 java.lang.String kt1
           
 java.lang.String kt2
           
 java.lang.String kt3
           
 java.lang.String kt4
           
 java.lang.String kt5
           
 java.lang.String kt6
           
 java.lang.String kt7
           
 java.lang.String kt8
           
 java.lang.String kt9
           
 java.lang.String kuser0
           
 java.lang.String kuser1
           
 java.lang.String kuser2
           
 int lcalda
           
 int leven
           
 int lovrok
           
 int lpspol
           
 float mag
           
 int nevid
           
 int norid
           
 int npts
           
 int nsnpts
           
 int nvhdr
           
 int nwfid
           
 int nxsize
           
 int nysize
           
 int nzhour
           
 int nzjday
           
 int nzmin
           
 int nzmsec
           
 int nzsec
           
 int nzyear
           
 float o
           
 float odelta
           
 float[] phase
           
 float[] real
           
 float resp0
           
 float resp1
           
 float resp2
           
 float resp3
           
 float resp4
           
 float resp5
           
 float resp6
           
 float resp7
           
 float resp8
           
 float resp9
           
 float sb
           
 float scale
           
 float sdelta
           
 float stdp
           
 float stel
           
 float stla
           
 float stlo
           
static java.lang.String STRING16_UNDEF
           
static java.lang.String STRING8_UNDEF
           
static boolean SunByteOrder
           
 float t0
           
 float t1
           
 float t2
           
 float t3
           
 float t4
           
 float t5
           
 float t6
           
 float t7
           
 float t8
           
 float t9
           
static int TRUE
           
 float unused10
           
 float unused11
           
 float unused12
           
 int unused15
           
 int unused16
           
 int unused19
           
 int unused20
           
 int unused21
           
 int unused22
           
 int unused23
           
 int unused24
           
 int unused25
           
 int unused26
           
 int unused27
           
 float unused6
           
 float unused7
           
 float unused8
           
 float unused9
           
 float user0
           
 float user1
           
 float user2
           
 float user3
           
 float user4
           
 float user5
           
 float user6
           
 float user7
           
 float user8
           
 float user9
           
 float[] x
           
 float xmaximum
           
 float xminimum
           
 float[] y
           
 float ymaximum
           
 float yminimum
           
 
Constructor Summary
SacTimeSeries()
           
 
Method Summary
static java.lang.String format(java.lang.String label, float f)
           
static java.lang.String formatLine(java.lang.String s1, float f1, java.lang.String s2, float f2, java.lang.String s3, float f3, java.lang.String s4, float f4, java.lang.String s5, float f5)
           
static void main(java.lang.String[] args)
          just for testing.
 void printHeader()
           
 void read(java.io.DataInputStream dis)
           
 void read(java.lang.String filename)
          reads the sac file specified by the filename.
 void readData(java.io.DataInputStream fis)
          read the data portion of the given File
protected  void readDataOld(java.io.DataInputStream dis)
          reads the data portion from the given stream.
 void readHeader(java.io.DataInputStream dis)
          reads the header from the given stream.
 void readHeader(java.lang.String filename)
          reads just the sac header specified by the filename.
static double swapBytes(double val)
           
static float swapBytes(float val)
           
static int swapBytes(int val)
           
static long swapBytes(long val)
           
static short swapBytes(short val)
           
protected  void swapHeader()
          Swaps the byte order of the header values.
 void write(java.io.File file)
          writes this object out as a sac file.
 void write(java.lang.String filename)
          writes this object out as a sac file.
 void writeData(java.io.DataOutputStream dos)
           
 void writeHeader(java.io.DataOutputStream dos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delta

public float delta

depmin

public float depmin

depmax

public float depmax

scale

public float scale

odelta

public float odelta

b

public float b

e

public float e

o

public float o

a

public float a

fmt

public float fmt

t0

public float t0

t1

public float t1

t2

public float t2

t3

public float t3

t4

public float t4

t5

public float t5

t6

public float t6

t7

public float t7

t8

public float t8

t9

public float t9

f

public float f

resp0

public float resp0

resp1

public float resp1

resp2

public float resp2

resp3

public float resp3

resp4

public float resp4

resp5

public float resp5

resp6

public float resp6

resp7

public float resp7

resp8

public float resp8

resp9

public float resp9

stla

public float stla

stlo

public float stlo

stel

public float stel

stdp

public float stdp

evla

public float evla

evlo

public float evlo

evel

public float evel

evdp

public float evdp

mag

public float mag

user0

public float user0

user1

public float user1

user2

public float user2

user3

public float user3

user4

public float user4

user5

public float user5

user6

public float user6

user7

public float user7

user8

public float user8

user9

public float user9

dist

public float dist

az

public float az

baz

public float baz

gcarc

public float gcarc

sb

public float sb

sdelta

public float sdelta

depmen

public float depmen

cmpaz

public float cmpaz

cmpinc

public float cmpinc

xminimum

public float xminimum

xmaximum

public float xmaximum

yminimum

public float yminimum

ymaximum

public float ymaximum

unused6

public float unused6

unused7

public float unused7

unused8

public float unused8

unused9

public float unused9

unused10

public float unused10

unused11

public float unused11

unused12

public float unused12

nzyear

public int nzyear

nzjday

public int nzjday

nzhour

public int nzhour

nzmin

public int nzmin

nzsec

public int nzsec

nzmsec

public int nzmsec

nvhdr

public int nvhdr

norid

public int norid

nevid

public int nevid

npts

public int npts

nsnpts

public int nsnpts

nwfid

public int nwfid

nxsize

public int nxsize

nysize

public int nysize

unused15

public int unused15

iftype

public int iftype

idep

public int idep

iztype

public int iztype

unused16

public int unused16

iinst

public int iinst

istreg

public int istreg

ievreg

public int ievreg

ievtyp

public int ievtyp

iqual

public int iqual

isynth

public int isynth

imagtyp

public int imagtyp

imagsrc

public int imagsrc

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

leven

public int leven

lpspol

public int lpspol

lovrok

public int lovrok

lcalda

public int lcalda

unused27

public int unused27

kstnm

public java.lang.String kstnm

kevnm

public java.lang.String kevnm

khole

public java.lang.String khole

ko

public java.lang.String ko

ka

public java.lang.String ka

kt0

public java.lang.String kt0

kt1

public java.lang.String kt1

kt2

public java.lang.String kt2

kt3

public java.lang.String kt3

kt4

public java.lang.String kt4

kt5

public java.lang.String kt5

kt6

public java.lang.String kt6

kt7

public java.lang.String kt7

kt8

public java.lang.String kt8

kt9

public java.lang.String kt9

kf

public java.lang.String kf

kuser0

public java.lang.String kuser0

kuser1

public java.lang.String kuser1

kuser2

public java.lang.String kuser2

kcmpnm

public java.lang.String kcmpnm

knetwk

public java.lang.String knetwk

kdatrd

public java.lang.String kdatrd

kinst

public java.lang.String kinst

y

public float[] y

x

public float[] x

real

public float[] real

imaginary

public float[] imaginary

amp

public float[] amp

phase

public float[] phase

FLOAT_UNDEF

public static float FLOAT_UNDEF

INT_UNDEF

public static int INT_UNDEF

STRING8_UNDEF

public static java.lang.String STRING8_UNDEF

STRING16_UNDEF

public static java.lang.String STRING16_UNDEF

TRUE

public static final int TRUE
See Also:
Constant Field Values

FALSE

public static final int FALSE
See Also:
Constant Field Values

IREAL

public static final int IREAL
See Also:
Constant Field Values

ITIME

public static final int ITIME
See Also:
Constant Field Values

IRLIM

public static final int IRLIM
See Also:
Constant Field Values

IAMPH

public static final int IAMPH
See Also:
Constant Field Values

IXY

public static final int IXY
See Also:
Constant Field Values

IUNKN

public static final int IUNKN
See Also:
Constant Field Values

IDISP

public static final int IDISP
See Also:
Constant Field Values

IVEL

public static final int IVEL
See Also:
Constant Field Values

IACC

public static final int IACC
See Also:
Constant Field Values

IB

public static final int IB
See Also:
Constant Field Values

IDAY

public static final int IDAY
See Also:
Constant Field Values

IO

public static final int IO
See Also:
Constant Field Values

IA

public static final int IA
See Also:
Constant Field Values

IT0

public static final int IT0
See Also:
Constant Field Values

IT1

public static final int IT1
See Also:
Constant Field Values

IT2

public static final int IT2
See Also:
Constant Field Values

IT3

public static final int IT3
See Also:
Constant Field Values

IT4

public static final int IT4
See Also:
Constant Field Values

IT5

public static final int IT5
See Also:
Constant Field Values

IT6

public static final int IT6
See Also:
Constant Field Values

IT7

public static final int IT7
See Also:
Constant Field Values

IT8

public static final int IT8
See Also:
Constant Field Values

IT9

public static final int IT9
See Also:
Constant Field Values

IRADNV

public static final int IRADNV
See Also:
Constant Field Values

ITANNV

public static final int ITANNV
See Also:
Constant Field Values

IRADEV

public static final int IRADEV
See Also:
Constant Field Values

ITANEV

public static final int ITANEV
See Also:
Constant Field Values

INORTH

public static final int INORTH
See Also:
Constant Field Values

IEAST

public static final int IEAST
See Also:
Constant Field Values

IHORZA

public static final int IHORZA
See Also:
Constant Field Values

IDOWN

public static final int IDOWN
See Also:
Constant Field Values

IUP

public static final int IUP
See Also:
Constant Field Values

ILLLBB

public static final int ILLLBB
See Also:
Constant Field Values

IWWSN1

public static final int IWWSN1
See Also:
Constant Field Values

IWWSN2

public static final int IWWSN2
See Also:
Constant Field Values

IHGLP

public static final int IHGLP
See Also:
Constant Field Values

ISRO

public static final int ISRO
See Also:
Constant Field Values

INUCL

public static final int INUCL
See Also:
Constant Field Values

IPREN

public static final int IPREN
See Also:
Constant Field Values

IPOSTN

public static final int IPOSTN
See Also:
Constant Field Values

IQUAKE

public static final int IQUAKE
See Also:
Constant Field Values

IPREQ

public static final int IPREQ
See Also:
Constant Field Values

IPOSTQ

public static final int IPOSTQ
See Also:
Constant Field Values

ICHEM

public static final int ICHEM
See Also:
Constant Field Values

IOTHER

public static final int IOTHER
See Also:
Constant Field Values

IGOOD

public static final int IGOOD
See Also:
Constant Field Values

IGLCH

public static final int IGLCH
See Also:
Constant Field Values

IDROP

public static final int IDROP
See Also:
Constant Field Values

ILOWSN

public static final int ILOWSN
See Also:
Constant Field Values

IRLDTA

public static final int IRLDTA
See Also:
Constant Field Values

IVOLTS

public static final int IVOLTS
See Also:
Constant Field Values

INIV51

public static final int INIV51
See Also:
Constant Field Values

INIV52

public static final int INIV52
See Also:
Constant Field Values

INIV53

public static final int INIV53
See Also:
Constant Field Values

INIV54

public static final int INIV54
See Also:
Constant Field Values

INIV55

public static final int INIV55
See Also:
Constant Field Values

INIV56

public static final int INIV56
See Also:
Constant Field Values

INIV57

public static final int INIV57
See Also:
Constant Field Values

INIV58

public static final int INIV58
See Also:
Constant Field Values

INIV59

public static final int INIV59
See Also:
Constant Field Values

INIV60

public static final int INIV60
See Also:
Constant Field Values

data_offset

public static final int data_offset
See Also:
Constant Field Values

byteOrder

public boolean byteOrder

SunByteOrder

public static final boolean SunByteOrder
See Also:
Constant Field Values

IntelByteOrder

public static final boolean IntelByteOrder
See Also:
Constant Field Values

decimalFormat

public static final java.text.DecimalFormat decimalFormat
Constructor Detail

SacTimeSeries

public SacTimeSeries()
Method Detail

read

public void 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 :)

swapBytes

public static final short swapBytes(short val)

swapBytes

public static final float swapBytes(float val)

swapBytes

public static final int swapBytes(int val)

swapBytes

public static final double swapBytes(double val)

swapBytes

public static final long swapBytes(long val)

read

public void read(java.io.DataInputStream dis)
          throws java.io.IOException
Throws:
java.io.IOException

readHeader

public void readHeader(java.lang.String filename)
                throws java.io.FileNotFoundException,
                       java.io.IOException
reads just the sac header specified by the filename. No checks are made to be sure the file really is a sac file.

Throws:
java.io.FileNotFoundException
java.io.IOException

swapHeader

protected void swapHeader()
Swaps the byte order of the header values.


readHeader

public void readHeader(java.io.DataInputStream dis)
                throws java.io.FileNotFoundException,
                       java.io.IOException
reads the header from the given stream.

Throws:
java.io.FileNotFoundException
java.io.IOException

readData

public void readData(java.io.DataInputStream fis)
              throws java.io.IOException
read the data portion of the given File

Throws:
java.io.IOException

readDataOld

protected void readDataOld(java.io.DataInputStream dis)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
reads the data portion from the given stream. Uses readFloat repeatedly resulting in MUCH slower read times than the slightly more confusing method above.

Throws:
java.io.FileNotFoundException
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

writeHeader

public void writeHeader(java.io.DataOutputStream dos)
                 throws java.io.IOException
Throws:
java.io.IOException

writeData

public void writeData(java.io.DataOutputStream dos)
               throws java.io.IOException
Throws:
java.io.IOException

format

public static java.lang.String format(java.lang.String label,
                                      float f)

formatLine

public static java.lang.String formatLine(java.lang.String s1,
                                          float f1,
                                          java.lang.String s2,
                                          float f2,
                                          java.lang.String s3,
                                          float f3,
                                          java.lang.String s4,
                                          float f4,
                                          java.lang.String s5,
                                          float f5)

printHeader

public void printHeader()

main

public static void main(java.lang.String[] args)
just for testing. Reads the filename given as the argument, writes out some header variables and then writes it back out as "outsacfile".



Copyright © 1999-2005 Seismology at the University of South Carolina. All Rights Reserved.