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

Author:
Don Murray

Nested Class Summary
protected static class GempakGridServiceProvider.MakeNetcdfFile
          TODO: generalize this static class for testing
 
Nested classes/interfaces inherited from class ucar.nc2.iosp.grid.GridServiceProvider
GridServiceProvider.IndexExtendMode
 
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, alwaysInCache, debugMissing, debugMissingDetails, debugOpen, debugProj, debugTiming, debugVert, fmrcCoordSys, forceNewIndex, indexFileModeOnOpen, indexFileModeOnSync, ncfile, useMaximalCoordSys
 
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
raf
 
Constructor Summary
GempakGridServiceProvider()
           
 
Method Summary
protected  float[] _readData(GridRecord gr)
          Read the data for this GridRecord
 String getFileTypeDescription()
          Get a human-readable description for this file type.
 String getFileTypeId()
          Get a unique id for this file type.
 boolean isValidFile(RandomAccessFile raf)
          Is this a valid file?
static void main(String[] args)
          Test this class and possibly write out a netCDF file
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
forceNewIndex, getDetailInfo, isMissingXY, readData, sendIospMessage, setDebugFlags, setIndexAlwaysInCache, setIndexFileModeOnOpen, setIndexFileModeOnSync, useMaximalCoordSys
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
close, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, syncExtend, 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 IOException
Is this a valid file?

Parameters:
raf - RandomAccessFile to check
Returns:
true if a valid GEMPAK grid file
Throws:
IOException - problem reading file

getFileTypeId

public 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 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 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:
IOException - problem reading file

open

protected void open(GridIndex index,
                    CancelTask cancelTask)
             throws 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:
IOException - problem reading the file

sync

public boolean sync()
             throws IOException
Sync the file

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

_readData

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

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

main

public static void main(String[] args)
                 throws IOException
Test this class and possibly write out a netCDF file

Parameters:
args - arg1 input GEMPAK grid to read, arg2 output Netcdf file (optional)
Throws:
IOException - on io error
IOException - problem reading or writing file

setExtendIndex

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

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


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