ucar.nc2.iosp.grads
Class GradsBinaryGridServiceProvider

java.lang.Object
  extended by ucar.nc2.iosp.AbstractIOServiceProvider
      extended by ucar.nc2.iosp.grads.GradsBinaryGridServiceProvider
All Implemented Interfaces:
IOServiceProvider

public class GradsBinaryGridServiceProvider
extends AbstractIOServiceProvider

IOSP for GrADS Binary data files. This IOSP only handles the binary formatted grids, most other GrADS data types can be read directly through other IOSPs

Author:
Don Murray - CU/CIRES

Field Summary
protected  GradsDataDescriptorFile gradsDDF
          GrADS file reader
 
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
raf
 
Constructor Summary
GradsBinaryGridServiceProvider()
           
 
Method Summary
protected  void buildNCFile()
          Build the netCDF file
 void close()
          Close this IOSP and associated files
 String getFileTypeDescription()
          Get the file type description
 String getFileTypeId()
          Get the file type id
 boolean isValidFile(RandomAccessFile raf)
          Is this a valid file? For this GrADS IOSP, the valid file must be: raw binary grid (not GRIB, netCDF, HDF, etc) not a cross section (x and y > 1) not an ensemble definded by EDEF/ENDEDEF (need examples)
 void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
          Open the service provider for reading.
 Array readData(Variable v2, Section section)
          Read the data for the variable
 
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
getDetailInfo, getFileTypeVersion, getStructureIterator, readSection, readToByteChannel, sendIospMessage, sync, syncExtend, toStringDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gradsDDF

protected GradsDataDescriptorFile gradsDDF
GrADS file reader

Constructor Detail

GradsBinaryGridServiceProvider

public GradsBinaryGridServiceProvider()
Method Detail

isValidFile

public boolean isValidFile(RandomAccessFile raf)
                    throws IOException
Is this a valid file? For this GrADS IOSP, the valid file must be:

Parameters:
raf - RandomAccessFile to check
Returns:
true if a valid GrADS grid file of the type listed above
Throws:
IOException - problem reading file

getFileTypeId

public String getFileTypeId()
Get the file type id

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

getFileTypeDescription

public String getFileTypeDescription()
Get the file type description

Returns:
the file type description
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 AbstractIOServiceProvider
Parameters:
raf - file to read from
ncfile - netCDF file we are writing to (memory)
cancelTask - task for cancelling
Throws:
IOException - problem reading file

buildNCFile

protected void buildNCFile()
                    throws IOException
Build the netCDF file

Throws:
IOException - problem reading the file

close

public void close()
           throws IOException
Close this IOSP and associated files

Specified by:
close in interface IOServiceProvider
Overrides:
close in class AbstractIOServiceProvider
Throws:
IOException - problem closing files

readData

public Array readData(Variable v2,
                      Section section)
               throws IOException,
                      InvalidRangeException
Read the data for the variable

Parameters:
v2 - Variable to read
section - section infomation
Returns:
Array of data
Throws:
IOException - problem reading from file
InvalidRangeException - invalid Range
See Also:
Range


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