public class NetCDFUtilities extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NetCDFUtilities.Axis
Global attribute for coordinate variables.
|
static class |
NetCDFUtilities.CheckType |
static class |
NetCDFUtilities.DatasetAttribs |
static class |
NetCDFUtilities.KeyValuePair |
static class |
NetCDFUtilities.ProjAttribs |
Modifier and Type | Field and Description |
---|---|
static String |
COORDINATE_AXIS_TYPE |
static String |
COORDSYS |
static String |
DEPTH |
static String |
HEIGHT |
static String |
LAT |
static String |
LATITUDE |
static String |
LON |
static String |
LONG_NAME |
static String |
LONGITUDE |
static String |
LOWER_LEFT_LATITUDE |
static String |
LOWER_LEFT_LONGITUDE |
static String |
NAME |
static String |
POSITIVE |
static String |
TIME |
static String |
UNITS |
static String |
UPPER_RIGHT_LATITUDE |
static String |
UPPER_RIGHT_LONGITUDE |
static Set<ucar.ma2.DataType> |
VALID_TYPES
The data type to accept in images.
|
static int |
X_DIMENSION
The dimension relative to the rank in
#variable
to use as image width. |
static int |
Y_DIMENSION
The dimension relative to the rank in
#variable
to use as image height. |
static int |
Z_DIMENSION
The default dimension relative to the rank in
#variable to use as Z dimension. |
static String |
ZETA |
Modifier and Type | Method and Description |
---|---|
static NetCDFUtilities.KeyValuePair |
getAttribute(ucar.nc2.Variable var,
int attributeIndex) |
static Number |
getAttributesAsNumber(ucar.nc2.Variable var,
String attributeName) |
static String |
getAttributesAsString(ucar.nc2.Attribute attr) |
static String |
getAttributesAsString(ucar.nc2.Attribute attr,
boolean isUnsigned)
Return the value of a NetCDF
Attribute instance as a
String . |
static String |
getAttributesAsString(ucar.nc2.Variable var,
String attributeName) |
static Format |
getAxisFormat(ucar.nc2.constants.AxisType type,
String prototype)
Returns a format to use for parsing values along the specified axis type.
|
static NetCDFUtilities.CheckType |
getCheckType(ucar.nc2.dataset.NetcdfDataset dataset)
Depending on the type of model/netcdf file, we will check for the
presence of some variables rather than some others.
|
static ucar.nc2.dataset.NetcdfDataset |
getDataset(Object input)
Returns a
NetcdfDataset given an input object |
static NetCDFUtilities.KeyValuePair |
getGlobalAttribute(ucar.nc2.dataset.NetcdfDataset dataset,
int attributeIndex) |
static String |
getGlobalAttributeAsString(ucar.nc2.dataset.NetcdfDataset dataset,
String attributeName)
Return a global attribute as a
String . |
static int |
getRawDataType(ucar.nc2.VariableIF variable)
Returns the data type which most closely represents the "raw" internal
data of the variable.
|
static int |
getTIndex(ucar.nc2.Variable var,
ucar.ma2.Range range,
int imageIndex)
Utility method to retrieve the t-index of a Variable descriptor stored on
NetCDFImageReader NetCDF Flat Reader HashMap indexMap. |
static int |
getZIndex(ucar.nc2.Variable var,
ucar.ma2.Range range,
int imageIndex)
Utility method to retrieve the z-index of a Variable descriptor stored on
NetCDFImageReader NetCDF Flat Reader HashMap indexMap. |
static boolean |
isVariableAccepted(String name,
NetCDFUtilities.CheckType checkType)
NetCDF files may contains a wide set of variables.
|
static boolean |
isVariableAccepted(ucar.nc2.Variable var,
NetCDFUtilities.CheckType checkType)
NetCDF files may contains a wide set of variables.
|
static ucar.ma2.DataType |
transcodeDataType(int dataType)
Transcode a NetCDF data type into a java2D DataBuffer type.
|
static int |
transcodeNetCDFDataType(ucar.ma2.DataType type,
boolean unsigned)
Transcode a NetCDF data type into a java2D DataBuffer type.
|
static String |
trimFractionalPart(String value) |
public static final String LOWER_LEFT_LONGITUDE
public static final String LOWER_LEFT_LATITUDE
public static final String UPPER_RIGHT_LONGITUDE
public static final String UPPER_RIGHT_LATITUDE
public static final String COORDSYS
public static final String LATITUDE
public static final String LAT
public static final String LONGITUDE
public static final String LON
public static final String DEPTH
public static final String ZETA
public static final String HEIGHT
public static final String TIME
public static final String COORDINATE_AXIS_TYPE
public static final String POSITIVE
public static final String UNITS
public static final String NAME
public static final String LONG_NAME
public static final int X_DIMENSION
#variable
to use as image width. The actual dimension is
variable.getRank() - X_DIMENSION
. Is hard-coded because the loop
in the read
method expects this order.public static final int Y_DIMENSION
#variable
to use as image height. The actual dimension is
variable.getRank() - Y_DIMENSION
. Is hard-coded because the loop
in the read
method expects this order.public static final int Z_DIMENSION
#variable
to use as Z dimension. The actual dimension is
variable.getRank() - Z_DIMENSION
.
public static final Set<ucar.ma2.DataType> VALID_TYPES
public static int getTIndex(ucar.nc2.Variable var, ucar.ma2.Range range, int imageIndex)
NetCDFImageReader
NetCDF Flat Reader HashMap
indexMap.var
- Variable
range
- Range
imageIndex
- int
int
-1 if variable rank > 4public static int getZIndex(ucar.nc2.Variable var, ucar.ma2.Range range, int imageIndex)
NetCDFImageReader
NetCDF Flat Reader HashMap
indexMap.var
- Variable
range
- Range
imageIndex
- int
int
-1 if variable rank < 3public static int getRawDataType(ucar.nc2.VariableIF variable)
NetcdfImageReader#getRawDataType
.variable
- The variable.DataBuffer.TYPE_UNDEFINED
if unknown.NetcdfImageReader#getRawDataType
public static int transcodeNetCDFDataType(ucar.ma2.DataType type, boolean unsigned)
type
- the DataType
to transcode.unsigned
- if the original data is unsigned or notpublic static ucar.ma2.DataType transcodeDataType(int dataType)
type
- the DataType
to transcode.unsigned
- if the original data is unsigned or notpublic static String getAttributesAsString(ucar.nc2.Attribute attr)
public static String getAttributesAsString(ucar.nc2.Variable var, String attributeName)
public static Number getAttributesAsNumber(ucar.nc2.Variable var, String attributeName)
public static String getAttributesAsString(ucar.nc2.Attribute attr, boolean isUnsigned)
Attribute
instance as a
String
. The isUnsigned
parameter allow to handle byte
attributes as unsigned, in order to represent values in the range
[0,255].public static boolean isVariableAccepted(ucar.nc2.Variable var, NetCDFUtilities.CheckType checkType)
true
if the
specified variable is accepted.public static boolean isVariableAccepted(String name, NetCDFUtilities.CheckType checkType)
true
if the
specified variable is accepted.public static String trimFractionalPart(String value)
value
- public static ucar.nc2.dataset.NetcdfDataset getDataset(Object input) throws IOException
NetcdfDataset
given an input objectinput
- the input object (usually a File
, a
String
or a {@code FileImageInputStreamExt).NetcdfDataset
in case of success.IOException
- if some error occur while opening the dataset.{@link
- IllegalArgumentException}
in case the specified input is a directorypublic static Format getAxisFormat(ucar.nc2.constants.AxisType type, String prototype)
DateFormat
using the "yyyy-MM-dd HH:mm:ss"
pattern in UTC
timezone.NumberFormat
.The Canada locale is used by default for most formats because it is relatively close to ISO (for example regarding days and months order in dates) while using the English symbols.
type
- The type of the axis.prototype
- An example of the values to be parsed. Implementations may
parse this prototype when the axis type alone is not
sufficient. For example the time
axis type should uses the "yyyy-MM-dd"
date
pattern, but some files do not follow this convention and
use the default local instead.public static NetCDFUtilities.CheckType getCheckType(ucar.nc2.dataset.NetcdfDataset dataset)
dataset
- the input dataset.NetCDFUtilities.CheckType
to be performed on the specified
dataset.public static String getGlobalAttributeAsString(ucar.nc2.dataset.NetcdfDataset dataset, String attributeName)
String
. The required global
attribute is specified by nameattributeName
- the name of the required attribute.public static NetCDFUtilities.KeyValuePair getGlobalAttribute(ucar.nc2.dataset.NetcdfDataset dataset, int attributeIndex) throws IOException
IOException
public static NetCDFUtilities.KeyValuePair getAttribute(ucar.nc2.Variable var, int attributeIndex)
Copyright © 2006–2015 GeoSolutions. All rights reserved.