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.
NetCDFImageReaderis aImageReaderable to createRenderedImagefrom 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 voidaddFile(String filePath)Add a file to the file set managervoiddispose()protected voidfinalize()protected static voidflipVertically(ImageReadParam param, int srcHeight, Rectangle srcRegion)protected VariableAdaptergetCoverageDescriptor(int imageIndex)Return theVariableWrapperrelated to that imageIndexVariableAdaptergetCoverageDescriptor(Name name)List<Name>getCoveragesNames()Return the name of coverages made available by this providerintgetCoveragesNumber()The number of coverages made available by this provider.intgetHeight(int imageIndex)IIOMetadatagetImageMetadata(int imageIndex)RasterLayerRequestgetImageMosaicRequest()Iterator<ImageTypeSpecifier>getImageTypes(int imageIndex)SimpleFeatureTypegetIndexSchema(Name coverageName, CoordinateSystem cs)SimpleFeatureTypegetIndexSchema(Name coverageName, CoordinateSystem coordinateSystem, boolean isShared)Slice2DIndexgetSlice2DIndex(int imageIndex)Return theSlice2DIndexassociated to the specified imageIndexVariablegetVariableByName(String varName)Get aVariableby name.intgetWidth(int imageIndex)protected intinitIndex()Index Initialization. store indexing information.List<String>list()Return the list of all the files currently added to the managerprotected IIOExceptionnetcdfFailure(Exception e)Wraps a generic exception into aIIOException.voidpurge()Remove all the files from the manager (An implementation may also physically remove all the files)BufferedImageread(int imageIndex, ImageReadParam param)voidremoveFile(String filePath)Remove a file from the manager (An implementation may also physically remove the file)voidreset()Reset the status of this readervoidsetInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)protected voidsetNumImages(int numImages)voidsetRasterLayerRequest(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:GeoSpatialImageReaderReturn the name of coverages made available by this provider- Specified by:
getCoveragesNamesin classGeoSpatialImageReader
-
getCoveragesNumber
public int getCoveragesNumber()
Description copied from class:GeoSpatialImageReaderThe number of coverages made available by this provider.- Specified by:
getCoveragesNumberin classGeoSpatialImageReader
-
setNumImages
protected void setNumImages(int numImages)
-
getHeight
public int getHeight(int imageIndex) throws IOException- Specified by:
getHeightin classImageReader- Throws:
IOException
-
getImageTypes
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) throws IOException
- Specified by:
getImageTypesin classImageReader- Throws:
IOException
-
getWidth
public int getWidth(int imageIndex) throws IOException- Specified by:
getWidthin classImageReader- Throws:
IOException
-
getVariableByName
public Variable getVariableByName(String varName)
Get aVariableby name.- Parameters:
varName- the name of theVariableto pick.- Returns:
- the variable or
null.
-
reset
public void reset()
Reset the status of this reader- Overrides:
resetin classImageReader
-
setInput
public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
- Overrides:
setInputin classImageReader
-
initIndex
protected int initIndex() throws InvalidRangeException, IOExceptionIndex Initialization. store indexing information.- Throws:
InvalidRangeExceptionIOException
-
dispose
public void dispose()
- Overrides:
disposein classGeoSpatialImageReader
-
finalize
protected void finalize() throws Throwable- Overrides:
finalizein 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 theSlice2DIndexassociated to the specified imageIndex- Throws:
IOException
-
getCoverageDescriptor
protected VariableAdapter getCoverageDescriptor(int imageIndex)
Return theVariableWrapperrelated to that imageIndex
-
getCoverageDescriptor
public VariableAdapter getCoverageDescriptor(Name name)
- Specified by:
getCoverageDescriptorin classGeoSpatialImageReader
-
read
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException
- Specified by:
readin 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:FileSetManagerAdd a file to the file set manager- Specified by:
addFilein interfaceFileSetManager
-
list
public List<String> list()
Description copied from interface:FileSetManagerReturn the list of all the files currently added to the manager- Specified by:
listin interfaceFileSetManager
-
removeFile
public void removeFile(String filePath)
Description copied from interface:FileSetManagerRemove a file from the manager (An implementation may also physically remove the file)- Specified by:
removeFilein interfaceFileSetManager
-
purge
public void purge()
Description copied from interface:FileSetManagerRemove all the files from the manager (An implementation may also physically remove all the files)- Specified by:
purgein interfaceFileSetManager
-
getImageMetadata
public IIOMetadata getImageMetadata(int imageIndex) throws IOException
- Overrides:
getImageMetadatain classGeoSpatialImageReader- Throws:
IOException
-
-