Package ucar.nc2.grib.collection
Class GribIosp
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.grib.collection.GribIosp
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,IOServiceProvider
public abstract class GribIosp extends AbstractIOServiceProvider
Grib Collection IOSP, version 2. Handles both collections and single GRIB files. Immutable after open() is called.- Since:
- 4/6/11
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Field Summary
Fields Modifier and Type Field Description protected FeatureCollectionConfig
config
static int
debugIndexOnlyCount
protected GribCollectionImmutable.GroupGC
gHcs
protected GribCollectionImmutable
gribCollection
protected GribTables
gribTable
protected GribCollectionImmutable.Type
gtype
protected boolean
isGrib1
protected boolean
isPartitioned
protected org.slf4j.Logger
logger
protected boolean
owned
-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description GribIosp(boolean isGrib1, org.slf4j.Logger logger)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
build(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask)
Open existing file, and populate it.abstract void
clearLastRecordRead()
void
close()
Close the file.protected abstract GribTables
createCustomizer()
String
getDetailInfo()
Show debug / underlying implementation detailsabstract Object
getGribCustomizer()
abstract Object
getLastRecordRead()
protected abstract GribTables.Parameter
getParameter(GribCollectionImmutable.VariableIndex vindex)
protected abstract String
getVerticalCoordDesc(int vc_code)
boolean
isBuilder()
If this iosp implements build().protected abstract String
makeVariableLongName(GribCollectionImmutable.VariableIndex vindex)
protected abstract String
makeVariableName(GribCollectionImmutable.VariableIndex vindex)
protected abstract String
makeVariableUnits(GribCollectionImmutable.VariableIndex vindex)
void
open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
Open existing file, and populate ncfile with it.Array
readData(Variable v2, Section section)
Read data from a top level Variable and return a memory resident Array.Object
sendIospMessage(Object special)
A way to communicate arbitrary information to and from an iosp.void
setLookupTablePath(String lookupTablePath)
void
setParamTable(org.jdom2.Element paramTable)
void
setParamTablePath(String paramTablePath)
-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
buildFinish, getFileTypeVersion, getLastModified, getStructureIterator, reacquire, readSection, readToByteChannel, readToOutputStream, release, 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, getFileTypeDescription, getFileTypeId, getSortGroup, isValidFile
-
-
-
-
Field Detail
-
debugIndexOnlyCount
public static int debugIndexOnlyCount
-
config
protected final FeatureCollectionConfig config
-
isGrib1
protected final boolean isGrib1
-
logger
protected final org.slf4j.Logger logger
-
gribCollection
protected GribCollectionImmutable gribCollection
-
gHcs
protected GribCollectionImmutable.GroupGC gHcs
-
gtype
protected GribCollectionImmutable.Type gtype
-
isPartitioned
protected boolean isPartitioned
-
owned
protected boolean owned
-
gribTable
protected GribTables gribTable
-
-
Method Detail
-
setParamTable
public void setParamTable(org.jdom2.Element paramTable)
-
setLookupTablePath
public void setLookupTablePath(String lookupTablePath)
-
setParamTablePath
public void setParamTablePath(String paramTablePath)
-
sendIospMessage
@Nullable public Object sendIospMessage(Object special)
Description copied from interface:IOServiceProvider
A way to communicate arbitrary information to and from an iosp.- Specified by:
sendIospMessage
in interfaceIOServiceProvider
- Overrides:
sendIospMessage
in classAbstractIOServiceProvider
- Parameters:
special
- opaque message sent to the IOSP object when its opened (not when isValidFile() is called)- Returns:
- opaque Object, may be null.
-
createCustomizer
protected abstract GribTables createCustomizer() throws IOException
- Throws:
IOException
-
makeVariableName
protected abstract String makeVariableName(GribCollectionImmutable.VariableIndex vindex)
-
makeVariableLongName
protected abstract String makeVariableLongName(GribCollectionImmutable.VariableIndex vindex)
-
makeVariableUnits
protected abstract String makeVariableUnits(GribCollectionImmutable.VariableIndex vindex)
-
getVerticalCoordDesc
protected abstract String getVerticalCoordDesc(int vc_code)
-
getParameter
protected abstract GribTables.Parameter getParameter(GribCollectionImmutable.VariableIndex vindex)
-
isBuilder
public boolean isBuilder()
Description copied from interface:IOServiceProvider
If this iosp implements build().- Specified by:
isBuilder
in interfaceIOServiceProvider
- Overrides:
isBuilder
in classAbstractIOServiceProvider
-
build
public void build(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask) throws IOException
Description copied from interface:IOServiceProvider
Open existing file, and populate it. Note that you cannot reference the NetcdfFile within this routine. This is the bridge to immutable objects that will be used exclusively in version 6.- Specified by:
build
in interfaceIOServiceProvider
- Overrides:
build
in classAbstractIOServiceProvider
- Parameters:
raf
- the file to work on, it has already passed the isValidFile() test.rootGroup
- add objects to the root group.cancelTask
- used to monitor user cancellation; may be null.- Throws:
IOException
- if read error
-
open
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Description copied from interface:IOServiceProvider
Open existing file, and populate ncfile with it. This method is only called by the NetcdfFile constructor on itself. The provided NetcdfFile object will be empty except for the location String and the IOServiceProvider associated with this NetcdfFile object.- Specified by:
open
in interfaceIOServiceProvider
- Overrides:
open
in classAbstractIOServiceProvider
- Parameters:
raf
- the file to work on, it has already passed the isValidFile() test.ncfile
- add objects to this empty NetcdfFilecancelTask
- used to monitor user cancellation; may be null.- Throws:
IOException
- if read error
-
close
public void close() throws IOException
Description copied from interface:IOServiceProvider
Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it), and to free any other resources it has used.- Specified by:
close
in interfaceIOServiceProvider
- Overrides:
close
in classAbstractIOServiceProvider
- Throws:
IOException
- if read error
-
getDetailInfo
public String getDetailInfo()
Description copied from interface:IOServiceProvider
Show debug / underlying implementation details- Specified by:
getDetailInfo
in interfaceIOServiceProvider
- Overrides:
getDetailInfo
in classAbstractIOServiceProvider
- Returns:
- debug info
-
readData
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException
Description copied from interface:IOServiceProvider
Read data from a top level Variable and return a memory resident Array. This Array has the same element type as the Variable, and the requested shape.- Parameters:
v2
- a top-level Variablesection
- the section of data to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed. IOSP may not modify.- Returns:
- the requested data in a memory-resident Array
- Throws:
IOException
- if read errorInvalidRangeException
- if invalid section- See Also:
Range
-
getLastRecordRead
public abstract Object getLastRecordRead()
-
clearLastRecordRead
public abstract void clearLastRecordRead()
-
getGribCustomizer
public abstract Object getGribCustomizer()
-
-