ucar.nc2.iosp.gempak
Class GempakGridReader

java.lang.Object
  extended by ucar.nc2.iosp.gempak.GempakFileReader
      extended by ucar.nc2.iosp.gempak.GempakGridReader
All Implemented Interfaces:
GempakConstants

public class GempakGridReader
extends GempakFileReader

Read a Gempak grid file

Version:
$Revision: 1.3 $
Author:
IDV Development Team

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.iosp.gempak.GempakFileReader
GempakFileReader.DMFileHeaderInfo, GempakFileReader.DMHeaders, GempakFileReader.DMKeys, GempakFileReader.DMLabel, GempakFileReader.DMParam, GempakFileReader.DMPart, GempakFileReader.Key
 
Field Summary
static java.lang.String ANLB
          Grid analysis block identifier
static java.lang.String GRID
          Grid identifier
static java.lang.String NAVB
          Grid nav block identifier
 
Fields inherited from class ucar.nc2.iosp.gempak.GempakFileReader
dmLabel, fileHeaderInfo, fileSize, headers, keys, MTMACH, mvmst, needToSwap, parts, rf
 
Fields inherited from interface ucar.nc2.iosp.gempak.GempakConstants
COL, IMISSD, LLGDHD, LLNANL, LLNNAV, LLSTHL, MBLKSZ, MDCHAR, MDGDEC, MDGDIF, MDGGRB, MDGNMC, MDGNON, MDGRB2, MDGRID, MDINTG, MDREAL, MDRPCK, MFGD, MFSF, MFSN, MTALPH, MTAPOL, MTHP, MTIBM, MTIGPH, MTIRIS, MTLNUX, MTSUN, MTULTX, MTVAX, RDIFFD, RMISSD, ROW
 
Constructor Summary
GempakGridReader()
          Bean ctor
GempakGridReader(RandomAccessFile raf)
          Create a Gempak Grid Reader from the file
GempakGridReader(java.lang.String filename)
          Create a Gempak Grid Reader from the file
 
Method Summary
 GempakGridRecord findGrid(java.lang.String parm)
          Find the first grid with this name
 int getGridCount()
          Get the grid count
 GridIndex getGridIndex()
          Get the grid index
 java.util.List<GridRecord> getGridList()
          Get list of grids
 int getGridPackingType(int gridNumber)
          Get the grid packing type
 void getNextByte()
          Get the next byte
protected  boolean init()
          Initialize this reader.
protected  boolean init(boolean fullCheck)
          Initialize this reader.
static void main(java.lang.String[] args)
          Run the program
 void printAnalBlock()
          Print out the analysis block so it looks something like this:
 void printGrids()
          Print out the grids.
 void printNavBlock()
          Print out the navibation block so it looks something like this:
 float[] readGrid(GridRecord gr)
          Get the grid packing type
 void showGridInfo(boolean printGrids)
          List out the grid information (aka GDINFO)
 
Methods inherited from class ucar.nc2.iosp.gempak.GempakFileReader
DM_RFLT, DM_RFLT, DM_RFLT, DM_RINT, DM_RINT, DM_RINT, DM_RSTR, DM_RSTR, findFileHeader, findKey, getByteOrder, getByteOrder, getDataPointer, getFileHeader, getFilename, getInitFileSize, getOffset, getPart, getPartNumber, init, logError, printFileLabel, printHeaders, printKeys, printParts, readFileHeaderInfo, readHeaders, readKeys, readParts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID

public static final java.lang.String GRID
Grid identifier

See Also:
Constant Field Values

ANLB

public static final java.lang.String ANLB
Grid analysis block identifier

See Also:
Constant Field Values

NAVB

public static final java.lang.String NAVB
Grid nav block identifier

See Also:
Constant Field Values
Constructor Detail

GempakGridReader

public GempakGridReader()
Bean ctor


GempakGridReader

public GempakGridReader(java.lang.String filename)
                 throws java.io.IOException
Create a Gempak Grid Reader from the file

Parameters:
filename - filename
Throws:
java.io.IOException - problem reading file

GempakGridReader

public GempakGridReader(RandomAccessFile raf)
                 throws java.io.IOException
Create a Gempak Grid Reader from the file

Parameters:
raf - RandomAccessFile
Throws:
java.io.IOException - problem reading file
Method Detail

init

protected boolean init()
                throws java.io.IOException
Initialize this reader. Read all the metadata

Returns:
true if successful
Throws:
java.io.IOException - problem reading the data

init

protected boolean init(boolean fullCheck)
                throws java.io.IOException
Initialize this reader. Get the Grid specific info

Overrides:
init in class GempakFileReader
Parameters:
fullCheck - check to make sure there are grids we can handle
Returns:
true if successful
Throws:
java.io.IOException - problem reading the data

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Run the program

Parameters:
args - [0] filename (required), [1] variable name (X for default), [2] X to not list grids
Throws:
java.io.IOException - problem reading the file

getGridIndex

public GridIndex getGridIndex()
Get the grid index

Returns:
the GridIndex

getGridCount

public int getGridCount()
Get the grid count

Returns:
the count

getGridPackingType

public int getGridPackingType(int gridNumber)
                       throws java.io.IOException
Get the grid packing type

Parameters:
gridNumber - grid number
Returns:
packing type or error number
Throws:
java.io.IOException - problem reading file

findGrid

public GempakGridRecord findGrid(java.lang.String parm)
Find the first grid with this name

Parameters:
parm - name of grid
Returns:
the grid header or null

readGrid

public float[] readGrid(GridRecord gr)
                 throws java.io.IOException
Get the grid packing type

Parameters:
gr - grid record
Returns:
packing type or error number
Throws:
java.io.IOException - problem reading file

printNavBlock

public void printNavBlock()
Print out the navibation block so it looks something like this:
   GRID NAVIGATION:
        PROJECTION:          LCC
        ANGLES:              25.0   -95.0    25.0
        GRID SIZE:           93  65
        LL CORNER:           12.19   -133.46
        UR CORNER:           57.29    -49.38
 


printAnalBlock

public void printAnalBlock()
Print out the analysis block so it looks something like this:


getGridList

public java.util.List<GridRecord> getGridList()
Get list of grids

Returns:
list of grids

printGrids

public void printGrids()
Print out the grids.


showGridInfo

public void showGridInfo(boolean printGrids)
List out the grid information (aka GDINFO)

Parameters:
printGrids - print each grid record

getNextByte

public void getNextByte()
                 throws java.io.IOException
Get the next byte

Throws:
java.io.IOException - problem reading the byte