Package ucar.nc2.iosp.grid
Class GridServiceProvider
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.grid.GridServiceProvider
-
- All Implemented Interfaces:
ucar.nc2.iosp.IOServiceProvider
- Direct Known Subclasses:
GempakGridServiceProvider,McIDASGridServiceProvider
public abstract class GridServiceProvider extends ucar.nc2.iosp.AbstractIOServiceProviderSuperclass for Gempak grid, MciDAS grid
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridServiceProvider.IndexExtendMode
-
Field Summary
Fields Modifier and Type Field Description protected static booleanaddLatLonprotected static booleanalwaysInCachestatic booleandebugMissingdebug flagsstatic booleandebugMissingDetailsdebug flagsstatic booleandebugOpendebug flagsstatic booleandebugProjdebug flagsstatic booleandebugTimingdebug flagsstatic booleandebugVertdebug flagsprotected static booleanforceNewIndexprotected static GridServiceProvider.IndexExtendModeindexFileModeOnOpenprotected static GridServiceProvider.IndexExtendModeindexFileModeOnSync
-
Constructor Summary
Constructors Constructor Description GridServiceProvider()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract float[]_readData(GridRecord gr)Read the data for this GridRecordstatic voidforceNewIndex(boolean b)Set whether to force new index or notbooleanisMissingXY(ucar.nc2.Variable v2, int timeIdx, int ensIdx, int levIdx)Is this XY level missing?protected abstract voidopen(GridIndex index, ucar.nc2.util.CancelTask cancelTask)Use the given index to fill the NetcdfFile object with attributes and variables.voidopen(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask)Open the service provider for reading.ucar.ma2.ArrayreadData(ucar.nc2.Variable v2, ucar.ma2.Section section)Read the data for the variablestatic voidsetDebugFlags(ucar.nc2.util.DebugFlags debugFlag)Set the debug flagsstatic voidsetExtendIndex(boolean b)Deprecated.use setIndexFileModeOnSync and setIndexFileModeOnOpenstatic voidsetIndexAlwaysInCache(boolean b)Set disk cache policy for index files.static voidsetIndexFileModeOnOpen(GridServiceProvider.IndexExtendMode mode)This controls what happens when a GRIB file is opened, and the data file has changed since the index was written.static voidsetIndexFileModeOnSync(GridServiceProvider.IndexExtendMode mode)This controls what happens when a GRIB file is synced (usually from FileCache), and the data or index file has changed since the file was placed in the cache.-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
build, buildFinish, close, getDetailInfo, getFileTypeVersion, getLastModified, getStructureIterator, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, sendIospMessage, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
-
-
-
-
Field Detail
-
indexFileModeOnOpen
protected static GridServiceProvider.IndexExtendMode indexFileModeOnOpen
-
indexFileModeOnSync
protected static GridServiceProvider.IndexExtendMode indexFileModeOnSync
-
addLatLon
protected static boolean addLatLon
-
forceNewIndex
protected static boolean forceNewIndex
-
alwaysInCache
protected static boolean alwaysInCache
-
debugOpen
public static boolean debugOpen
debug flags
-
debugMissing
public static boolean debugMissing
debug flags
-
debugMissingDetails
public static boolean debugMissingDetails
debug flags
-
debugProj
public static boolean debugProj
debug flags
-
debugTiming
public static boolean debugTiming
debug flags
-
debugVert
public static boolean debugVert
debug flags
-
-
Method Detail
-
forceNewIndex
public static void forceNewIndex(boolean b)
Set whether to force new index or not- Parameters:
b- true to use
-
setDebugFlags
public static void setDebugFlags(ucar.nc2.util.DebugFlags debugFlag)
Set the debug flags- Parameters:
debugFlag- debug flags
-
setIndexFileModeOnOpen
public static void setIndexFileModeOnOpen(GridServiceProvider.IndexExtendMode mode)
This controls what happens when a GRIB file is opened, and the data file has changed since the index was written.- IndexExtendMode.extendwrite: when GRIB file length increases, extend the index. This is the case when the file is being appended to, as new data arrives.
- IndexExtendMode.rewrite: when GRIB file length changes, rewrite the index. This is the safest thing to do, at the expense of performance.
- IndexExtendMode.readonly: never modify an existing index, just use it. However, if there is no index, created one
- Parameters:
mode- IndexExtendMode when file is opened
-
setIndexFileModeOnSync
public static void setIndexFileModeOnSync(GridServiceProvider.IndexExtendMode mode)
This controls what happens when a GRIB file is synced (usually from FileCache), and the data or index file has changed since the file was placed in the cache.- IndexExtendMode.extendwrite: when GRIB file or index length increases, extend the index. If file or index length decreases, rewrite it.
- IndexExtendMode.rewrite: when GRIB file length changes, rewrite the index.
- IndexExtendMode.readonly: never modify an existing index, just use it. However, if there is no index, created one
- Parameters:
mode- IndexExtendMode when file is opened
-
setExtendIndex
public static void setExtendIndex(boolean b)
Deprecated.use setIndexFileModeOnSync and setIndexFileModeOnOpenSet how indexes are used for both open and sync- Parameters:
b- if true, set modes to IndexExtendMode.extendwrite, else IndexExtendMode.readonly
-
setIndexAlwaysInCache
public static void setIndexAlwaysInCache(boolean b)
Set disk cache policy for index files. Default = false, meaning try to write index files in same directory as grib file. True means always use the DiskCache area. TDS sets this to true, so it wont interfere with external indexer.- Parameters:
b- set to this value
-
open
protected abstract void open(GridIndex index, ucar.nc2.util.CancelTask cancelTask) throws IOException
Use the given index to fill the NetcdfFile object with attributes and variables.- Parameters:
index- GridIndex to usecancelTask- cancel task- Throws:
IOException- problem reading the file
-
open
public void open(ucar.unidata.io.RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask) throws IOExceptionOpen the service provider for reading.- Specified by:
openin interfaceucar.nc2.iosp.IOServiceProvider- Overrides:
openin classucar.nc2.iosp.AbstractIOServiceProvider- Parameters:
raf- file to read fromncfile- netCDF file we are writing to (memory)cancelTask- task for cancelling- Throws:
IOException- problem reading file
-
readData
public ucar.ma2.Array readData(ucar.nc2.Variable v2, ucar.ma2.Section section) throws IOException, ucar.ma2.InvalidRangeExceptionRead the data for the variable- Parameters:
v2- Variable to readsection- section infomation- Returns:
- Array of data
- Throws:
IOException- problem reading from fileucar.ma2.InvalidRangeException- invalid Range
-
isMissingXY
public boolean isMissingXY(ucar.nc2.Variable v2, int timeIdx, int ensIdx, int levIdx) throws ucar.ma2.InvalidRangeExceptionIs this XY level missing?- Parameters:
v2- VariabletimeIdx- time indexensIdx- ensemble indexlevIdx- level index- Returns:
- true if missing
- Throws:
ucar.ma2.InvalidRangeException- invalid range
-
_readData
protected abstract float[] _readData(GridRecord gr) throws IOException
Read the data for this GridRecord- Parameters:
gr- grid identifier- Returns:
- the data (or null)
- Throws:
IOException- problem reading the data
-
-