Package ucar.atd.dorade
Class DoradePARM
- java.lang.Object
-
- ucar.atd.dorade.DoradePARM
-
public class DoradePARM extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static floatBAD_VALUEBad data value flag returned by getParamValues().protected StringdescNameprotected StringexpectedNameprotected RandomAccessFilefilestatic intFORMAT_16BIT_FLOAT16-bit IEEE float format.static intFORMAT_16BIT_INT16-bit signed integer format.static intFORMAT_32BIT_FLOAT32-bit IEEE float format.static intFORMAT_32BIT_INT32-bit signed integer format.static intFORMAT_8BIT_INT8-bit signed integer format.protected booleanlittleEndianDataprotected static TimeZoneTZ_UTC
-
Constructor Summary
Constructors Constructor Description DoradePARM(RandomAccessFile file, boolean littleEndianData, ucar.atd.dorade.DoradeRADD radd)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longfindNext(RandomAccessFile file)protected static longfindNextWithName(String expectedName, RandomAccessFile file, boolean littleEndianData)static StringformatDate(Date date)Return a string with a reasonable and complete representation of the givenDate, shown in UTC.intgetBadDataFlag()intgetBinaryFormat()Get the binary format used for encoding this parameter.floatgetCellSpacing()Get the cell spacing.StringgetDescription()Get the long description for this parameter.StringgetName()Get the name of this parameter.intgetNCells()Get the number of cells in a ray.intgetnSamples()float[]getParamValues(ucar.atd.dorade.DoradeRDAT rdat)Get the unpacked data values for a selected parameter.float[]getParamValues(ucar.atd.dorade.DoradeRDAT rdat, float[] workingArray)Get the unpacked data values for a selected parameter.intgetPolarization()floatgetScale()StringgetthresholdParamName()floatgetThresholdValue()StringgetUnitName()StringgetUnits()Get the units string for this parameter.intgetusedFrequencies()intgetusedPRTs()protected doublegrabDouble(byte[] bytes, int offset)Unpack an eight-byte IEEE float from the given byte array.protected floatgrabFloat(byte[] bytes, int offset)Unpack a four-byte IEEE float from the given byte array.protected intgrabInt(byte[] bytes, int offset)Unpack a four-byte integer from the given byte array.protected static intgrabInt(byte[] bytes, int offset, boolean littleEndianData)Unpack a four-byte integer from the given byte array.protected shortgrabShort(byte[] bytes, int offset)Unpack a two-byte integer from the given byte array.protected static StringpeekName(RandomAccessFile file)Return the name of the DORADE descriptor at the current location in the file.protected byte[]readDescriptor(RandomAccessFile file, boolean littleEndianData, String expectedName)Read and set the descriptor name, size, and endianness, and return the entire contents of the descriptor (including the name and size) as a byte array.protected static voidskipDescriptor(RandomAccessFile file, boolean littleEndianData)Skip the current DORADE descriptor in the file, leaving the file position at the beginning of the next descriptor (or at the end of file).static booleansweepfileIsLittleEndian(RandomAccessFile file)Determine if the given DORADE sweepfile contains little-endian data (in violation of the DORADE definition...).StringtoString()
-
-
-
Field Detail
-
BAD_VALUE
public static final float BAD_VALUE
Bad data value flag returned by getParamValues().- See Also:
- Constant Field Values
-
FORMAT_8BIT_INT
public static final int FORMAT_8BIT_INT
8-bit signed integer format.- See Also:
- Constant Field Values
-
FORMAT_16BIT_INT
public static final int FORMAT_16BIT_INT
16-bit signed integer format.- See Also:
- Constant Field Values
-
FORMAT_32BIT_INT
public static final int FORMAT_32BIT_INT
32-bit signed integer format.- See Also:
- Constant Field Values
-
FORMAT_32BIT_FLOAT
public static final int FORMAT_32BIT_FLOAT
32-bit IEEE float format.- See Also:
- Constant Field Values
-
FORMAT_16BIT_FLOAT
public static final int FORMAT_16BIT_FLOAT
16-bit IEEE float format.- See Also:
- Constant Field Values
-
descName
protected String descName
-
expectedName
protected String expectedName
-
file
protected RandomAccessFile file
-
littleEndianData
protected boolean littleEndianData
-
TZ_UTC
protected static final TimeZone TZ_UTC
-
-
Constructor Detail
-
DoradePARM
public DoradePARM(RandomAccessFile file, boolean littleEndianData, ucar.atd.dorade.DoradeRADD radd) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
-
Method Detail
-
getName
public String getName()
Get the name of this parameter.- Returns:
- the name of the parameter
-
getBadDataFlag
public int getBadDataFlag()
-
getThresholdValue
public float getThresholdValue()
-
getPolarization
public int getPolarization()
-
getScale
public float getScale()
-
getUnitName
public String getUnitName()
-
getusedPRTs
public int getusedPRTs()
-
getusedFrequencies
public int getusedFrequencies()
-
getnSamples
public int getnSamples()
-
getthresholdParamName
public String getthresholdParamName()
-
getUnits
public String getUnits()
Get the units string for this parameter.- Returns:
- the units string
-
getDescription
public String getDescription()
Get the long description for this parameter.- Returns:
- the description string
-
getBinaryFormat
public int getBinaryFormat()
Get the binary format used for encoding this parameter. Legal values are:FORMAT_8BIT_INTFORMAT_16BIT_INTFORMAT_32BIT_INTFORMAT_16BIT_FLOATFORMAT_32BIT_FLOAT- Returns:
- the binary format for this parameter
-
getNCells
public int getNCells()
Get the number of cells in a ray.- Returns:
- the number of cells in a ray
-
getCellSpacing
public float getCellSpacing() throws ucar.atd.dorade.DoradeDescriptor.DescriptorExceptionGet the cell spacing. An exception is thrown if the cell spacing is not constant.- Returns:
- the cell spacing, in meters
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException- if the cell spacing is not constant.
-
getParamValues
public float[] getParamValues(ucar.atd.dorade.DoradeRDAT rdat) throws ucar.atd.dorade.DoradeDescriptor.DescriptorExceptionGet the unpacked data values for a selected parameter.- Parameters:
rdat- the name of the desired parameter- Returns:
- the unpacked data values for all cells, using BAD_VALUE for bad data cells
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
getParamValues
public float[] getParamValues(ucar.atd.dorade.DoradeRDAT rdat, float[] workingArray) throws ucar.atd.dorade.DoradeDescriptor.DescriptorExceptionGet the unpacked data values for a selected parameter.- Parameters:
rdat- the name of the desired parameterworkingArray- If non-null and the same length as needed then use this.- Returns:
- the unpacked data values for all cells, using BAD_VALUE for bad data cells
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
readDescriptor
protected byte[] readDescriptor(RandomAccessFile file, boolean littleEndianData, String expectedName) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
Read and set the descriptor name, size, and endianness, and return the entire contents of the descriptor (including the name and size) as a byte array. The file position will be left at the beginning of the next descriptor (or at the end of file).- Parameters:
file- the DORADE sweepfile, positioned at the beginning of a descriptorlittleEndianData- set to true iff the file contains little-endian dataexpectedName- the expected name for the descriptor being read- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException- for file read errors, descriptor name mismatch, etc.
-
skipDescriptor
protected static void skipDescriptor(RandomAccessFile file, boolean littleEndianData) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
Skip the current DORADE descriptor in the file, leaving the file position at the beginning of the next descriptor (or at the end of file).- Parameters:
file- the DORADE sweepfile, positioned at the beginning of a descriptor- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
peekName
protected static String peekName(RandomAccessFile file) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
Return the name of the DORADE descriptor at the current location in the file. The current location will not be changed.- Parameters:
file- the DORADE sweep file, positioned at the beginning of a descriptor- Returns:
- the name of the DORADE descriptor starting at the current file position, or null if no descriptor name is available
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
sweepfileIsLittleEndian
public static boolean sweepfileIsLittleEndian(RandomAccessFile file) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
Determine if the given DORADE sweepfile contains little-endian data (in violation of the DORADE definition...).- Parameters:
file- the DORADE sweepfile,- Returns:
trueiff the file contains little-endian data- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
grabShort
protected short grabShort(byte[] bytes, int offset)Unpack a two-byte integer from the given byte array.- Parameters:
bytes- byte array to be readoffset- number of bytes to skip in the byte array before reading- Returns:
- the unpacked short value
-
grabInt
protected static int grabInt(byte[] bytes, int offset, boolean littleEndianData)Unpack a four-byte integer from the given byte array.- Parameters:
bytes- byte array to be readoffset- number of bytes to skip in the byte array before readinglittleEndianData- true iff the byte array contains little-endian data- Returns:
- the unpacked integer value
-
grabInt
protected int grabInt(byte[] bytes, int offset)Unpack a four-byte integer from the given byte array.- Parameters:
bytes- byte array to be readoffset- number of bytes to skip in the byte array before reading- Returns:
- the unpacked integer value
-
grabFloat
protected float grabFloat(byte[] bytes, int offset) throws ucar.atd.dorade.DoradeDescriptor.DescriptorExceptionUnpack a four-byte IEEE float from the given byte array.- Parameters:
bytes- byte array to be readoffset- number of bytes to skip in the byte array before reading- Returns:
- the unpacked float value
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
grabDouble
protected double grabDouble(byte[] bytes, int offset) throws ucar.atd.dorade.DoradeDescriptor.DescriptorExceptionUnpack an eight-byte IEEE float from the given byte array.- Parameters:
bytes- byte array to be readoffset- number of bytes to skip in the byte array before reading- Returns:
- the unpacked double value
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
findNextWithName
protected static long findNextWithName(String expectedName, RandomAccessFile file, boolean littleEndianData) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
findNext
protected long findNext(RandomAccessFile file) throws ucar.atd.dorade.DoradeDescriptor.DescriptorException
- Throws:
ucar.atd.dorade.DoradeDescriptor.DescriptorException
-
-