Package ucar.nc2.iosp.nexrad2
Class Level2Record
- java.lang.Object
-
- ucar.nc2.iosp.nexrad2.Level2Record
-
public class Level2Record extends Object
This class reads one record (radial) in an NEXRAD level II file. File must be uncompressed. Not handling messages yet, only data. 10/16/05: Now returns data as a byte, so use scale and offset. Adapted with permission from the Java Iras software developed by David Priegnitz at NSSL.
-
-
Field Summary
Fields Modifier and Type Field Description static byteBELOW_THRESHOLDstatic intCORRELATION_COEFFICIENTHigh Resolution Sprectrum Width moment identifierstatic intDIFF_PHASEHigh Resolution Radial Velocity moment identifierstatic intDIFF_REFLECTIVITY_HIGHHigh Resolution Radial Velocity moment identifierstatic intDOPPLER_RESOLUTION_HIGH_CODEHigh doppler resolution codestatic intDOPPLER_RESOLUTION_LOW_CODELow doppler resolution codestatic floatHORIZONTAL_BEAM_WIDTHHorizontal beam widthbytemessage_typestatic byteMISSING_DATAInitialization flag for lookup tables public static int data_lut_init_flag = 0;static intREFLECTIVITYReflectivity moment identifierstatic intREFLECTIVITY_HIGHstatic intSPECTRUM_WIDTHSprectrum Width moment identifierstatic intSPECTRUM_WIDTH_HIGHHigh Resolution Sprectrum Width moment identifierstatic intVELOCITY_HIRadial Velocity moment identifierstatic intVELOCITY_HIGHHigh Resolution Radial Velocity moment identifierstatic intVELOCITY_LOWRadial Velocity moment identifier
-
Constructor Summary
Constructors Constructor Description Level2Record(ucar.unidata.io.RandomAccessFile din, int record, long message_offset31)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckOk()shortconvertunsignedByte2Short(byte b)short[]convertunsignedByte2Short(byte[] inb)Instances which have same content are equal.voiddump(PrintStream out)voiddump2(PrintStream out)voiddumpMessage(PrintStream out)static Level2Recordfactory(ucar.unidata.io.RandomAccessFile din, int record, long message_offset31)floatgetAzimuth()Get the azimuth in degreesfloatgetDatatypeAddOffset(int datatype)static StringgetDatatypeName(int datatype)shortgetDatatypeRangeFoldingThreshhold(int datatype)floatgetDatatypeScaleFactor(int datatype)shortgetDatatypeSNRThreshhold(int datatype)static StringgetDatatypeUnits(int datatype)DategetDate()static DategetDate(int julianDays, int msecs)floatgetElevation()Get the elevation angle in degreesintgetGateCount(int datatype)This method returns the number of gatesintgetGateSize(int datatype)This method returns the gate size in metersintgetGateStart(int datatype)This method returns the starting gate in metersstatic StringgetMessageTypeName(int code)static StringgetRadialStatusName(int code)static StringgetVolumeCoveragePatternName(int code)voidreadData(ucar.unidata.io.RandomAccessFile raf, int datatype, ucar.ma2.Range gateRange, ucar.ma2.IndexIterator ii)Read data from this record.StringtoString()
-
-
-
Field Detail
-
REFLECTIVITY
public static final int REFLECTIVITY
Reflectivity moment identifier- See Also:
- Constant Field Values
-
VELOCITY_HI
public static final int VELOCITY_HI
Radial Velocity moment identifier- See Also:
- Constant Field Values
-
VELOCITY_LOW
public static final int VELOCITY_LOW
Radial Velocity moment identifier- See Also:
- Constant Field Values
-
SPECTRUM_WIDTH
public static final int SPECTRUM_WIDTH
Sprectrum Width moment identifier- See Also:
- Constant Field Values
-
DOPPLER_RESOLUTION_LOW_CODE
public static final int DOPPLER_RESOLUTION_LOW_CODE
Low doppler resolution code- See Also:
- Constant Field Values
-
DOPPLER_RESOLUTION_HIGH_CODE
public static final int DOPPLER_RESOLUTION_HIGH_CODE
High doppler resolution code- See Also:
- Constant Field Values
-
HORIZONTAL_BEAM_WIDTH
public static final float HORIZONTAL_BEAM_WIDTH
Horizontal beam width- See Also:
- Constant Field Values
-
REFLECTIVITY_HIGH
public static final int REFLECTIVITY_HIGH
- See Also:
- Constant Field Values
-
VELOCITY_HIGH
public static final int VELOCITY_HIGH
High Resolution Radial Velocity moment identifier- See Also:
- Constant Field Values
-
SPECTRUM_WIDTH_HIGH
public static final int SPECTRUM_WIDTH_HIGH
High Resolution Sprectrum Width moment identifier- See Also:
- Constant Field Values
-
DIFF_REFLECTIVITY_HIGH
public static final int DIFF_REFLECTIVITY_HIGH
High Resolution Radial Velocity moment identifier- See Also:
- Constant Field Values
-
DIFF_PHASE
public static final int DIFF_PHASE
High Resolution Radial Velocity moment identifier- See Also:
- Constant Field Values
-
CORRELATION_COEFFICIENT
public static final int CORRELATION_COEFFICIENT
High Resolution Sprectrum Width moment identifier- See Also:
- Constant Field Values
-
MISSING_DATA
public static final byte MISSING_DATA
Initialization flag for lookup tables public static int data_lut_init_flag = 0; /** Reflectivity look up table public static float[] Reflectivity_LUT = new float[256]; /** 1 km Velocity look up table public static float[] Velocity_1km_LUT = new float[256]; /** 1/2 km Velocity look up table public static float[] Velocity_hkm_LUT = new float[256]; static { Reflectivity_LUT[0] = 0.0f; // Float.NaN; //(float) SIGNAL_BELOW_THRESHOLD; Reflectivity_LUT[1] = Float.NaN; //(float) SIGNAL_OVERLAID; Velocity_1km_LUT[0] = 0.0f; // Float.NaN; //(float) SIGNAL_BELOW_THRESHOLD; Velocity_1km_LUT[1] = Float.NaN; //(float) SIGNAL_OVERLAID; Velocity_hkm_LUT[0] = 0.0f; // Float.NaN; //(float) SIGNAL_BELOW_THRESHOLD; Velocity_hkm_LUT[1] = Float.NaN; //(float) SIGNAL_OVERLAID; for (int i = 2; i < 256; i++) { Reflectivity_LUT[i] = (float) (i / 2.0 - 33.0); Velocity_1km_LUT[i] = (float) (i - 129.0); Velocity_hkm_LUT[i] = (float) (i / 2.0 - 64.5); // also spectrum width } }- See Also:
- Constant Field Values
-
BELOW_THRESHOLD
public static final byte BELOW_THRESHOLD
- See Also:
- Constant Field Values
-
message_type
public byte message_type
-
-
Constructor Detail
-
Level2Record
public Level2Record(ucar.unidata.io.RandomAccessFile din, int record, long message_offset31) throws IOException- Throws:
IOException
-
-
Method Detail
-
getDatatypeName
public static String getDatatypeName(int datatype)
-
getDatatypeUnits
public static String getDatatypeUnits(int datatype)
-
getDatatypeSNRThreshhold
public short getDatatypeSNRThreshhold(int datatype)
-
getDatatypeRangeFoldingThreshhold
public short getDatatypeRangeFoldingThreshhold(int datatype)
-
getDatatypeScaleFactor
public float getDatatypeScaleFactor(int datatype)
-
getDatatypeAddOffset
public float getDatatypeAddOffset(int datatype)
-
getMessageTypeName
public static String getMessageTypeName(int code)
-
getRadialStatusName
public static String getRadialStatusName(int code)
-
getVolumeCoveragePatternName
public static String getVolumeCoveragePatternName(int code)
-
getDate
public static Date getDate(int julianDays, int msecs)
-
factory
public static Level2Record factory(ucar.unidata.io.RandomAccessFile din, int record, long message_offset31) throws IOException
- Throws:
IOException
-
dumpMessage
public void dumpMessage(PrintStream out)
-
dump
public void dump(PrintStream out)
-
dump2
public void dump2(PrintStream out)
-
checkOk
public boolean checkOk()
-
getAzimuth
public float getAzimuth()
Get the azimuth in degrees- Returns:
- azimuth angle in degrees 0 = true north, 90 = east
-
getElevation
public float getElevation()
Get the elevation angle in degrees- Returns:
- elevation angle in degrees 0 = parellel to pedestal base, 90 = perpendicular
-
getGateSize
public int getGateSize(int datatype)
This method returns the gate size in meters- Parameters:
datatype- which type of data : REFLECTIVITY, VELOCITY_HI, VELOCITY_LO, SPECTRUM_WIDTH- Returns:
- the gate size in meters
-
getGateStart
public int getGateStart(int datatype)
This method returns the starting gate in meters- Parameters:
datatype- which type of data : REFLECTIVITY, VELOCITY_HI, VELOCITY_LO, SPECTRUM_WIDTH- Returns:
- the starting gate in meters
-
getGateCount
public int getGateCount(int datatype)
This method returns the number of gates- Parameters:
datatype- which type of data : REFLECTIVITY, VELOCITY_HI, VELOCITY_LO, SPECTRUM_WIDTH- Returns:
- the number of gates
-
getDate
public Date getDate()
-
readData
public void readData(ucar.unidata.io.RandomAccessFile raf, int datatype, ucar.ma2.Range gateRange, ucar.ma2.IndexIterator ii) throws IOExceptionRead data from this record.- Parameters:
raf- read from this filedatatype- which type of data : REFLECTIVITY, VELOCITY_HI, VELOCITY_LO, SPECTRUM_WIDTHgateRange- handles the possible subset of data to returnii- put the data here- Throws:
IOException- on read error
-
convertunsignedByte2Short
public short[] convertunsignedByte2Short(byte[] inb)
Instances which have same content are equal. public boolean equals(Object oo) { if (this == oo) return true; if ( !(oo instanceof Level2Record)) return false; return hashCode() == oo.hashCode(); } /** Override Object.hashCode() to implement equals. * public int hashCode() { if (hashCode == 0) { int result = 17; result = 37*result + elevation_num; //result = 37*result + cut; //result = 37*result + datatype; hashCode = result; } return hashCode; } private volatile int hashCode = 0;
-
convertunsignedByte2Short
public short convertunsignedByte2Short(byte b)
-
-