Package ucar.nc2.dt
Interface GridDatatype
-
- All Superinterfaces:
Comparable<GridDatatype>
,IsMissingEvaluator
- All Known Implementing Classes:
GeoGrid
public interface GridDatatype extends IsMissingEvaluator, Comparable<GridDatatype>
Interface for scientific datatype Grid.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Attribute
findAttributeIgnoreCase(String name)
Convenience function; lookup Attribute by name.String
findAttValueIgnoreCase(String attName, String defaultValue)
Convenience function; lookup Attribute value by name.List<Attribute>
getAttributes()
Get a List of Attribute specific to the GridGridCoordSystem
getCoordinateSystem()
get the Grid's Coordinate System.DataType
getDataType()
get the data typeString
getDescription()
Get the description/long_name of the Grid, or null if none.Dimension
getDimension(int i)
get the ith dimensionList<Dimension>
getDimensions()
Returns a List of Dimension containing the dimensions used by this grid.Dimension
getEnsembleDimension()
get the ensemble Dimension, if it existsint
getEnsembleDimensionIndex()
get the ensemble Dimension index in the geogrid (canonical order), or -1 if noneString
getFullName()
Get the full, unescaped name of the GridString
getInfo()
human readable information about this Grid.MAMath.MinMax
getMinMaxSkipMissingData(Array data)
Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).String
getName()
Alias for getFullName().ProjectionImpl
getProjection()
get the Projection, if it exists.int
getRank()
get the rankDimension
getRunTimeDimension()
get the runtime Dimension, if it existsint
getRunTimeDimensionIndex()
get the runtime Dimension index in the geogrid (canonical order), or -1 if noneint[]
getShape()
get the shape (canonical ordering)String
getShortName()
Get the short name of the GridDimension
getTimeDimension()
get the time Dimension, if it existsint
getTimeDimensionIndex()
get the time Dimension index in the geogrid (canonical order), or -1 if noneString
getUnitsString()
Get the unit stringVariableDS
getVariable()
Get the underlying Variable, if it exists.Dimension
getXDimension()
get the x Dimension, if it existsint
getXDimensionIndex()
get the x Dimension index in the geogrid (canonical order)Dimension
getYDimension()
get the y Dimension, if it existsint
getYDimensionIndex()
get the y Dimension index in the geogrid (canonical order)Dimension
getZDimension()
get the z Dimension, if it existsint
getZDimensionIndex()
get the z Dimension index in the geogrid (canonical order), or -1 if noneboolean
hasMissingData()
true if there may be missing databoolean
isMissingData(double val)
if val is missing dataGridDatatype
makeSubset(Range rt_range, Range e_range, Range t_range, Range z_range, Range y_range, Range x_range)
Create a new GeoGrid that is a logical subset of this GeoGrid.GridDatatype
makeSubset(Range t_range, Range z_range, LatLonRect bbox, int z_stride, int y_stride, int x_stride)
Create a new GeoGrid that is a logical subset of this GeoGrid.Array
readDataSlice(int t_index, int z_index, int y_index, int x_index)
This reads an arbitrary data slice, returning the data in canonical order (t-z-y-x).Array
readDataSlice(int rt_index, int e_index, int t_index, int z_index, int y_index, int x_index)
This reads an arbitrary data slice, returning the data in canonical order (rt-e-t-z-y-x).Array
readSubset(List<Range> subset)
Array
readVolumeData(int t_index)
Reads in the data "volume" at the given time index.float[]
setMissingToNaN(float[] data)
Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissing(val).-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface ucar.ma2.IsMissingEvaluator
hasMissing, isMissing
-
-
-
-
Method Detail
-
getFullName
String getFullName()
Get the full, unescaped name of the Grid- Returns:
- the full, unescaped name of the Grid
-
getShortName
String getShortName()
Get the short name of the Grid- Returns:
- the short name of the Grid
-
getName
String getName()
Alias for getFullName().- Returns:
- the full, unescaped name
-
getDescription
String getDescription()
Get the description/long_name of the Grid, or null if none.- Returns:
- the description/long_name of the Grid, or null if none.
-
getUnitsString
String getUnitsString()
Get the unit string- Returns:
- the unit string
-
getDataType
DataType getDataType()
get the data type- Returns:
- the data type
-
getRank
int getRank()
get the rank- Returns:
- the rank
-
getShape
int[] getShape()
get the shape (canonical ordering)- Returns:
- the shape (canonical ordering)
-
getAttributes
List<Attribute> getAttributes()
Get a List of Attribute specific to the Grid- Returns:
- a List of Attribute
-
findAttributeIgnoreCase
Attribute findAttributeIgnoreCase(String name)
Convenience function; lookup Attribute by name.- Parameters:
name
- the name of the attribute- Returns:
- the attribute, or null if not found
-
findAttValueIgnoreCase
String findAttValueIgnoreCase(String attName, String defaultValue)
Convenience function; lookup Attribute value by name. Must be String valued- Parameters:
attName
- name of the attributedefaultValue
- if not found, use this as the default- Returns:
- Attribute string value, or default if not found.
-
getDimensions
List<Dimension> getDimensions()
Returns a List of Dimension containing the dimensions used by this grid. The dimension are put into canonical order: (rt, e, t, z, y, x). Only the x and y are required. If the Horizontal axes are 2D, the x and y dimensions are arbitrarily chosen to be gcs.getXHorizAxis().getDimension(1), gcs.getXHorizAxis().getDimension(0), respectively.- Returns:
- List with objects of type Dimension, in canonical order.
-
getDimension
Dimension getDimension(int i)
get the ith dimension- Parameters:
i
- index of dimension- Returns:
- the ith dimension
-
getTimeDimension
Dimension getTimeDimension()
get the time Dimension, if it exists- Returns:
- the time Dimension, or null
-
getZDimension
Dimension getZDimension()
get the z Dimension, if it exists- Returns:
- the z Dimension, or null
-
getYDimension
Dimension getYDimension()
get the y Dimension, if it exists- Returns:
- the y Dimension, or null
-
getXDimension
Dimension getXDimension()
get the x Dimension, if it exists- Returns:
- the x Dimension, or null
-
getEnsembleDimension
Dimension getEnsembleDimension()
get the ensemble Dimension, if it exists- Returns:
- the ensemble Dimension, or null
-
getRunTimeDimension
Dimension getRunTimeDimension()
get the runtime Dimension, if it exists- Returns:
- the runtime Dimension, or null
-
getTimeDimensionIndex
int getTimeDimensionIndex()
get the time Dimension index in the geogrid (canonical order), or -1 if none- Returns:
- the time Dimension index in canonical order, or -1
-
getZDimensionIndex
int getZDimensionIndex()
get the z Dimension index in the geogrid (canonical order), or -1 if none- Returns:
- the z Dimension index in canonical order, or -1
-
getYDimensionIndex
int getYDimensionIndex()
get the y Dimension index in the geogrid (canonical order)- Returns:
- the y Dimension index in canonical order, or -1
-
getXDimensionIndex
int getXDimensionIndex()
get the x Dimension index in the geogrid (canonical order)- Returns:
- the x Dimension index in canonical order, or -1
-
getEnsembleDimensionIndex
int getEnsembleDimensionIndex()
get the ensemble Dimension index in the geogrid (canonical order), or -1 if none- Returns:
- the ensemble Dimension index in canonical order, or -1
-
getRunTimeDimensionIndex
int getRunTimeDimensionIndex()
get the runtime Dimension index in the geogrid (canonical order), or -1 if none- Returns:
- the runtime Dimension index in canonical order, or -1
-
getCoordinateSystem
GridCoordSystem getCoordinateSystem()
get the Grid's Coordinate System.- Returns:
- the Grid's Coordinate System.
-
getProjection
ProjectionImpl getProjection()
get the Projection, if it exists.- Returns:
- the Projection, or null
-
hasMissingData
boolean hasMissingData()
true if there may be missing data- Returns:
- true if there may be missing data
-
isMissingData
boolean isMissingData(double val)
if val is missing data- Parameters:
val
- test this value- Returns:
- true if val is missing data
-
getMinMaxSkipMissingData
MAMath.MinMax getMinMaxSkipMissingData(Array data)
Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).- Parameters:
data
- Array to get min/max values- Returns:
- both min and max value.
-
setMissingToNaN
float[] setMissingToNaN(float[] data)
Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissing(val).- Parameters:
data
- input array- Returns:
- input array, with missing values converted to NaNs.
-
readDataSlice
Array readDataSlice(int rt_index, int e_index, int t_index, int z_index, int y_index, int x_index) throws IOException
This reads an arbitrary data slice, returning the data in canonical order (rt-e-t-z-y-x). If any dimension does not exist, ignore it.- Parameters:
rt_index
- if < 0, get all of runtime dim; if valid index, fix slice to that value.e_index
- if < 0, get all of ensemble dim; if valid index, fix slice to that value.t_index
- if < 0, get all of time dim; if valid index, fix slice to that value.z_index
- if < 0, get all of z dim; if valid index, fix slice to that value.y_index
- if < 0, get all of y dim; if valid index, fix slice to that value.x_index
- if < 0, get all of x dim; if valid index, fix slice to that value.- Returns:
- data[rt,e,t,z,y,x], eliminating missing or fixed dimension.
- Throws:
IOException
- on io error
-
readSubset
Array readSubset(List<Range> subset) throws InvalidRangeException, IOException
- Throws:
InvalidRangeException
IOException
-
readDataSlice
Array readDataSlice(int t_index, int z_index, int y_index, int x_index) throws IOException
This reads an arbitrary data slice, returning the data in canonical order (t-z-y-x). If any dimension does not exist, ignore it. For backwards compatibility for grids with no runtime or ensemble dimensions.- Parameters:
t_index
- if < 0, get all of time dim; if valid index, fix slice to that value.z_index
- if < 0, get all of z dim; if valid index, fix slice to that value.y_index
- if < 0, get all of y dim; if valid index, fix slice to that value.x_index
- if < 0, get all of x dim; if valid index, fix slice to that value.- Returns:
- data[rt,e,t,z,y,x], eliminating missing or fixed dimension.
- Throws:
IOException
- on io error
-
readVolumeData
Array readVolumeData(int t_index) throws IOException
Reads in the data "volume" at the given time index. If its a product set, put into canonical order (z-y-x). If not a product set, reorder to (z,i,j), where i, j are from the original- Parameters:
t_index
- time index; ignored if no time axis. you can set to -1 to read all times.- Returns:
- data[z,y,x] or data[y,x] if no z axis.
- Throws:
IOException
- on io error
-
makeSubset
GridDatatype makeSubset(Range rt_range, Range e_range, Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException
Create a new GeoGrid that is a logical subset of this GeoGrid.- Parameters:
rt_range
- subset the runtime dimension, or null if you want all of ite_range
- subset the ensemble dimension, or null if you want all of itt_range
- subset the time dimension, or null if you want all of itz_range
- subset the vertical dimension, or null if you want all of ity_range
- subset the y dimension, or null if you want all of itx_range
- subset the x dimension, or null if you want all of it- Returns:
- subsetted GeoGrid
- Throws:
InvalidRangeException
- if ranges are invlaid
-
makeSubset
GridDatatype makeSubset(Range t_range, Range z_range, LatLonRect bbox, int z_stride, int y_stride, int x_stride) throws InvalidRangeException
Create a new GeoGrid that is a logical subset of this GeoGrid. For backwards compatibility for grids with no runtime or ensemble dimensions.- Parameters:
t_range
- subset the time dimension, or null if you want all of itz_range
- subset the vertical dimension, or null if you want all of itbbox
- a lat/lon bounding box, or null if you want all x,yz_stride
- use only if z_range is null, then take all z with this stride (1 means all)y_stride
- use this stride on the y coordinate (1 means all)x_stride
- use this stride on the x coordinate (1 means all)- Returns:
- subsetted GeoGrid
- Throws:
InvalidRangeException
- if ranges are invlaid
-
getInfo
String getInfo()
human readable information about this Grid.- Returns:
- human readable information about this Grid.
-
getVariable
VariableDS getVariable()
Get the underlying Variable, if it exists.- Returns:
- the underlying Variable, if it exists, else null
-
-