ucar.atd.dorade
Class DoradePARM

java.lang.Object
  extended by ucar.atd.dorade.DoradePARM

public class DoradePARM
extends Object

Title: DoradePARM

Description: DORADE parameter descriptor

Copyright: Copyright (c) 2003

Company: University Corporation for Atmospheric Research

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
Chris Burghart

Field Summary
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
           
protected  boolean verbose
           
 
Constructor Summary
DoradePARM(RandomAccessFile file, boolean littleEndianData, ucar.atd.dorade.DoradeRADD radd)
           
 
Method Summary
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 given Date, shown in UTC.
 int getBadDataFlag()
           
 int getBinaryFormat()
          Get the binary format used for encoding this parameter.
 float getCellSpacing()
          Get the cell spacing.
static boolean getDefaultVerboseState()
          Get the default verbose state for new DoradeDescriptor-s.
static boolean getDefaultVerboseState(String descriptorName)
          Get the default verbose state for new DoradeDescriptor-s of the given name.
 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.
static void setDefaultVerboseState(boolean verbose)
          Set the default verbose state for new DoradeDescriptor-s.
static void setDefaultVerboseState(String descriptorName, boolean verbose)
          Set the default verbose state for new DoradeDescriptor-s of the given name.
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

verbose

protected boolean verbose

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

toString

public String toString()
Overrides:
toString in class Object

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:
    DescriptorException - if the cell spacing is not constant.
    ucar.atd.dorade.DoradeDescriptor.DescriptorException

    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:
    DescriptorException
    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 parameter
    workingArray - 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:
    DescriptorException
    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 descriptor
    littleEndianData - set to true iff the file contains little-endian data
    expectedName - the expected name for the descriptor being read
    Throws:
    DescriptorException - for file read errors, descriptor name mismatch, etc.
    ucar.atd.dorade.DoradeDescriptor.DescriptorException

    skipDescriptor

    protected static void skipDescriptor(RandomAccessFile file,
                                         boolean littleEndianData)
                                  throws ucar.atd.dorade.DoradeDescriptor.DescriptorException,
                                         IOException
    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:
    IOException
    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:
    DescriptorException
    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:
    DescriptorException
    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 read
    offset - 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 read
    offset - number of bytes to skip in the byte array before reading
    littleEndianData - 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 read
    offset - 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 read
    offset - 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 read
    offset - 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,
                                           IOException
    Throws:
    ucar.atd.dorade.DoradeDescriptor.DescriptorException
    IOException

    findNext

    protected long findNext(RandomAccessFile file)
                     throws ucar.atd.dorade.DoradeDescriptor.DescriptorException,
                            IOException
    Throws:
    ucar.atd.dorade.DoradeDescriptor.DescriptorException
    IOException

    formatDate

    public static String formatDate(Date date)
    Return a string with a reasonable and complete representation of the given Date, shown in UTC.

    Parameters:
    date - Date to be represented
    Returns:
    a string containing the representation of the date

    getDefaultVerboseState

    public static boolean getDefaultVerboseState()
    Get the default verbose state for new DoradeDescriptor-s.


    setDefaultVerboseState

    public static void setDefaultVerboseState(boolean verbose)
    Set the default verbose state for new DoradeDescriptor-s.

    Parameters:
    verbose - the new default verbose state

    getDefaultVerboseState

    public static boolean getDefaultVerboseState(String descriptorName)
    Get the default verbose state for new DoradeDescriptor-s of the given name.

    Parameters:
    descriptorName - the descriptor name for which the new default verbose state will apply

    setDefaultVerboseState

    public static void setDefaultVerboseState(String descriptorName,
                                              boolean verbose)
    Set the default verbose state for new DoradeDescriptor-s of the given name.

    Parameters:
    descriptorName - the descriptor name for which the new default verbose state will apply
    verbose - the new default verbose state


    Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.