ucar.nc2.iosp.grib
Class GribGridServiceProvider

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

public class GribGridServiceProvider
extends GridServiceProvider


Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.iosp.grid.GridServiceProvider
GridServiceProvider.IndexExtendMode
 
Field Summary
 
Fields inherited from class ucar.nc2.iosp.grid.GridServiceProvider
addLatLon, alwaysInCache, debugMissing, debugMissingDetails, debugOpen, debugProj, debugTiming, debugVert, fmrcCoordSys, forceNewIndex, indexFileModeOnOpen, indexFileModeOnSync, ncfile, parseInfo, raf, useMaximalCoordSys
 
Constructor Summary
GribGridServiceProvider()
           
 
Method Summary
protected  float[] _readData(ucar.grid.GridRecord gr)
          Read the data for this GridRecord
 java.lang.String getFileTypeDescription()
          Get a human-readable description for this file type.
 java.lang.String getFileTypeId()
          Get a unique id for this file type.
protected  ucar.grid.GridIndex getIndex(java.lang.String dataLocation)
          Open the index file.
 ucar.grid.GridTableLookup getLookup()
           
protected  ucar.grid.GridTableLookup getLookup1()
           
protected  ucar.grid.GridTableLookup getLookup2()
           
 boolean isValidFile(RandomAccessFile raf)
          Check if this is a valid file for this IOServiceProvider.
protected  void open(ucar.grid.GridIndex index, CancelTask cancelTask)
          Use the given index to fill the NetcdfFile object with attributes and variables.
 void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
          Open the service provider for reading.
 boolean sync()
          Update the metadata in the NetcdfFile if the underlying dataset has changed.
 
Methods inherited from class ucar.nc2.iosp.grid.GridServiceProvider
close, getDetailInfo, isMissingXY, readData, sendIospMessage, setDebugFlags, setExtendIndex, setIndexAlwaysInCache, setIndexFileModeOnOpen, setIndexFileModeOnSync, useMaximalCoordSys
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
copyToByteChannel, createValidNetcdfObjectName, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, syncExtend, toStringDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GribGridServiceProvider

public GribGridServiceProvider()
Method Detail

isValidFile

public boolean isValidFile(RandomAccessFile raf)
Description copied from interface: IOServiceProvider
Check if this is a valid file for this IOServiceProvider. You must make this method thread safe, ie dont keep any state.

Parameters:
raf - RandomAccessFile
Returns:
true if valid.

getFileTypeId

public java.lang.String getFileTypeId()
Description copied from interface: IOServiceProvider
Get a unique id for this file type.

Returns:
registered id of the file type
See Also:
"http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"

getFileTypeDescription

public java.lang.String getFileTypeDescription()
Description copied from interface: IOServiceProvider
Get a human-readable description for this file type.

Returns:
description of the file type
See Also:
"http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"

open

public void open(RandomAccessFile raf,
                 NetcdfFile ncfile,
                 CancelTask cancelTask)
          throws java.io.IOException
Description copied from class: GridServiceProvider
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(ucar.grid.GridIndex index,
                    CancelTask cancelTask)
             throws java.io.IOException
Description copied from class: GridServiceProvider
Use the given index to fill the NetcdfFile object with attributes and variables.

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

getLookup

public ucar.grid.GridTableLookup getLookup()
                                    throws java.io.IOException
Throws:
java.io.IOException

getLookup2

protected ucar.grid.GridTableLookup getLookup2()
                                        throws java.io.IOException
Throws:
java.io.IOException

getLookup1

protected ucar.grid.GridTableLookup getLookup1()
                                        throws java.io.IOException
Throws:
java.io.IOException

getIndex

protected ucar.grid.GridIndex getIndex(java.lang.String dataLocation)
                                throws java.io.IOException
Open the index file. If not exists, create it. When writing use DiskCache, to make sure location is writeable.

Parameters:
dataLocation - location of the file. The index file has ".gbx" appended.
Returns:
ucar.grib.Index
Throws:
java.io.IOException - on io error

sync

public boolean sync()
             throws java.io.IOException
Description copied from interface: IOServiceProvider
Update the metadata in the NetcdfFile if the underlying dataset has changed.

Specified by:
sync in interface IOServiceProvider
Overrides:
sync in class AbstractIOServiceProvider
Returns:
true if the NetcdfFile was changed.
Throws:
java.io.IOException - if a read error occured when accessing the underlying dataset.

_readData

protected float[] _readData(ucar.grid.GridRecord gr)
                     throws java.io.IOException
Description copied from class: GridServiceProvider
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