Package ucar.nc2.iosp.grads
Class GradsBinaryGridServiceProvider
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.grads.GradsBinaryGridServiceProvider
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,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. Notes jcaron Apparently we need the control file (.ctl), which then references the data file (.dat) Dont see any test data - added to cdmUnitTest/formats/grads Possible File leaks - remove from standard IOSP's until we can resolve this. Also need to override release, reacquire- See Also:
- "http://www.iges.org/grads/gadoc/descriptorfile.html", "http://www.iges.org/grads/gadoc/aboutgriddeddata.html"
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Field Summary
Fields Modifier and Type Field Description protected GradsDataDescriptorFile
gradsDDF
GrADS file reader-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description GradsBinaryGridServiceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildNCFile()
Build the netCDF filevoid
close()
Close this IOSP and associated filesString
getFileTypeDescription()
Get the file type descriptionString
getFileTypeId()
Get the file type idboolean
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
build, buildFinish, getDetailInfo, getFileTypeVersion, getLastModified, getStructureIterator, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, sendIospMessage, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
compareTo, getSortGroup
-
-
-
-
Field Detail
-
gradsDDF
protected GradsDataDescriptorFile gradsDDF
GrADS file reader
-
-
Method Detail
-
isValidFile
public boolean isValidFile(RandomAccessFile raf) throws IOException
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)
- 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:
- "https://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:
- "https://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 interfaceIOServiceProvider
- Overrides:
open
in classAbstractIOServiceProvider
- Parameters:
raf
- file to read fromncfile
- netCDF file we are writing to (memory)cancelTask
- task for cancelling- Throws:
IOException
- problem reading file
-
buildNCFile
protected void buildNCFile()
Build the netCDF file
-
close
public void close() throws IOException
Close this IOSP and associated files- Specified by:
close
in interfaceIOServiceProvider
- Overrides:
close
in classAbstractIOServiceProvider
- 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 readsection
- section infomation- Returns:
- Array of data
- Throws:
IOException
- problem reading from fileInvalidRangeException
- invalid Range- See Also:
Range
-
-