public class NCCachedGrid extends CachedGrid
NCCachedGrid
class is a cached grid that understands how to
read variable data from NetCDF files.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_SIZE
Default cache size in bytes.
|
static int |
DEFAULT_TILE_SIZE
Default tile size in bytes.
|
accessMode, DEFAULT_MAX_TILES, DEFAULT_TILE_DIMS, READ_ONLY, READ_WRITE, tiling
data, dims, isUnsigned, lookup, unsignedType
Constructor and Description |
---|
NCCachedGrid(Grid grid,
NCReader reader)
Constructs a new read-only NetCDF cached grid with the specified
properties.
|
NCCachedGrid(Grid grid,
NCReader reader,
int[] start)
Constructs a new read-only NetCDF cached grid with the specified
properties.
|
NCCachedGrid(Grid grid,
NCReader reader,
java.lang.String ncVarName,
int[] start)
Constructs a new read-only NetCDF cached grid with the specified
properties.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
getDataClass()
Gets the data class.
|
java.lang.Object |
getDataStream()
Gets the cache data stream as an object.
|
static void |
main(java.lang.String[] argv)
TESTING: Traverses an HDF file's structure and prints out dataset
information.
|
protected TilingScheme.Tile |
readTile(TilingScheme.TilePosition pos)
Reads the specified tile.
|
void |
setTileDims(int[] dims)
Creates a new cache where each tile has the specified dimensions.
|
protected void |
writeTile(TilingScheme.Tile tile)
Writes the specified tile.
|
flush, getCoveringPositions, getData, getData, getMaxTiles, getTileDims, getTileSize, getTilingScheme, getValue, getValue, resetCache, setCacheSize, setData, setData, setMaxTiles, setOptimizedCacheSize, setTileSize, setValue, setValue
arraycopy, checkSubset, getNavigation, getSubset, getValue, interpolate, navigate, setNavigation, setValue
convertUnits, dispose, format, format, format, getClassBits, getDecimals, getDimensions, getFormat, getLongName, getMissing, getName, getOptimalStride, getRank, getScaling, getStatistics, getStatistics, getStatistics, getStatistics, getUnits, getUnsigned, getValue, getValues, setAccessHint, setFormat, setLongName, setLookup, setMissing, setName, setUnits, setUnsigned, setValue, toString
clone, getMetadataMap
public static final int DEFAULT_TILE_SIZE
public static final int DEFAULT_CACHE_SIZE
public NCCachedGrid(Grid grid, NCReader reader, java.lang.String ncVarName, int[] start) throws java.io.IOException
grid
- the grid to use for attributes. In this constructor, the
grid name is not used as the NetCDF variable name.reader
- the NetCDF reader data source.ncVarName
- the NetCDF variable name to read data from.start
- the starting coordinates to read data from. This array
should have the same rank as the NetCDF variable, and have values
filled in for all dimensions _except_ row and column, which should have
-1 as the value. The row and column dimensions are assumed to be
adjacent to each other and row to be the first dimension, and then
column to be the second dimension. For example if the dimensions are
[time, level, row, column], then the start array could be [0, 0, -1, -1]
to select the first time and level index.java.io.IOException
- if a problem occurred accessing the NetCDF file.NCCachedGrid(Grid,NCReader,int[])
public NCCachedGrid(Grid grid, NCReader reader, int[] start) throws java.io.IOException
grid
- the grid to use for attributes.reader
- the NetCDF reader data source.start
- the starting coordinates to read data from. This array
should have the same rank as the NetCDF variable, and have values
filled in for all dimensions _except_ row and column, which should have
-1 as the value. The row and column dimensions are assumed to be
adjacent to each other and row to be the first dimension, and then
column to be the second dimension. For example if the dimensions are
[time, level, row, column], then the start array could be [0, 0, -1, -1]
to select the first time and level index.java.io.IOException
- if a problem occurred accessing the NetCDF file.public NCCachedGrid(Grid grid, NCReader reader) throws java.io.IOException
grid
- the grid to use for attributes.reader
- the NetCDF reader data source.java.io.IOException
- if a problem occurred accessing the NetCDF file.public java.lang.Class getDataClass()
getDataClass
in class DataVariable
public java.lang.Object getDataStream()
CachedGrid
getDataStream
in class CachedGrid
public void setTileDims(int[] dims)
setTileDims
in class CachedGrid
dims
- the tile dimensions as [rows, columns].protected TilingScheme.Tile readTile(TilingScheme.TilePosition pos) throws java.io.IOException
CachedGrid
readTile
in class CachedGrid
pos
- the tile position to read.java.io.IOException
- if an error occurred reading the tile data.protected void writeTile(TilingScheme.Tile tile) throws java.io.IOException
CachedGrid
writeTile
in class CachedGrid
tile
- the tile to write.java.io.IOException
- if an error occurred writing the tile data.public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception