ucar.nc2.iosp.gempak
Class GempakGridServiceProvider

java.lang.Object
  extended by ucar.nc2.iosp.AbstractIOServiceProvider
      extended by ucar.nc2.iosp.grid.GridServiceProvider
          extended by ucar.nc2.iosp.gempak.GempakGridServiceProvider
All Implemented Interfaces:
IOServiceProvider

public class GempakGridServiceProvider
extends GridServiceProvider

An IOSP for Gempak Grid data

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

Nested Class Summary
protected static class GempakGridServiceProvider.MakeNetcdfFile
          TODO: generalize this static class for testing
 
Field Summary
static boolean extendIndex
          Reread the file on a sync
protected  GempakGridReader gemreader
          Gempak file reader
 
Fields inherited from class ucar.nc2.iosp.grid.GridServiceProvider
addLatLon, debugMissing, debugMissingDetails, debugOpen, debugProj, debugTiming, debugVert, fmrcCoordSys, ncfile, parseInfo, raf, useMaximalCoordSys
 
Constructor Summary
GempakGridServiceProvider()
           
 
Method Summary
protected  float[] _readData(GridRecord gr)
          Read the data for this GridRecord
 boolean isValidFile(RandomAccessFile raf)
          Is this a valid file?
static void main(java.lang.String[] args)
          Test this.
protected  void open(GridIndex index, CancelTask cancelTask)
          Open the index and create the netCDF file from that
 void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
          Open the service provider for reading.
static void setExtendIndex(boolean b)
          Extend the list of grid
 boolean sync()
          Sync the file
 
Methods inherited from class ucar.nc2.iosp.grid.GridServiceProvider
close, getDetailInfo, readData, sendIospMessage, setDebugFlags, syncExtend, useMaximalCoordSys
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
createValidNetcdfObjectName, getStructureIterator, readSection, readToByteChannel, toStringDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gemreader

protected GempakGridReader gemreader
Gempak file reader


extendIndex

public static boolean extendIndex
Reread the file on a sync

Constructor Detail

GempakGridServiceProvider

public GempakGridServiceProvider()
Method Detail

isValidFile

public boolean isValidFile(RandomAccessFile raf)
                    throws java.io.IOException
Is this a valid file?

Parameters:
raf - RandomAccessFile to check
Returns:
true if a valid Gempak grid file
Throws:
java.io.IOException - problem reading file

open

public void open(RandomAccessFile raf,
                 NetcdfFile ncfile,
                 CancelTask cancelTask)
          throws java.io.IOException
Open the service provider for reading.

Specified by:
open in interface IOServiceProvider
Overrides:
open in class GridServiceProvider
Parameters:
raf - file to read from
ncfile - netCDF file we are writing to (memory)
cancelTask - task for cancelling
Throws:
java.io.IOException - problem reading file

open

protected void open(GridIndex index,
                    CancelTask cancelTask)
             throws java.io.IOException
Open the index and create the netCDF file from that

Specified by:
open in class GridServiceProvider
Parameters:
index - GridIndex to use
cancelTask - cancel task
Throws:
java.io.IOException - problem reading the file

sync

public boolean sync()
             throws java.io.IOException
Sync the file

Specified by:
sync in interface IOServiceProvider
Overrides:
sync in class AbstractIOServiceProvider
Returns:
true if needed to sync
Throws:
java.io.IOException - problem synching the file

_readData

protected float[] _readData(GridRecord gr)
                     throws java.io.IOException
Read the data for this GridRecord

Specified by:
_readData in class GridServiceProvider
Parameters:
gr - grid identifier
Returns:
the data (or null)
Throws:
java.io.IOException - problem reading the data

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Test this.

Parameters:
args - file name
Throws:
java.io.IOException - problem reading the file

setExtendIndex

public static void setExtendIndex(boolean b)
Extend the list of grid

Parameters:
b - true to reread the grid on a sync