Package org.geotools.imageio.netcdf
Class NetCDFImageReader
- Object
-
- ImageReader
-
- GeoSpatialImageReader
-
- NetCDFImageReader
-
- All Implemented Interfaces:
InitializingReader
,FileSetManager
public class NetCDFImageReader extends GeoSpatialImageReader implements FileSetManager
Base implementation for NetCDF-CF image flat reader. Pixels are assumed organized according the COARDS convention (a precursor of CF Metadata conventions), i.e. in (t,z,y,x) order, where x varies faster. The image is created from the two last dimensions (x,y).Each ImageIndex corresponds to a 2D-slice of NetCDF.
NetCDFImageReader
is aImageReader
able to createRenderedImage
from NetCDF-CF sources.- Author:
- Alessio Fabiani, GeoSolutions, Simone Giannecchini, GeoSolutions
-
-
Field Summary
-
Fields inherited from class GeoSpatialImageReader
file, numImages
-
Fields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
-
-
Constructor Summary
Constructors Constructor Description NetCDFImageReader(ImageReaderSpi originatingProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFile(String filePath)
Add a file to the file set managervoid
dispose()
protected void
finalize()
protected static void
flipVertically(ImageReadParam param, int srcHeight, Rectangle srcRegion)
protected VariableAdapter
getCoverageDescriptor(int imageIndex)
Return theVariableWrapper
related to that imageIndexVariableAdapter
getCoverageDescriptor(Name name)
List<Name>
getCoveragesNames()
Return the name of coverages made available by this providerint
getCoveragesNumber()
The number of coverages made available by this provider.int
getHeight(int imageIndex)
IIOMetadata
getImageMetadata(int imageIndex)
RasterLayerRequest
getImageMosaicRequest()
Iterator<ImageTypeSpecifier>
getImageTypes(int imageIndex)
SimpleFeatureType
getIndexSchema(Name coverageName, CoordinateSystem cs)
SimpleFeatureType
getIndexSchema(Name coverageName, CoordinateSystem coordinateSystem, boolean isShared)
Slice2DIndex
getSlice2DIndex(int imageIndex)
Return theSlice2DIndex
associated to the specified imageIndexVariable
getVariableByName(String varName)
Get aVariable
by name.int
getWidth(int imageIndex)
protected int
initIndex()
Index Initialization. store indexing information.List<String>
list()
Return the list of all the files currently added to the managerprotected IIOException
netcdfFailure(Exception e)
Wraps a generic exception into aIIOException
.void
purge()
Remove all the files from the manager (An implementation may also physically remove all the files)BufferedImage
read(int imageIndex, ImageReadParam param)
void
removeFile(String filePath)
Remove a file from the manager (An implementation may also physically remove the file)void
reset()
Reset the status of this readervoid
setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
protected void
setNumImages(int numImages)
void
setRasterLayerRequest(RasterLayerRequest request)
-
Methods inherited from class GeoSpatialImageReader
checkImageIndex, getAuxiliaryDatastorePath, getAuxiliaryFilesPath, getCatalog, getImageIndex, getNumImages, getStreamMetadata, init, initCatalog, setAuxiliaryDatastorePath, setAuxiliaryFilesPath, setCatalog, setRepository
-
Methods inherited from class ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
-
-
-
Constructor Detail
-
NetCDFImageReader
public NetCDFImageReader(ImageReaderSpi originatingProvider)
-
-
Method Detail
-
setRasterLayerRequest
public void setRasterLayerRequest(RasterLayerRequest request)
-
getImageMosaicRequest
public RasterLayerRequest getImageMosaicRequest()
-
getCoveragesNames
public List<Name> getCoveragesNames()
Description copied from class:GeoSpatialImageReader
Return the name of coverages made available by this provider- Specified by:
getCoveragesNames
in classGeoSpatialImageReader
-
getCoveragesNumber
public int getCoveragesNumber()
Description copied from class:GeoSpatialImageReader
The number of coverages made available by this provider.- Specified by:
getCoveragesNumber
in classGeoSpatialImageReader
-
setNumImages
protected void setNumImages(int numImages)
-
getHeight
public int getHeight(int imageIndex) throws IOException
- Specified by:
getHeight
in classImageReader
- Throws:
IOException
-
getImageTypes
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
getWidth
public int getWidth(int imageIndex) throws IOException
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getVariableByName
public Variable getVariableByName(String varName)
Get aVariable
by name.- Parameters:
varName
- the name of theVariable
to pick.- Returns:
- the variable or
null
.
-
reset
public void reset()
Reset the status of this reader- Overrides:
reset
in classImageReader
-
setInput
public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
- Overrides:
setInput
in classImageReader
-
initIndex
protected int initIndex() throws InvalidRangeException, IOException
Index Initialization. store indexing information.- Throws:
InvalidRangeException
IOException
-
dispose
public void dispose()
- Overrides:
dispose
in classGeoSpatialImageReader
-
finalize
protected void finalize() throws Throwable
- Overrides:
finalize
in classGeoSpatialImageReader
- Throws:
Throwable
-
netcdfFailure
protected IIOException netcdfFailure(Exception e) throws IOException
Wraps a generic exception into aIIOException
.- Throws:
IOException
-
getSlice2DIndex
public Slice2DIndex getSlice2DIndex(int imageIndex) throws IOException
Return theSlice2DIndex
associated to the specified imageIndex- Throws:
IOException
-
getCoverageDescriptor
protected VariableAdapter getCoverageDescriptor(int imageIndex)
Return theVariableWrapper
related to that imageIndex
-
getCoverageDescriptor
public VariableAdapter getCoverageDescriptor(Name name)
- Specified by:
getCoverageDescriptor
in classGeoSpatialImageReader
-
read
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException
- Specified by:
read
in classImageReader
- Throws:
IOException
- See Also:
ImageReader.read(int, javax.imageio.ImageReadParam)
-
flipVertically
protected static void flipVertically(ImageReadParam param, int srcHeight, Rectangle srcRegion)
-
getIndexSchema
public SimpleFeatureType getIndexSchema(Name coverageName, CoordinateSystem cs) throws Exception
- Throws:
Exception
-
getIndexSchema
public SimpleFeatureType getIndexSchema(Name coverageName, CoordinateSystem coordinateSystem, boolean isShared) throws Exception
- Throws:
Exception
-
addFile
public void addFile(String filePath)
Description copied from interface:FileSetManager
Add a file to the file set manager- Specified by:
addFile
in interfaceFileSetManager
-
list
public List<String> list()
Description copied from interface:FileSetManager
Return the list of all the files currently added to the manager- Specified by:
list
in interfaceFileSetManager
-
removeFile
public void removeFile(String filePath)
Description copied from interface:FileSetManager
Remove a file from the manager (An implementation may also physically remove the file)- Specified by:
removeFile
in interfaceFileSetManager
-
purge
public void purge()
Description copied from interface:FileSetManager
Remove all the files from the manager (An implementation may also physically remove all the files)- Specified by:
purge
in interfaceFileSetManager
-
getImageMetadata
public IIOMetadata getImageMetadata(int imageIndex) throws IOException
- Overrides:
getImageMetadata
in classGeoSpatialImageReader
- Throws:
IOException
-
-