| org.geotools.image.io.FileImageReader org.geotools.image.io.netcdf.NetcdfImageReader
NetcdfImageReader | public class NetcdfImageReader extends FileImageReader implements CancelTask(Code) | | Base implementation for NetCDF image 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).
Additional dimensions (if any) are handled as below in the default implementation:
Example:
Assuming that:
- None of the above methods has been invoked
- Axis are (t,z,y,x)
Then the users can select the z value using
ImageReadParam.setSourceBands .
If no band is selected, then the default selection is the first band (0) only. Note that this
is different than the usual Image I/O default, which is all bands.
Connection to DODS servers
This image reader accepts
File and
URL inputs. In the later case, if and only
if the URL uses the DODS protocol (as in "
dods://opendap.aviso.oceanobs.com/ "), then
this image reader tries to connect to the DODS remote server. Otherwise the URL content is
copied in a temporary file.
since: 2.4 version: $Id: NetcdfImageReader.java 27762 2007-11-05 21:11:12Z desruisseaux $ author: Antoine Hnawia author: Martin Desruisseaux |
Field Summary | |
protected Variable | variable The data from the NetCDF file. |
Constructor Summary | |
public | NetcdfImageReader(Spi spi) Constructs a new NetCDF reader. |
Method Summary | |
protected void | close() Closes the NetCDF file. | protected IIOMetadata | createMetadata(NetcdfDataset file) Creates metadata for the specified NetCDF file. | protected IIOMetadata | createMetadata(VariableDS variable) Creates metadata for the specified NetCDF variable. | protected Variable | findVariable(String name) Returns the variable of the given name. | public ImageReadParam | getDefaultReadParam() Returns parameters initialized with default values appropriate for this format. | public int | getHeight(int imageIndex) Returns the image height. | public IIOMetadata | getImageMetadata(int imageIndex) Returns the metadata associated with the image at the specified index. | public int | getNumImages(boolean allowSearch) Returns the number of images available from the current input source. | protected int | getRawDataType(int imageIndex) Returns the data type which most closely represents the "raw" internal data of the image.
Parameters: imageIndex - The index of the image to be queried. | public Statistics | getStatistics(int imageIndex) Returns statistics about the sample values in the specified image. | public IIOMetadata | getStreamMetadata() Returns the metadata associated with the input source as a whole. | public String[] | getVariables() Returns the names of the variables to be read. | public int | getWidth(int imageIndex) Returns the image width. | public boolean | isCancel() Invoked by the NetCDF library during read operation in order to check if the task has
been canceled. | protected boolean | prepareVariable(int imageIndex) Ensures that data are loaded in the NetCDF
. | public BufferedImage | read(int imageIndex, ImageReadParam param) Creates an image from the specified parameters. | public void | setError(String message) Invoked by the NetCDF library when an error occured during the read operation. | public void | setVariables(String[] variableNames) Sets the name of the
to be read in a NetCDF file. |
variable | protected Variable variable(Code) | | The data from the NetCDF file. The value for this field is set by
NetcdfImageReader.prepareVariable when first needed. This is typically (but not necessarly) an instance of
VariableDS .
|
NetcdfImageReader | public NetcdfImageReader(Spi spi)(Code) | | Constructs a new NetCDF reader.
Parameters: spi - The service provider. |
createMetadata | protected IIOMetadata createMetadata(NetcdfDataset file) throws IOException(Code) | | Creates metadata for the specified NetCDF file. This method is invoked automatically
by
NetcdfImageReader.getStreamMetadata when first needed. The default implementation returns an
instance of
NetcdfMetadata . Subclasses can override this method in order to create
a more specific set of metadata.
|
createMetadata | protected IIOMetadata createMetadata(VariableDS variable) throws IOException(Code) | | Creates metadata for the specified NetCDF variable. This method is invoked automatically
by
NetcdfImageReader.getImageMetadata when first needed. The default implementation returns an
instance of
NetcdfMetadata . Subclasses can override this method in order to create
a more specific set of metadata.
|
findVariable | protected Variable findVariable(String name) throws IOException(Code) | | Returns the variable of the given name. This method is similar to
NetcdfDataset.findVariable(String) except that the search
is case-insensitive and an exception is thrown if no variable has
been found for the given name.
Parameters: name - The name of the variable to search. The variable for the given name. throws: IIOException - if no variable has been found for the given name. throws: IOException - If the operation failed because of an I/O error. |
getDefaultReadParam | public ImageReadParam getDefaultReadParam()(Code) | | Returns parameters initialized with default values appropriate for this format.
Parameters which may be used to control the decoding process using a setof default settings. |
getHeight | public int getHeight(int imageIndex) throws IOException(Code) | | Returns the image height.
|
getImageMetadata | public IIOMetadata getImageMetadata(int imageIndex) throws IOException(Code) | | Returns the metadata associated with the image at the specified index.
|
getRawDataType | protected int getRawDataType(int imageIndex) throws IOException(Code) | | Returns the data type which most closely represents the "raw" internal data of the image.
Parameters: imageIndex - The index of the image to be queried. The data type, or DataBuffer.TYPE_UNDEFINED if unknown. throws: IOException - If an error occurs reading the format information from the input source. |
getStatistics | public Statistics getStatistics(int imageIndex) throws IOException(Code) | | Returns statistics about the sample values in the specified image. This is for informative
purpose only and may be used when the
do not provides
useful information about valid minimum and maximum values. Note that this method requires a
full scan of image data and may be slow.
Parameters: imageIndex - The index of the image to analyze. Statistics on the sample values in the given image. throws: IOException - if an I/O error occured while reading the sample values. |
getStreamMetadata | public IIOMetadata getStreamMetadata() throws IOException(Code) | | Returns the metadata associated with the input source as a whole.
|
getVariables | public String[] getVariables() throws IOException(Code) | | Returns the names of the variables to be read. The first name is assigned to image
index 0, the second name to image index 1, etc.. In other words a call
to
(imageIndex) will read the variable names
variables[imageIndex] where
variables is the value returned by this
method.
The sequence of variable to be read can be changed by a call to
NetcdfImageReader.setVariables .
The name of the variables to be read. throws: IOException - if the NetCDF file can not be read. |
getWidth | public int getWidth(int imageIndex) throws IOException(Code) | | Returns the image width.
|
isCancel | public boolean isCancel()(Code) | | Invoked by the NetCDF library during read operation in order to check if the task has
been canceled. Users should not invoke this method directly.
|
prepareVariable | protected boolean prepareVariable(int imageIndex) throws IOException(Code) | | Ensures that data are loaded in the NetCDF
. If data are already
loaded, then this method do nothing.
This method is invoked automatically before any operation that require the NetCDF
variable, including (but not limited to):
Parameters: imageIndex - The image index. true if the changed as a result of this call,or false if the current value is already appropriate. throws: IndexOutOfBoundsException - if the specified index is outside the expected range. throws: IllegalStateException - If NetcdfImageReader.input is not set. throws: IOException - If the operation failed because of an I/O error. |
setError | public void setError(String message)(Code) | | Invoked by the NetCDF library when an error occured during the read operation.
Users should not invoke this method directly.
|
setVariables | public void setVariables(String[] variableNames)(Code) | | Sets the name of the
to be read in a NetCDF file.
The first name is assigned to image index 0, the second name to image index 1,
etc..
If
variableNames is set to
null (which is the default), then the
variables will be inferred from the content of the NetCDF file.
|
|
|