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 float
BAD_VALUE
Bad data value flag returned by getParamValues().protected String
descName
protected String
expectedName
protected RandomAccessFile
file
static int
FORMAT_16BIT_FLOAT
16-bit IEEE float format.static int
FORMAT_16BIT_INT
16-bit signed integer format.static int
FORMAT_32BIT_FLOAT
32-bit IEEE float format.static int
FORMAT_32BIT_INT
32-bit signed integer format.static int
FORMAT_8BIT_INT
8-bit signed integer format.protected boolean
littleEndianData
protected static TimeZone
TZ_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 long
findNext(RandomAccessFile file)
protected static long
findNextWithName(String expectedName, RandomAccessFile file, boolean littleEndianData)
static String
formatDate(Date date)
Return a string with a reasonable and complete representation of the givenDate
, shown in UTC.int
getBadDataFlag()
int
getBinaryFormat()
Get the binary format used for encoding this parameter.float
getCellSpacing()
Get the cell spacing.String
getDescription()
Get the long description for this parameter.String
getName()
Get the name of this parameter.int
getNCells()
Get the number of cells in a ray.int
getnSamples()
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.int
getPolarization()
float
getScale()
String
getthresholdParamName()
float
getThresholdValue()
String
getUnitName()
String
getUnits()
Get the units string for this parameter.int
getusedFrequencies()
int
getusedPRTs()
protected double
grabDouble(byte[] bytes, int offset)
Unpack an eight-byte IEEE float from the given byte array.protected float
grabFloat(byte[] bytes, int offset)
Unpack a four-byte IEEE float from the given byte array.protected int
grabInt(byte[] bytes, int offset)
Unpack a four-byte integer from the given byte array.protected static int
grabInt(byte[] bytes, int offset, boolean littleEndianData)
Unpack a four-byte integer from the given byte array.protected short
grabShort(byte[] bytes, int offset)
Unpack a two-byte integer from the given byte array.protected static String
peekName(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 void
skipDescriptor(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 boolean
sweepfileIsLittleEndian(RandomAccessFile file)
Determine if the given DORADE sweepfile contains little-endian data (in violation of the DORADE definition...).String
toString()
-
-
-
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_INT
FORMAT_16BIT_INT
FORMAT_32BIT_INT
FORMAT_16BIT_FLOAT
FORMAT_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.DescriptorException
Get 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.DescriptorException
Get 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.DescriptorException
Get 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:
true
iff 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.DescriptorException
Unpack 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.DescriptorException
Unpack 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
-
-