Package ucar.nc2.ft2.coverage.adapter
Class DtCoverage
- java.lang.Object
-
- ucar.nc2.ft2.coverage.adapter.DtCoverage
-
- All Implemented Interfaces:
IsMissingEvaluator
public class DtCoverage extends Object implements IsMissingEvaluator
fork ucar.nc2.dt.grid.GeoGrid for adaption of GridCoverage. Minimalist, does not do make a "logical GeoGrid subset" LOOK maybe can only be used for GRID ?- Since:
- 5/26/2015
-
-
Constructor Summary
Constructors Constructor Description DtCoverage(DtCoverageDataset dataset, DtCoverageCS gcs, VariableDS dsvar)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AttributeContainer
attributes()
int
compareTo(DtCoverage g)
boolean
equals(Object oo)
Instances which have same name and coordinate system are equal.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()
Deprecated.use attributes()DtCoverageCS
getCoordinateSystem()
get the GeoGridCoordSys for this GeoGrid.DataType
getDataType()
String
getDescription()
get the standardized description, or null if none.Dimension
getDimension(int i)
get the ith dimensionList<Dimension>
getDimensions()
Returns an ArrayList containing the dimensions used by this geoGrid.Dimension
getEnsembleDimension()
get the ensemble Dimension, if it existsint
getEnsembleDimensionIndex()
get the ensemble Dimension index in the geogrid (canonical order)String
getFullName()
String
getInfo()
nicely formatted informationMAMath.MinMax
getMinMaxSkipMissingData(Array a)
Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).String
getName()
ProjectionImpl
getProjection()
get the Projection.int
getRank()
get the rankDimension
getRunTimeDimension()
get the run time Dimension, if it existsint
getRunTimeDimensionIndex()
get the runtime Dimension index in the geogrid (canonical order)int[]
getShape()
get the shapeString
getShortName()
Dimension
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 as a stringVariableDS
getVariable()
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 noneint
hashCode()
Override Object.hashCode() to be consistent with equals.boolean
hasMissing()
true if there may be missing databoolean
hasMissingData()
true if there may be missing data, see VariableDS.hasMissing()boolean
isMissing(double val)
if val is a missing data valueboolean
isMissingData(double val)
if val is missing data, see VariableDS.isMissingData()Array
readDataSection(Section subset, boolean canonicalOrder)
This reads an arbitrary data section, returning the data in canonical order (rt-e-t-z-y-x).Array
readDataSlice(int t, int z, int y, int x)
This reads an arbitrary data slice, returning the data in canonical order (t-z-y-x).Array
readDataSlice(int rt, int e, int t, int z, int y, int x)
This reads an arbitrary data slice, returning the data in canonical order (rt-e-t-z-y-x).float[]
setMissingToNaN(float[] values)
Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissingData(val).String
toString()
string representation
-
-
-
Constructor Detail
-
DtCoverage
public DtCoverage(DtCoverageDataset dataset, DtCoverageCS gcs, VariableDS dsvar)
Constructor.- Parameters:
dataset
- belongs to this datasetdsvar
- wraps this Variablegcs
- has this grid coordinate system
-
-
Method Detail
-
getDimensions
public List<Dimension> getDimensions()
Returns an ArrayList containing the dimensions used by this geoGrid. The dimension are put into canonical order: (rt, e, t, z, y, x). Note that the z and t dimensions are optional. 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
public Dimension getDimension(int i)
get the ith dimension- Parameters:
i
- : which dimension- Returns:
- ith Dimension
-
getTimeDimension
public Dimension getTimeDimension()
get the time Dimension, if it exists
-
getZDimension
public Dimension getZDimension()
get the z Dimension, if it exists
-
getYDimension
public Dimension getYDimension()
get the y Dimension, if it exists
-
getXDimension
public Dimension getXDimension()
get the x Dimension, if it exists
-
getEnsembleDimension
public Dimension getEnsembleDimension()
get the ensemble Dimension, if it exists
-
getRunTimeDimension
public Dimension getRunTimeDimension()
get the run time Dimension, if it exists
-
getTimeDimensionIndex
public int getTimeDimensionIndex()
get the time Dimension index in the geogrid (canonical order), or -1 if none
-
getZDimensionIndex
public int getZDimensionIndex()
get the z Dimension index in the geogrid (canonical order), or -1 if none
-
getYDimensionIndex
public int getYDimensionIndex()
get the y Dimension index in the geogrid (canonical order)
-
getXDimensionIndex
public int getXDimensionIndex()
get the x Dimension index in the geogrid (canonical order)
-
getEnsembleDimensionIndex
public int getEnsembleDimensionIndex()
get the ensemble Dimension index in the geogrid (canonical order)
-
getRunTimeDimensionIndex
public int getRunTimeDimensionIndex()
get the runtime Dimension index in the geogrid (canonical order)
-
findAttributeIgnoreCase
public 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
public 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.
-
getRank
public int getRank()
get the rank
-
getShape
public int[] getShape()
get the shape
-
getDataType
public DataType getDataType()
-
attributes
public AttributeContainer attributes()
-
getAttributes
@Deprecated public List<Attribute> getAttributes()
Deprecated.use attributes()
-
getVariable
public VariableDS getVariable()
-
getFullName
public String getFullName()
-
getName
public String getName()
-
getShortName
public String getShortName()
-
getCoordinateSystem
public DtCoverageCS getCoordinateSystem()
get the GeoGridCoordSys for this GeoGrid.
-
getProjection
public ProjectionImpl getProjection()
get the Projection.
-
getDescription
public String getDescription()
get the standardized description, or null if none.
-
getUnitsString
public String getUnitsString()
get the unit as a string
-
hasMissingData
public boolean hasMissingData()
true if there may be missing data, see VariableDS.hasMissing()
-
isMissingData
public boolean isMissingData(double val)
if val is missing data, see VariableDS.isMissingData()
-
hasMissing
public boolean hasMissing()
Description copied from interface:IsMissingEvaluator
true if there may be missing data- Specified by:
hasMissing
in interfaceIsMissingEvaluator
- Returns:
- true if there may be missing data
-
isMissing
public boolean isMissing(double val)
Description copied from interface:IsMissingEvaluator
if val is a missing data value- Specified by:
isMissing
in interfaceIsMissingEvaluator
- Parameters:
val
- test this value- Returns:
- true if val is missing data
-
setMissingToNaN
public float[] setMissingToNaN(float[] values)
Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissingData(val).- Parameters:
values
- input array- Returns:
- input array, with missing values converted to NaNs.
-
getMinMaxSkipMissingData
public MAMath.MinMax getMinMaxSkipMissingData(Array a)
Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).- Parameters:
a
- Array to get min/max values- Returns:
- both min and max value.
-
readDataSlice
public Array readDataSlice(int t, int z, int y, int x) 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.- Parameters:
t
- if < 0, get all of time dim; if valid index, fix slice to that value.z
- if < 0, get all of z dim; if valid index, fix slice to that value.y
- if < 0, get all of y dim; if valid index, fix slice to that value.x
- if < 0, get all of x dim; if valid index, fix slice to that value.- Returns:
- data[t, z, y, x], eliminating missing or fixed dimension.
- Throws:
IOException
-
readDataSlice
public Array readDataSlice(int rt, int e, int t, int z, int y, int x) 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
- if < 0, get all of runtime dim; if valid index, fix slice to that value.e
- if < 0, get all of ensemble dim; if valid index, fix slice to that value.t
- if < 0, get all of time dim; if valid index, fix slice to that value.z
- if < 0, get all of z dim; if valid index, fix slice to that value.y
- if < 0, get all of y dim; if valid index, fix slice to that value.x
- 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
-
readDataSection
public Array readDataSection(Section subset, boolean canonicalOrder) throws InvalidRangeException, IOException
This reads an arbitrary data section, returning the data in canonical order (rt-e-t-z-y-x). If any dimension does not exist, ignore it.- Parameters:
subset
- - each Range must be named by the axisType that its used for. order not important- Returns:
- data[rt, e, t, z, y, x], eliminating missing dimensions. length=1 not eliminated
- Throws:
InvalidRangeException
IOException
-
equals
public boolean equals(Object oo)
Instances which have same name and coordinate system are equal.
-
hashCode
public int hashCode()
Override Object.hashCode() to be consistent with equals.
-
getInfo
public String getInfo()
nicely formatted information
-
compareTo
public int compareTo(DtCoverage g)
-
-