Package ucar.nc2.dt.ugrid
Class MeshVariable
java.lang.Object
ucar.nc2.dt.ugrid.MeshVariable
- All Implemented Interfaces:
Comparable<ucar.nc2.dt.GridDatatype>,ucar.ma2.IsMissingEvaluator,ucar.nc2.dt.GridDatatype,UGridDatatype
-
Constructor Summary
ConstructorsConstructorDescriptionMeshVariable(UGridDataset dataset, ucar.nc2.dataset.VariableDS vs, UGridDataset.Meshset meshset) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ucar.nc2.dt.GridDatatype o) intucar.nc2.AttributeConvenience function; lookup Attribute by name.findAttValueIgnoreCase(String attName, String defaultValue) Convenience function; lookup Attribute value by name.List<ucar.nc2.Attribute>Get a List of Attribute specific to the Griducar.nc2.dt.GridCoordSystemucar.ma2.DataTypeget the data typeGet the description/long_name of the Griducar.nc2.DimensiongetDimension(int i) get the ith dimensionList<ucar.nc2.Dimension>Returns a List of Dimension containing the dimensions used by this grid.ucar.nc2.Dimensionget the ensemble Dimension, if it existsintget the ensemble Dimension index in the geogrid (canonical order), or -1 if nonegetInfo()human readable information about this Grid.get the Grid's Coordinate System.ucar.ma2.MAMath.MinMaxgetMinMaxSkipMissingData(ucar.ma2.Array a) Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).getName()Get the name of the GridGet the escaped name of the Griducar.unidata.geoloc.ProjectionImplget the Projection, if it exists.intgetRank()get the rankucar.nc2.Dimensionget the runtime Dimension, if it existsintget the runtime Dimension index in the geogrid (canonical order), or -1 if noneint[]getShape()get the shape (canonical ordering)ucar.nc2.Dimensionget the time Dimension, if it existsintget the time Dimension index in the geogrid (canonical order), or -1 if noneGet the unit stringucar.nc2.dataset.VariableDSGet the underlying Variable, if it exists.ucar.nc2.Dimensionget the x Dimension, if it existsintget the x Dimension index in the geogrid (canonical order)ucar.nc2.Dimensionget the y Dimension, if it existsintget the y Dimension index in the geogrid (canonical order)ucar.nc2.Dimensionget the z Dimension, if it existsintget the z Dimension index in the geogrid (canonical order), or -1 if nonebooleanbooleantrue if there may be missing databooleanisMissing(double val) booleanisMissingData(double val) if val is missing datamakeSubset(ucar.ma2.Range rt_range, ucar.ma2.Range e_range, ucar.ma2.Range t_range, ucar.ma2.Range z_range, ucar.ma2.Range y_range, ucar.ma2.Range x_range) Create a new GeoGrid that is a logical subset of this GeoGrid.makeSubset(ucar.ma2.Range t_range, ucar.ma2.Range z_range, ucar.unidata.geoloc.LatLonRect bbox, int z_stride, int y_stride, int x_stride) Create a new GeoGrid that is a logical subset of this GeoGrid.ucar.ma2.ArrayreadDataSlice(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).ucar.ma2.ArrayreadDataSlice(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).doublereadPointData(ucar.unidata.geoloc.LatLonPoint point) ucar.ma2.ArrayreadSubset(List<ucar.ma2.Range> subset) ucar.ma2.ArrayreadVolumeData(int t_index) Reads in the data "volume" at the given time index.float[]setMissingToNaN(float[] values) Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissing(val).voidsubsetToDataset(UGridDataset ugd, ucar.nc2.dataset.NetcdfDataset ncd, List<Cell> containedCells) subsetToSelf(ucar.unidata.geoloc.LatLonRect bounds)
-
Constructor Details
-
MeshVariable
public MeshVariable(UGridDataset dataset, ucar.nc2.dataset.VariableDS vs, UGridDataset.Meshset meshset)
-
-
Method Details
-
getFullName
- Specified by:
getFullNamein interfaceucar.nc2.dt.GridDatatype
-
getShortName
- Specified by:
getShortNamein interfaceucar.nc2.dt.GridDatatype
-
getName
Description copied from interface:UGridDatatypeGet the name of the Grid- Specified by:
getNamein interfaceucar.nc2.dt.GridDatatype- Specified by:
getNamein interfaceUGridDatatype- Returns:
- the name of the Grid
-
getNameEscaped
Description copied from interface:UGridDatatypeGet the escaped name of the Grid- Specified by:
getNameEscapedin interfaceUGridDatatype- Returns:
- the escaped name of the Grid
-
getConnectivityVariable
-
getDescription
Description copied from interface:UGridDatatypeGet the description/long_name of the Grid- Specified by:
getDescriptionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getDescriptionin interfaceUGridDatatype- Returns:
- the description/long_name of the Grid
-
getUnitsString
Description copied from interface:UGridDatatypeGet the unit string- Specified by:
getUnitsStringin interfaceucar.nc2.dt.GridDatatype- Specified by:
getUnitsStringin interfaceUGridDatatype- Returns:
- the unit string
-
getDataType
public ucar.ma2.DataType getDataType()Description copied from interface:UGridDatatypeget the data type- Specified by:
getDataTypein interfaceucar.nc2.dt.GridDatatype- Specified by:
getDataTypein interfaceUGridDatatype- Returns:
- the data type
-
getRank
public int getRank()Description copied from interface:UGridDatatypeget the rank- Specified by:
getRankin interfaceucar.nc2.dt.GridDatatype- Specified by:
getRankin interfaceUGridDatatype- Returns:
- the rank
-
getCellLocation
-
getShape
public int[] getShape()Description copied from interface:UGridDatatypeget the shape (canonical ordering)- Specified by:
getShapein interfaceucar.nc2.dt.GridDatatype- Specified by:
getShapein interfaceUGridDatatype- Returns:
- the shape (canonical ordering)
-
getAttributes
Description copied from interface:UGridDatatypeGet a List of Attribute specific to the Grid- Specified by:
getAttributesin interfaceucar.nc2.dt.GridDatatype- Specified by:
getAttributesin interfaceUGridDatatype- Returns:
- a List of Attribute
-
findAttributeIgnoreCase
Description copied from interface:UGridDatatypeConvenience function; lookup Attribute by name.- Specified by:
findAttributeIgnoreCasein interfaceucar.nc2.dt.GridDatatype- Specified by:
findAttributeIgnoreCasein interfaceUGridDatatype- Parameters:
name- the name of the attribute- Returns:
- the attribute, or null if not found
-
findAttValueIgnoreCase
Description copied from interface:UGridDatatypeConvenience function; lookup Attribute value by name. Must be String valued- Specified by:
findAttValueIgnoreCasein interfaceucar.nc2.dt.GridDatatype- Specified by:
findAttValueIgnoreCasein interfaceUGridDatatype- Parameters:
attName- name of the attributedefaultValue- if not found, use this as the default- Returns:
- Attribute string value, or default if not found.
-
getDimensions
Description copied from interface:UGridDatatypeReturns 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.- Specified by:
getDimensionsin interfaceucar.nc2.dt.GridDatatype- Specified by:
getDimensionsin interfaceUGridDatatype- Returns:
- List with objects of type Dimension, in canonical order.
-
getDimension
public ucar.nc2.Dimension getDimension(int i) Description copied from interface:UGridDatatypeget the ith dimension- Specified by:
getDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getDimensionin interfaceUGridDatatype- Parameters:
i- index of dimension- Returns:
- the ith dimension
-
getTimeDimension
public ucar.nc2.Dimension getTimeDimension()Description copied from interface:UGridDatatypeget the time Dimension, if it exists- Specified by:
getTimeDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getTimeDimensionin interfaceUGridDatatype- Returns:
- the time Dimension, or null
-
getZDimension
public ucar.nc2.Dimension getZDimension()Description copied from interface:UGridDatatypeget the z Dimension, if it exists- Specified by:
getZDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getZDimensionin interfaceUGridDatatype- Returns:
- the z Dimension, or null
-
getYDimension
public ucar.nc2.Dimension getYDimension()Description copied from interface:UGridDatatypeget the y Dimension, if it exists- Specified by:
getYDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getYDimensionin interfaceUGridDatatype- Returns:
- the y Dimension, or null
-
getXDimension
public ucar.nc2.Dimension getXDimension()Description copied from interface:UGridDatatypeget the x Dimension, if it exists- Specified by:
getXDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getXDimensionin interfaceUGridDatatype- Returns:
- the x Dimension, or null
-
getEnsembleDimension
public ucar.nc2.Dimension getEnsembleDimension()Description copied from interface:UGridDatatypeget the ensemble Dimension, if it exists- Specified by:
getEnsembleDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getEnsembleDimensionin interfaceUGridDatatype- Returns:
- the ensemble Dimension, or null
-
getRunTimeDimension
public ucar.nc2.Dimension getRunTimeDimension()Description copied from interface:UGridDatatypeget the runtime Dimension, if it exists- Specified by:
getRunTimeDimensionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getRunTimeDimensionin interfaceUGridDatatype- Returns:
- the runtime Dimension, or null
-
getTimeDimensionIndex
public int getTimeDimensionIndex()Description copied from interface:UGridDatatypeget the time Dimension index in the geogrid (canonical order), or -1 if none- Specified by:
getTimeDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getTimeDimensionIndexin interfaceUGridDatatype- Returns:
- the time Dimension index in canonical order, or -1
-
getZDimensionIndex
public int getZDimensionIndex()Description copied from interface:UGridDatatypeget the z Dimension index in the geogrid (canonical order), or -1 if none- Specified by:
getZDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getZDimensionIndexin interfaceUGridDatatype- Returns:
- the z Dimension index in canonical order, or -1
-
getYDimensionIndex
public int getYDimensionIndex()Description copied from interface:UGridDatatypeget the y Dimension index in the geogrid (canonical order)- Specified by:
getYDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getYDimensionIndexin interfaceUGridDatatype- Returns:
- the y Dimension index in canonical order, or -1
-
getXDimensionIndex
public int getXDimensionIndex()Description copied from interface:UGridDatatypeget the x Dimension index in the geogrid (canonical order)- Specified by:
getXDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getXDimensionIndexin interfaceUGridDatatype- Returns:
- the x Dimension index in canonical order, or -1
-
getEnsembleDimensionIndex
public int getEnsembleDimensionIndex()Description copied from interface:UGridDatatypeget the ensemble Dimension index in the geogrid (canonical order), or -1 if none- Specified by:
getEnsembleDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getEnsembleDimensionIndexin interfaceUGridDatatype- Returns:
- the ensemble Dimension index in canonical order, or -1
-
getRunTimeDimensionIndex
public int getRunTimeDimensionIndex()Description copied from interface:UGridDatatypeget the runtime Dimension index in the geogrid (canonical order), or -1 if none- Specified by:
getRunTimeDimensionIndexin interfaceucar.nc2.dt.GridDatatype- Specified by:
getRunTimeDimensionIndexin interfaceUGridDatatype- Returns:
- the runtime Dimension index in canonical order, or -1
-
getCoordinateSystem
public ucar.nc2.dt.GridCoordSystem getCoordinateSystem()- Specified by:
getCoordinateSystemin interfaceucar.nc2.dt.GridDatatype
-
getMeshset
Description copied from interface:UGridDatatypeget the Grid's Coordinate System.- Specified by:
getMeshsetin interfaceUGridDatatype- Returns:
- the Grid's Coordinate System.
-
getProjection
public ucar.unidata.geoloc.ProjectionImpl getProjection()Description copied from interface:UGridDatatypeget the Projection, if it exists.- Specified by:
getProjectionin interfaceucar.nc2.dt.GridDatatype- Specified by:
getProjectionin interfaceUGridDatatype- Returns:
- the Projection, or null
-
hasMissingData
public boolean hasMissingData()Description copied from interface:UGridDatatypetrue if there may be missing data- Specified by:
hasMissingDatain interfaceucar.nc2.dt.GridDatatype- Specified by:
hasMissingDatain interfaceUGridDatatype- Returns:
- true if there may be missing data
-
isMissingData
public boolean isMissingData(double val) Description copied from interface:UGridDatatypeif val is missing data- Specified by:
isMissingDatain interfaceucar.nc2.dt.GridDatatype- Specified by:
isMissingDatain interfaceUGridDatatype- Parameters:
val- test this value- Returns:
- true if val is missing data
-
getMinMaxSkipMissingData
public ucar.ma2.MAMath.MinMax getMinMaxSkipMissingData(ucar.ma2.Array a) Description copied from interface:UGridDatatypeGet the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).- Specified by:
getMinMaxSkipMissingDatain interfaceucar.nc2.dt.GridDatatype- Specified by:
getMinMaxSkipMissingDatain interfaceUGridDatatype- Parameters:
a- Array to get min/max values- Returns:
- both min and max value.
-
setMissingToNaN
public float[] setMissingToNaN(float[] values) Description copied from interface:UGridDatatypeConvert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissing(val).- Specified by:
setMissingToNaNin interfaceucar.nc2.dt.GridDatatype- Specified by:
setMissingToNaNin interfaceUGridDatatype- Parameters:
values- input array- Returns:
- input array, with missing values converted to NaNs.
-
readDataSlice
public ucar.ma2.Array readDataSlice(int rt_index, int e_index, int t_index, int z_index, int y_index, int x_index) throws IOException Description copied from interface:UGridDatatypeThis 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.- Specified by:
readDataSlicein interfaceucar.nc2.dt.GridDatatype- Specified by:
readDataSlicein interfaceUGridDatatype- 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
public ucar.ma2.Array readSubset(List<ucar.ma2.Range> subset) throws ucar.ma2.InvalidRangeException, IOException - Specified by:
readSubsetin interfaceucar.nc2.dt.GridDatatype- Throws:
ucar.ma2.InvalidRangeExceptionIOException
-
readDataSlice
public ucar.ma2.Array readDataSlice(int t_index, int z_index, int y_index, int x_index) throws IOException Description copied from interface:UGridDatatypeThis 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.- Specified by:
readDataSlicein interfaceucar.nc2.dt.GridDatatype- Specified by:
readDataSlicein interfaceUGridDatatype- 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
Description copied from interface:UGridDatatypeReads 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- Specified by:
readVolumeDatain interfaceucar.nc2.dt.GridDatatype- Specified by:
readVolumeDatain interfaceUGridDatatype- 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
public UGridDatatype makeSubset(ucar.ma2.Range rt_range, ucar.ma2.Range e_range, ucar.ma2.Range t_range, ucar.ma2.Range z_range, ucar.ma2.Range y_range, ucar.ma2.Range x_range) throws ucar.ma2.InvalidRangeException Description copied from interface:UGridDatatypeCreate a new GeoGrid that is a logical subset of this GeoGrid.- Specified by:
makeSubsetin interfaceucar.nc2.dt.GridDatatype- Specified by:
makeSubsetin interfaceUGridDatatype- 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:
ucar.ma2.InvalidRangeException- if ranges are invlaid
-
makeSubset
public UGridDatatype makeSubset(ucar.ma2.Range t_range, ucar.ma2.Range z_range, ucar.unidata.geoloc.LatLonRect bbox, int z_stride, int y_stride, int x_stride) throws ucar.ma2.InvalidRangeException Description copied from interface:UGridDatatypeCreate a new GeoGrid that is a logical subset of this GeoGrid. For backwards compatibility for grids with no runtime or ensemble dimensions.- Specified by:
makeSubsetin interfaceucar.nc2.dt.GridDatatype- Specified by:
makeSubsetin interfaceUGridDatatype- 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:
ucar.ma2.InvalidRangeException- if ranges are invlaid
-
subsetToDataset
public void subsetToDataset(UGridDataset ugd, ucar.nc2.dataset.NetcdfDataset ncd, List<Cell> containedCells) -
subsetToSelf
-
readPointData
- Specified by:
readPointDatain interfaceUGridDatatype- Throws:
IOException
-
getInfo
Description copied from interface:UGridDatatypehuman readable information about this Grid.- Specified by:
getInfoin interfaceucar.nc2.dt.GridDatatype- Specified by:
getInfoin interfaceUGridDatatype- Returns:
- human readable information about this Grid.
-
getVariable
public ucar.nc2.dataset.VariableDS getVariable()Description copied from interface:UGridDatatypeGet the underlying Variable, if it exists.- Specified by:
getVariablein interfaceucar.nc2.dt.GridDatatype- Specified by:
getVariablein interfaceUGridDatatype- Returns:
- the underlying Variable, if it exists, else null
-
compareTo
-
compareTo
public int compareTo(ucar.nc2.dt.GridDatatype o) - Specified by:
compareToin interfaceComparable<ucar.nc2.dt.GridDatatype>
-
hasMissing
public boolean hasMissing()- Specified by:
hasMissingin interfaceucar.ma2.IsMissingEvaluator
-
isMissing
public boolean isMissing(double val) - Specified by:
isMissingin interfaceucar.ma2.IsMissingEvaluator
-