Package edu.sc.seis.seisFile.mseed
Class DataHeader
- java.lang.Object
-
- edu.sc.seis.seisFile.mseed.ControlHeader
-
- edu.sc.seis.seisFile.mseed.DataHeader
-
public class DataHeader extends ControlHeader
Container class for SEED Fixed Section Data Header information.
-
-
Field Summary
Fields Modifier and Type Field Description protected byteactivityFlagsprotected byte[]channelIdentifierprotected java.lang.StringchannelIdentifierStringprotected intdataBlocketteOffsetprotected intdataOffsetprotected bytedataQualityFlagsprotected byteioClockFlagsprotected byte[]locationIdentifierprotected java.lang.StringlocationIdentifierStringprotected byte[]networkCodeprotected java.lang.StringnetworkCodeStringprotected bytenumBlockettesprotected intnumSamplesprotected intsampleRateFactorprotected intsampleRateMultiplierprotected byte[]startTimeprotected byte[]stationIdentifierprotected java.lang.StringstationIdentifierStringprotected inttimeCorrection-
Fields inherited from class edu.sc.seis.seisFile.mseed.ControlHeader
continuationCode, sequenceNum, typeCode
-
-
Constructor Summary
Constructors Constructor Description DataHeader(int sequenceNum, char typeCode, boolean continuationCode)creates a DataHeader object with listed sequence number, type code, and continuation code boolean.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description floatcalcSampleRateFromMultipilerFactor()get the sample rate.static short[]calcSeedMultipilerFactor(double sps)bytegetActivityFlags()Get the value of activityFlags.java.lang.StringgetChannelIdentifier()Get the value of channelIdentifier.java.lang.StringgetCodes()intgetDataBlocketteOffset()Get the value of dataBlocketteOffset.intgetDataOffset()Get the value of dataOffset.bytegetDataQualityFlags()Get the value of dataQualityFlags.bytegetIOClockFlags()Get the value of IOClockFlags.java.lang.StringgetLocationIdentifier()Get the value of locationIdentifier.java.lang.StringgetNetworkCode()Get the value of networkCode.bytegetNumBlockettes()Get the value of numBlockettes.intgetNumSamples()Get the value of numSamples.chargetQualityIndicator()same as getTypeCode() in ControlHeader, just a convenience method as the type code is called a Data header/quality indicator in the seed documentation for data header.intgetSampleRateFactor()Get the value of sampleRateFactor.intgetSampleRateMultiplier()Get the value of sampleRateMultiplier.shortgetSize()BtimegetStartBtime()java.lang.StringgetStartTime()Get the value of startTime.java.lang.StringgetStationIdentifier()Get the value of stationIdentifier.intgetTimeCorrection()Get the value of timeCorrection.protected voidread(byte[] buf, int offset)populates this object with Fixed Section Data Header info.static DataHeaderread(java.io.DataInput in, int sequenceNum, char typeCode, boolean continuationCode)Instantiate an object of this class and read an FSDH byte stream into it, parsing the contents into the instance variables of this object, which represent the individual FSDH fields.
Note, first 8 bytes are assumed to already have been read.voidsetActivityFlags(byte v)Set the value of activityFlags.voidsetChannelIdentifier(java.lang.String v)Set the value of channelIdentifier.voidsetDataBlocketteOffset(short v)Set the value of dataBlocketteOffset.voidsetDataOffset(short v)Set the value of dataOffset.voidsetDataQualityFlags(byte v)Set the value of dataQualityFlags.voidsetIOClockFlags(byte v)Set the value of IOClockFlags.voidsetLocationIdentifier(java.lang.String v)Set the value of locationIdentifier.voidsetNetworkCode(java.lang.String v)Set the value of networkCode.voidsetNumBlockettes(byte v)Set the value of numBlockettes.voidsetNumSamples(short v)Set the value of numSamples.voidsetSampleRate(double samplePerSecond)voidsetSampleRateFactor(short v)Set the value of sampleRateFactor.voidsetSampleRateMultiplier(short v)Set the value of sampleRateMultiplier.voidsetStartBtime(Btime btime)voidsetStationIdentifier(java.lang.String v)Set the value of stationIdentifier.voidsetTimeCorrection(int v)Set the value of timeCorrection.java.lang.StringtoString()Present a default string representation of the contents of this objectprotected voidwrite(java.io.DataOutput dos)write DataHeader contents to a DataOutput streamvoidwriteASCII(java.io.PrintWriter out)Writes an ASCII version of the record header.voidwriteASCII(java.io.PrintWriter out, java.lang.String indent)-
Methods inherited from class edu.sc.seis.seisFile.mseed.ControlHeader
getSequenceNum, getTypeCode, isContinuation, main, read, tester
-
-
-
-
Field Detail
-
stationIdentifier
protected byte[] stationIdentifier
-
stationIdentifierString
protected java.lang.String stationIdentifierString
-
locationIdentifier
protected byte[] locationIdentifier
-
locationIdentifierString
protected java.lang.String locationIdentifierString
-
channelIdentifier
protected byte[] channelIdentifier
-
channelIdentifierString
protected java.lang.String channelIdentifierString
-
networkCode
protected byte[] networkCode
-
networkCodeString
protected java.lang.String networkCodeString
-
startTime
protected byte[] startTime
-
numSamples
protected int numSamples
-
sampleRateFactor
protected int sampleRateFactor
-
sampleRateMultiplier
protected int sampleRateMultiplier
-
activityFlags
protected byte activityFlags
-
ioClockFlags
protected byte ioClockFlags
-
dataQualityFlags
protected byte dataQualityFlags
-
numBlockettes
protected byte numBlockettes
-
timeCorrection
protected int timeCorrection
-
dataOffset
protected int dataOffset
-
dataBlocketteOffset
protected int dataBlocketteOffset
-
-
Constructor Detail
-
DataHeader
public DataHeader(int sequenceNum, char typeCode, boolean continuationCode)creates a DataHeader object with listed sequence number, type code, and continuation code boolean.- Parameters:
sequenceNum- sequence number of the record represented by this object.typeCode- character representing the type of record represented by this objectcontinuationCode- true if this record is flagged as a continuation from its previous SEED record
-
-
Method Detail
-
writeASCII
public void writeASCII(java.io.PrintWriter out) throws java.io.IOExceptionWrites an ASCII version of the record header. This is not meant to be a definitive ascii representation, merely to give something to print for debugging purposes. Ideally each field of the header should be printed in the order is appears in the header in a visually appealing way.- Overrides:
writeASCIIin classControlHeader- Parameters:
out- a Writer- Throws:
java.io.IOException
-
writeASCII
public void writeASCII(java.io.PrintWriter out, java.lang.String indent) throws java.io.IOException- Overrides:
writeASCIIin classControlHeader- Throws:
java.io.IOException
-
read
public static DataHeader read(java.io.DataInput in, int sequenceNum, char typeCode, boolean continuationCode) throws java.io.IOException, SeedFormatException
Instantiate an object of this class and read an FSDH byte stream into it, parsing the contents into the instance variables of this object, which represent the individual FSDH fields.
Note, first 8 bytes are assumed to already have been read.- Parameters:
in- SEED data stream offset 8 bytes from beginning of record.sequenceNum- 6 digit ascii sequence tag at the beginning of SEED record.typeCode- character representing the type of record being readcontinuationCode- true if this record is flagged as a continuation from its previous SEED record.- Returns:
- an object of this class with fields filled from 'in' parameter
- Throws:
java.io.IOExceptionSeedFormatException
-
read
protected void read(byte[] buf, int offset)populates this object with Fixed Section Data Header info. this routine modified to include byte offset, should the station identifier start at a byte offset (such as 8 from the beginning of a data record).- Parameters:
buf- data buffer containing FSDH informationoffset- byte offset to begin reading buf
-
write
protected void write(java.io.DataOutput dos) throws java.io.IOExceptionwrite DataHeader contents to a DataOutput stream- Overrides:
writein classControlHeader- Parameters:
dos- DataOutput stream to write to- Throws:
java.io.IOException
-
getSize
public short getSize()
- Overrides:
getSizein classControlHeader
-
getQualityIndicator
public char getQualityIndicator()
same as getTypeCode() in ControlHeader, just a convenience method as the type code is called a Data header/quality indicator in the seed documentation for data header.
-
getStationIdentifier
public java.lang.String getStationIdentifier()
Get the value of stationIdentifier.- Returns:
- Value of stationIdentifier.
-
setStationIdentifier
public void setStationIdentifier(java.lang.String v)
Set the value of stationIdentifier.- Parameters:
v- Value to assign to stationIdentifier.
-
getLocationIdentifier
public java.lang.String getLocationIdentifier()
Get the value of locationIdentifier.- Returns:
- Value of locationIdentifier.
-
setLocationIdentifier
public void setLocationIdentifier(java.lang.String v)
Set the value of locationIdentifier.- Parameters:
v- Value to assign to locationIdentifier.
-
getChannelIdentifier
public java.lang.String getChannelIdentifier()
Get the value of channelIdentifier.- Returns:
- Value of channelIdentifier.
-
setChannelIdentifier
public void setChannelIdentifier(java.lang.String v)
Set the value of channelIdentifier.- Parameters:
v- Value to assign to channelIdentifier.
-
getNetworkCode
public java.lang.String getNetworkCode()
Get the value of networkCode.- Returns:
- Value of networkCode.
-
setNetworkCode
public void setNetworkCode(java.lang.String v)
Set the value of networkCode.- Parameters:
v- Value to assign to networkCode.
-
getStartBtime
public Btime getStartBtime()
-
setStartBtime
public void setStartBtime(Btime btime)
-
getStartTime
public java.lang.String getStartTime()
Get the value of startTime.- Returns:
- Value of startTime.
-
getNumSamples
public int getNumSamples()
Get the value of numSamples.- Returns:
- Value of numSamples.
-
setNumSamples
public void setNumSamples(short v)
Set the value of numSamples.- Parameters:
v- Value to assign to numSamples.
-
getSampleRateFactor
public int getSampleRateFactor()
Get the value of sampleRateFactor.- Returns:
- Value of sampleRateFactor.
-
setSampleRateFactor
public void setSampleRateFactor(short v)
Set the value of sampleRateFactor.- Parameters:
v- Value to assign to sampleRateFactor.
-
getSampleRateMultiplier
public int getSampleRateMultiplier()
Get the value of sampleRateMultiplier.- Returns:
- Value of sampleRateMultiplier.
-
setSampleRateMultiplier
public void setSampleRateMultiplier(short v)
Set the value of sampleRateMultiplier.- Parameters:
v- Value to assign to sampleRateMultiplier.
-
setSampleRate
public void setSampleRate(double samplePerSecond)
-
calcSampleRateFromMultipilerFactor
public float calcSampleRateFromMultipilerFactor()
get the sample rate. derived from sample rate factor and the sample rate multiplier. Note this may not be the true sample rate if the record contains a blockette 100. Returns zero if either of the multiplier or factor are zero, usually in the case of log/ascii/opaque data.- Returns:
- sample rate
-
calcSeedMultipilerFactor
public static short[] calcSeedMultipilerFactor(double sps)
-
getActivityFlags
public byte getActivityFlags()
Get the value of activityFlags.- Returns:
- Value of activityFlags.
-
setActivityFlags
public void setActivityFlags(byte v)
Set the value of activityFlags.- Parameters:
v- Value to assign to activityFlags.
-
getIOClockFlags
public byte getIOClockFlags()
Get the value of IOClockFlags.- Returns:
- Value of IOClockFlags.
-
setIOClockFlags
public void setIOClockFlags(byte v)
Set the value of IOClockFlags.- Parameters:
v- Value to assign to IOClockFlags.
-
getDataQualityFlags
public byte getDataQualityFlags()
Get the value of dataQualityFlags.- Returns:
- Value of dataQualityFlags.
-
setDataQualityFlags
public void setDataQualityFlags(byte v)
Set the value of dataQualityFlags.- Parameters:
v- Value to assign to dataQualityFlags.
-
getNumBlockettes
public byte getNumBlockettes()
Get the value of numBlockettes.- Returns:
- Value of numBlockettes.
-
setNumBlockettes
public void setNumBlockettes(byte v)
Set the value of numBlockettes.- Parameters:
v- Value to assign to numBlockettes.
-
getTimeCorrection
public int getTimeCorrection()
Get the value of timeCorrection.- Returns:
- Value of timeCorrection.
-
setTimeCorrection
public void setTimeCorrection(int v)
Set the value of timeCorrection.- Parameters:
v- Value to assign to timeCorrection.
-
getDataOffset
public int getDataOffset()
Get the value of dataOffset.- Returns:
- Value of dataOffset.
-
setDataOffset
public void setDataOffset(short v)
Set the value of dataOffset.- Parameters:
v- Value to assign to dataOffset.
-
getDataBlocketteOffset
public int getDataBlocketteOffset()
Get the value of dataBlocketteOffset.- Returns:
- Value of dataBlocketteOffset.
-
setDataBlocketteOffset
public void setDataBlocketteOffset(short v)
Set the value of dataBlocketteOffset.- Parameters:
v- Value to assign to dataBlocketteOffset.
-
toString
public java.lang.String toString()
Present a default string representation of the contents of this object- Overrides:
toStringin classControlHeader- Returns:
- formatted string of object contents
-
getCodes
public java.lang.String getCodes()
-
-