edu.sc.seis.seisFile.earthworm
Class TraceBuf2

java.lang.Object
  extended by edu.sc.seis.seisFile.earthworm.TraceBuf2

public class TraceBuf2
extends java.lang.Object


Field Summary
static int AMPLIFIER_SATURATED
           
static int DIGITIZER_CLIPPED
           
static int FILTER_CHARGING
           
static int GLITCHES_DETECTED
           
static int HEADER_SIZE
           
static java.lang.String INTEL_IEEE_DOUBLE_PRECISION_REAL
           
static java.lang.String INTEL_IEEE_INTEGER
           
static java.lang.String INTEL_IEEE_SHORT_INTEGER
           
static java.lang.String INTEL_IEEE_SINGLE_PRECISION_REAL
           
static java.lang.String LOC_NULL_STRING
           
static int MAX_CHAN_LEN
           
static int MAX_LOC_LEN
           
static int MAX_NET_LEN
           
static int MAX_STA_LEN
           
static int MAX_TRACEBUF_SIZE
           
static int MISSING_DATA_PRESENT
           
static java.lang.String NORESS_GAIN_RANGED
           
static short S_ZERO
           
static int SPIKES_DETECTED
           
static java.lang.String SUN_IEEE_DOUBLE_PRECISION_REAL
           
static java.lang.String SUN_IEEE_INTEGER
           
static java.lang.String SUN_IEEE_SHORT_INTEGER
           
static java.lang.String SUN_IEEE_SINGLE_PRECISION_REAL
           
static int TELEMETRY_SYNCH_ERROR
           
static int TIME_TAG_QUESTIONABLE
           
static java.lang.String TRACEBUF_VERSION
           
 
Constructor Summary
protected TraceBuf2()
          for use by static read method.
  TraceBuf2(byte[] data)
           
  TraceBuf2(int pin, int numSamples, double startTime, double sampleRate, java.lang.String station, java.lang.String network, java.lang.String channel, java.lang.String locId, double[] data)
           
  TraceBuf2(int pin, int numSamples, double startTime, double sampleRate, java.lang.String station, java.lang.String network, java.lang.String channel, java.lang.String locId, float[] data)
           
  TraceBuf2(int pin, int numSamples, double startTime, double sampleRate, java.lang.String station, java.lang.String network, java.lang.String channel, java.lang.String locId, int[] intData)
           
  TraceBuf2(int pin, int numSamples, double startTime, double sampleRate, java.lang.String station, java.lang.String network, java.lang.String channel, java.lang.String locId, short[] data)
           
 
Method Summary
 edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1(int recLenExp)
          encodes the data as Steim1.
 edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1(int recLenExp, int offset)
          encodes the data starting at offset as Steim1.
static java.lang.String extractDataType(byte[] data)
           
static int extractNumSamples(byte[] data, boolean swapBytes)
           
 java.lang.String formatNSLCCodes()
           
 java.lang.String getChannel()
           
 java.lang.String getDataType()
           
 double[] getDoubleData()
           
 java.util.Date getEndDate()
           
 double getEndTime()
           
 float[] getFloatData()
           
 int[] getIntData()
           
 java.lang.String getLocId()
           
 java.lang.String getNetwork()
           
 int getNumSamples()
           
 short getPad()
           
 int getPin()
           
 java.util.Date getPredictedNextStartDate()
          Predicted start of the next tracebuf.
 double getPredictedNextStartTime()
          Predicted start of the next tracebuf in seconds.
 short getQuality()
           
 double getSampleRate()
           
static int getSampleSize(java.lang.String dataType)
           
 byte getSeedEncoding()
           
 short[] getShortData()
           
 int getSize()
           
 java.util.Date getStartDate()
           
 double getStartTime()
           
 java.lang.String getStation()
           
 java.lang.String getVersion()
           
 boolean isDoubleData()
           
static boolean isDoubleData(java.lang.String dataType)
           
 boolean isFloatData()
           
static boolean isFloatData(java.lang.String dataType)
           
 boolean isIntData()
           
static boolean isIntData(java.lang.String dataType)
           
 boolean isShortData()
           
static boolean isShortData(java.lang.String dataType)
           
static boolean isSwapBytes(java.lang.String dataType)
           
