public class GeoGrid extends java.lang.Object implements NamedObject, GridDatatype
Implementation note: 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.
| Constructor and Description |
|---|
GeoGrid(GridDataset dataset,
VariableDS dsvar,
GridCoordSys gcs)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AttributeContainer |
attributes() |
int |
compareTo(GridDatatype g) |
boolean |
equals(java.lang.Object oo)
Instances which have same name and coordinate system are equal.
|
Attribute |
findAttributeIgnoreCase(java.lang.String name)
Convenience function; lookup Attribute by name.
|
java.lang.String |
findAttValueIgnoreCase(java.lang.String attName,
java.lang.String defaultValue)
Convenience function; lookup Attribute value by name.
|
java.util.List<Attribute> |
getAttributes()
Deprecated.
use attributes()
|
GridCoordSystem |
getCoordinateSystem()
get the GridCoordSys for this GeoGrid.
|
Array |
getDataSlice(int t,
int z,
int y,
int x)
Deprecated.
use readDataSlice
|
DataType |
getDataType()
get the data type
|
java.lang.String |
getDescription()
get the standardized description, or null if none.
|
Dimension |
getDimension(int i)
get the ith dimension
|
java.util.List<Dimension> |
getDimensions()
Returns an ArrayList containing the dimensions used by this geoGrid.
|
Dimension |
getEnsembleDimension()
get the ensemble Dimension, if it exists
|
int |
getEnsembleDimensionIndex()
get the ensemble Dimension index in the geogrid (canonical order)
|
java.lang.String |
getFullName()
Get the full, unescaped name of the Grid
|
java.lang.String |
getInfo()
nicely formatted information
|
java.util.List<NamedObject> |
getLevels()
Deprecated.
will move in ver 6
|
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).
|
java.lang.String |
getName()
Get the object's name
|
ProjectionImpl |
getProjection()
Deprecated.
this will return Projection, not ProjectionImpl in 6.
|
int |
getRank()
get the rank
|
Dimension |
getRunTimeDimension()
get the run time Dimension, if it exists
|
int |
getRunTimeDimensionIndex()
get the runtime Dimension index in the geogrid (canonical order)
|
int[] |
getShape()
get the shape
|
java.lang.String |
getShortName()
Get the short name of the Grid
|
Dimension |
getTimeDimension()
get the time Dimension, if it exists
|
int |
getTimeDimensionIndex()
get the time Dimension index in the geogrid (canonical order), or -1 if none
|
java.util.List<NamedObject> |
getTimes()
Deprecated.
will move in ver 6
|
java.lang.String |
getUnitsString()
get the unit as a string
|
java.lang.String |
getUnitString()
Deprecated.
use getUnitsString()
|
java.lang.Object |
getValue() |
VariableDS |
getVariable()
Get the underlying Variable, if it exists.
|
Dimension |
getXDimension()
get the x Dimension, if it exists
|
int |
getXDimensionIndex()
get the x Dimension index in the geogrid (canonical order)
|
Dimension |
getYDimension()
get the y Dimension, if it exists
|
int |
getYDimensionIndex()
get the y Dimension index in the geogrid (canonical order)
|
Dimension |
getZDimension()
get the z Dimension, if it exists
|
int |
getZDimensionIndex()
get the z Dimension index in the geogrid (canonical order), or -1 if none
|
int |
hashCode()
Override Object.hashCode() to be consistent with equals.
|
boolean |
hasMissing()
true if there may be missing data
|
boolean |
hasMissingData()
true if there may be missing data, see VariableDS.hasMissing()
|
boolean |
isMissing(double val)
if val is a missing data value
|
boolean |
isMissingData(double val)
if val is missing data, see VariableDS.isMissingData()
|
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.
|
GridDatatype |
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.
|
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).
|
Array |
readSubset(java.util.List<Range> subset) |
Array |
readVolumeData(int t)
Reads in the data "volume" at the given time index.
|
Array |
readYXData(int t,
int z)
Reads a Y-X "horizontal slice" at the given time and vertical index.
|
Array |
readZYData(int t,
int x)
Reads a Z-Y "vertical slice" at the given time and x index.
|
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).
|
GeoGrid |
subset(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.
|
GeoGrid |
subset(Range t_range,
Range z_range,
Range y_range,
Range x_range)
Create a new GeoGrid that is a logical subset of this GeoGrid.
|
java.lang.String |
toString()
string representation
|
public GeoGrid(GridDataset dataset, VariableDS dsvar, GridCoordSys gcs)
dataset - belongs to this datasetdsvar - wraps this Variablegcs - has this grid coordinate systempublic java.util.List<Dimension> getDimensions()
getDimensions in interface GridDatatypepublic Dimension getDimension(int i)
getDimension in interface GridDatatypei - : which dimensionpublic Dimension getTimeDimension()
getTimeDimension in interface GridDatatypepublic Dimension getZDimension()
getZDimension in interface GridDatatypepublic Dimension getYDimension()
getYDimension in interface GridDatatypepublic Dimension getXDimension()
getXDimension in interface GridDatatypepublic Dimension getEnsembleDimension()
getEnsembleDimension in interface GridDatatypepublic Dimension getRunTimeDimension()
getRunTimeDimension in interface GridDatatypepublic int getTimeDimensionIndex()
getTimeDimensionIndex in interface GridDatatypepublic int getZDimensionIndex()
getZDimensionIndex in interface GridDatatypepublic int getYDimensionIndex()
getYDimensionIndex in interface GridDatatypepublic int getXDimensionIndex()
getXDimensionIndex in interface GridDatatypepublic int getEnsembleDimensionIndex()
getEnsembleDimensionIndex in interface GridDatatypepublic int getRunTimeDimensionIndex()
getRunTimeDimensionIndex in interface GridDatatypepublic Attribute findAttributeIgnoreCase(java.lang.String name)
findAttributeIgnoreCase in interface GridDatatypename - the name of the attributepublic java.lang.String findAttValueIgnoreCase(java.lang.String attName,
java.lang.String defaultValue)
findAttValueIgnoreCase in interface GridDatatypeattName - name of the attributedefaultValue - if not found, use this as the defaultpublic int getRank()
getRank in interface GridDatatypepublic int[] getShape()
getShape in interface GridDatatypepublic DataType getDataType()
getDataType in interface GridDatatypepublic AttributeContainer attributes()
@Deprecated public java.util.List<Attribute> getAttributes()
GridDatatypegetAttributes in interface GridDatatypepublic VariableDS getVariable()
GridDatatypegetVariable in interface GridDatatypepublic java.lang.String getFullName()
GridDatatypegetFullName in interface GridDatatypepublic java.lang.String getName()
NamedObjectgetName in interface GridDatatypegetName in interface NamedObjectpublic java.lang.String getShortName()
GridDatatypegetShortName in interface GridDatatypepublic GridCoordSystem getCoordinateSystem()
getCoordinateSystem in interface GridDatatypepublic ProjectionImpl getProjection()
getProjection in interface GridDatatype@Deprecated public java.util.List<NamedObject> getLevels()
@Deprecated public java.util.List<NamedObject> getTimes()
public java.lang.String getDescription()
getDescription in interface GridDatatypegetDescription in interface NamedObjectpublic java.lang.Object getValue()
getValue in interface NamedObjectpublic java.lang.String getUnitsString()
getUnitsString in interface GridDatatypepublic java.lang.String getUnitString()
public boolean hasMissingData()
hasMissingData in interface GridDatatypepublic boolean isMissingData(double val)
isMissingData in interface GridDatatypeval - test this valuepublic boolean hasMissing()
IsMissingEvaluatorhasMissing in interface IsMissingEvaluatorpublic boolean isMissing(double val)
IsMissingEvaluatorisMissing in interface IsMissingEvaluatorval - test this valuepublic float[] setMissingToNaN(float[] values)
setMissingToNaN in interface GridDatatypevalues - input arraypublic MAMath.MinMax getMinMaxSkipMissingData(Array a)
getMinMaxSkipMissingData in interface GridDatatypea - Array to get min/max valuespublic Array readVolumeData(int t) throws java.io.IOException
readVolumeData in interface GridDatatypet - time index; ignored if no time axis.java.io.IOException - on io errorpublic Array readYXData(int t, int z) throws java.io.IOException
t - time index; ignored if no time axis.z - vertical index; ignored if no z axis.java.io.IOException - on read errorpublic Array readZYData(int t, int x) throws java.io.IOException
t - time index; ignored if no time axis.x - x index; ignored if no x axis.java.io.IOException - on read errorpublic Array getDataSlice(int t, int z, int y, int x) throws java.io.IOException
java.io.IOException - on read errorpublic Array readDataSlice(int t, int z, int y, int x) throws java.io.IOException
readDataSlice in interface GridDatatypet - 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.java.io.IOException - on io errorpublic Array readDataSlice(int rt, int e, int t, int z, int y, int x) throws java.io.IOException
readDataSlice in interface GridDatatypert - 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.java.io.IOException - on io errorpublic Array readSubset(java.util.List<Range> subset) throws InvalidRangeException, java.io.IOException
readSubset in interface GridDatatypeInvalidRangeExceptionjava.io.IOExceptionpublic GeoGrid subset(Range t_range, Range z_range, LatLonRect bbox, int z_stride, int y_stride, int x_stride) throws InvalidRangeException
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)InvalidRangeException - if bbox does not intersect GeoGridpublic GridDatatype makeSubset(Range t_range, Range z_range, LatLonRect bbox, int z_stride, int y_stride, int x_stride) throws InvalidRangeException
GridDatatypemakeSubset in interface GridDatatypet_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)InvalidRangeException - if ranges are invlaidpublic GeoGrid subset(Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException
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 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 itInvalidRangeException - if any of the ranges are invalidpublic GridDatatype makeSubset(Range rt_range, Range e_range, Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException
GridDatatypemakeSubset in interface GridDatatypert_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 itInvalidRangeException - if ranges are invlaidpublic boolean equals(java.lang.Object oo)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getInfo()
getInfo in interface GridDatatypepublic int compareTo(GridDatatype g)
compareTo in interface java.lang.Comparable<GridDatatype>