static TraceBuf2 read(java.io.DataInput in)
           
 java.util.List<TraceBuf2> split(int maxSize)
           
 byte[] toByteArray()
           
 java.util.List<DataRecord> toMiniSeed(int recLenExp, boolean doSteim1)
          Coverts the data to Miniseed, spliting into multiple data records if it will not fit into one.
 DataRecord toMiniSeedNoSplit(int recLenExp, boolean steim1)
           
 java.lang.String toString()
           
 java.lang.String toStringWithData()
           
 void write(java.io.DataOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOC_NULL_STRING

public static final java.lang.String LOC_NULL_STRING
See Also:
Constant Field Values

MAX_TRACEBUF_SIZE

public static final int MAX_TRACEBUF_SIZE
See Also:
Constant Field Values

AMPLIFIER_SATURATED

public static final int AMPLIFIER_SATURATED
See Also:
Constant Field Values

DIGITIZER_CLIPPED

public static final int DIGITIZER_CLIPPED
See Also:
Constant Field Values

SPIKES_DETECTED

public static final int SPIKES_DETECTED
See Also:
Constant Field Values

GLITCHES_DETECTED

public static final int GLITCHES_DETECTED
See Also:
Constant Field Values

MISSING_DATA_PRESENT

public static final int MISSING_DATA_PRESENT
See Also:
Constant Field Values

TELEMETRY_SYNCH_ERROR

public static final int TELEMETRY_SYNCH_ERROR
See Also:
Constant Field Values

FILTER_CHARGING

public static final int FILTER_CHARGING
See Also:
Constant Field Values

TIME_TAG_QUESTIONABLE

public static final int TIME_TAG_QUESTIONABLE
See Also:
Constant Field Values

HEADER_SIZE

public static final int HEADER_SIZE
See Also:
Constant Field Values

SUN_IEEE_SINGLE_PRECISION_REAL

public static final java.lang.String SUN_IEEE_SINGLE_PRECISION_REAL
See Also:
Constant Field Values

SUN_IEEE_DOUBLE_PRECISION_REAL

public static final java.lang.String SUN_IEEE_DOUBLE_PRECISION_REAL
See Also:
Constant Field Values

SUN_IEEE_INTEGER

public static final java.lang.String SUN_IEEE_INTEGER
See Also:
Constant Field Values

SUN_IEEE_SHORT_INTEGER

public static final java.lang.String SUN_IEEE_SHORT_INTEGER
See Also:
Constant Field Values

INTEL_IEEE_SINGLE_PRECISION_REAL

public static final java.lang.String INTEL_IEEE_SINGLE_PRECISION_REAL
See Also:
Constant Field Values

INTEL_IEEE_DOUBLE_PRECISION_REAL

public static final java.lang.String INTEL_IEEE_DOUBLE_PRECISION_REAL
See Also:
Constant Field Values

INTEL_IEEE_INTEGER

public static final java.lang.String INTEL_IEEE_INTEGER
See Also:
Constant Field Values

INTEL_IEEE_SHORT_INTEGER

public static final java.lang.String INTEL_IEEE_SHORT_INTEGER
See Also:
Constant Field Values

NORESS_GAIN_RANGED

public static final java.lang.String NORESS_GAIN_RANGED
See Also:
Constant Field Values

TRACEBUF_VERSION

public static final java.lang.String TRACEBUF_VERSION
See Also:
Constant Field Values

MAX_NET_LEN

public static final int MAX_NET_LEN
See Also:
Constant Field Values

MAX_STA_LEN

public static final int MAX_STA_LEN
See Also:
Constant Field Values

MAX_LOC_LEN

public static final int MAX_LOC_LEN
See Also:
Constant Field Values

MAX_CHAN_LEN

public static final int MAX_CHAN_LEN
See Also:
Constant Field Values

S_ZERO

public static final short S_ZERO
See Also:
Constant Field Values
Constructor Detail

TraceBuf2

protected TraceBuf2()
for use by static read method.


TraceBuf2

public TraceBuf2(int pin,
                 int numSamples,
                 double startTime,
                 double sampleRate,
                 java.lang.String station,
                 java.lang.String network,
                 java.lang.String channel,
                 java.lang.String locId,
                 short[] data)

TraceBuf2

public TraceBuf2(int pin,
                 int numSamples,
                 double startTime,
                 double sampleRate,
                 java.lang.String station,
                 java.lang.String network,
                 java.lang.String channel,
                 java.lang.String locId,
                 int[] intData)

TraceBuf2

public TraceBuf2(int pin,
                 int numSamples,
                 double startTime,
                 double sampleRate,
                 java.lang.String station,
                 java.lang.String network,
                 java.lang.String channel,
                 java.lang.String locId,
                 float[] data)

TraceBuf2

public TraceBuf2(int pin,
                 int numSamples,
                 double startTime,
                 double sampleRate,
                 java.lang.String station,
                 java.lang.String network,
                 java.lang.String channel,
                 java.lang.String locId,
                 double[] data)

TraceBuf2

public TraceBuf2(byte[] data)
Method Detail

read

public static TraceBuf2 read(java.io.DataInput in)
                      throws java.io.IOException
Throws:
java.io.IOException

extractNumSamples

public static int extractNumSamples(byte[] data,
                                    boolean swapBytes)

extractDataType

public static java.lang.String extractDataType(byte[] data)

isSwapBytes

public static boolean isSwapBytes(java.lang.String dataType)

getSampleSize

public static int getSampleSize(java.lang.String dataType)

write

public void write(java.io.DataOutputStream out)
           throws java.io.IOException
Throws:
java.io.IOException

split

public java.util.List<TraceBuf2> split(int maxSize)

isShortData

public boolean isShortData()

isIntData

public boolean isIntData()

isFloatData

public boolean isFloatData()

isDoubleData

public boolean isDoubleData()

isShortData

public static boolean isShortData(java.lang.String dataType)

isIntData

public static boolean isIntData(java.lang.String dataType)

isFloatData

public static boolean isFloatData(java.lang.String dataType)

isDoubleData

public static boolean isDoubleData(java.lang.String dataType)

getPin

public int getPin()

getNumSamples

public int getNumSamples()

getStartTime

public double getStartTime()

getEndTime

public double getEndTime()

getPredictedNextStartTime

public double getPredictedNextStartTime()
Predicted start of the next tracebuf in seconds.


getPredictedNextStartDate

public java.util.Date getPredictedNextStartDate()
Predicted start of the next tracebuf.


getStartDate

public java.util.Date getStartDate()

getEndDate

public java.util.Date getEndDate()

getSampleRate

public double getSampleRate()

getStation

public java.lang.String getStation()

getNetwork

public java.lang.String getNetwork()

getChannel

public java.lang.String getChannel()

formatNSLCCodes

public java.lang.String formatNSLCCodes()

getLocId

public java.lang.String getLocId()

getVersion

public java.lang.String getVersion()

getDataType

public java.lang.String getDataType()

getQuality

public short getQuality()

getPad

public short getPad()

getShortData

public short[] getShortData()

getIntData

public int[] getIntData()

getFloatData

public float[] getFloatData()

getDoubleData

public double[] getDoubleData()

getSeedEncoding

public byte getSeedEncoding()

toByteArray

public byte[] toByteArray()
                   throws java.io.IOException
Throws:
java.io.IOException

encodeSteim1

public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1(int recLenExp)
                                                    throws SeedFormatException
encodes the data as Steim1. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.

Parameters:
recLenExp - power of 2 for record size, generally 8-12
Returns:
Steim1 encoding of the data
Throws:
SeedFormatException - if data is not integer or compression errors occur

encodeSteim1

public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1(int recLenExp,
                                                           int offset)
                                                    throws SeedFormatException
encodes the data starting at offset as Steim1. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.

Parameters:
recLenExp - power of 2 for record size, generally 8-12
offset - starting point for encoding, first sample to use
Returns:
Steim1 encoding of the data
Throws:
SeedFormatException - if data is not integer or compression errors occur

toMiniSeed

public java.util.List<DataRecord> toMiniSeed(int recLenExp,
                                             boolean doSteim1)
                                      throws SeedFormatException
Coverts the data to Miniseed, spliting into multiple data records if it will not fit into one.

Parameters:
recLenExp - power of 2 for record size, generally 8-12
doSteim1 - if Steim1 compression should be applied
Returns:
Miniseed records
Throws:
SeedFormatException

toMiniSeedNoSplit

public DataRecord toMiniSeedNoSplit(int recLenExp,
                                    boolean steim1)
                             throws SeedFormatException
Throws:
SeedFormatException

getSize

public int getSize()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringWithData

public java.lang.String toStringWithData()