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

public class MeshVariable extends Object implements UGridDatatype
  • Constructor Details

  • Method Details

    • getFullName

      public String getFullName()
      Specified by:
      getFullName in interface ucar.nc2.dt.GridDatatype
    • getShortName

      public String getShortName()
      Specified by:
      getShortName in interface ucar.nc2.dt.GridDatatype
    • getName

      public String getName()
      Description copied from interface: UGridDatatype
      Get the name of the Grid
      Specified by:
      getName in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getName in interface UGridDatatype
      Returns:
      the name of the Grid
    • getNameEscaped

      public String getNameEscaped()
      Description copied from interface: UGridDatatype
      Get the escaped name of the Grid
      Specified by:
      getNameEscaped in interface UGridDatatype
      Returns:
      the escaped name of the Grid
    • getConnectivityVariable

      public Topology getConnectivityVariable()
    • getDescription

      public String getDescription()
      Description copied from interface: UGridDatatype
      Get the description/long_name of the Grid
      Specified by:
      getDescription in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getDescription in interface UGridDatatype
      Returns:
      the description/long_name of the Grid
    • getUnitsString

      public String getUnitsString()
      Description copied from interface: UGridDatatype
      Get the unit string
      Specified by:
      getUnitsString in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getUnitsString in interface UGridDatatype
      Returns:
      the unit string
    • getDataType

      public ucar.ma2.DataType getDataType()
      Description copied from interface: UGridDatatype
      get the data type
      Specified by:
      getDataType in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getDataType in interface UGridDatatype
      Returns:
      the data type
    • getRank

      public int getRank()
      Description copied from interface: UGridDatatype
      get the rank
      Specified by:
      getRank in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getRank in interface UGridDatatype
      Returns:
      the rank
    • getCellLocation

      public String getCellLocation()
    • getShape

      public int[] getShape()
      Description copied from interface: UGridDatatype
      get the shape (canonical ordering)
      Specified by:
      getShape in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getShape in interface UGridDatatype
      Returns:
      the shape (canonical ordering)
    • getAttributes

      public List<ucar.nc2.Attribute> getAttributes()
      Description copied from interface: UGridDatatype
      Get a List of Attribute specific to the Grid
      Specified by:
      getAttributes in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getAttributes in interface UGridDatatype
      Returns:
      a List of Attribute
    • findAttributeIgnoreCase

      public ucar.nc2.Attribute findAttributeIgnoreCase(String name)
      Description copied from interface: UGridDatatype
      Convenience function; lookup Attribute by name.
      Specified by:
      findAttributeIgnoreCase in interface ucar.nc2.dt.GridDatatype
      Specified by:
      findAttributeIgnoreCase in interface UGridDatatype
      Parameters:
      name - the name of the attribute
      Returns:
      the attribute, or null if not found
    • findAttValueIgnoreCase

      public String findAttValueIgnoreCase(String attName, String defaultValue)
      Description copied from interface: UGridDatatype
      Convenience function; lookup Attribute value by name. Must be String valued
      Specified by:
      findAttValueIgnoreCase in interface ucar.nc2.dt.GridDatatype
      Specified by:
      findAttValueIgnoreCase in interface UGridDatatype
      Parameters:
      attName - name of the attribute
      defaultValue - if not found, use this as the default
      Returns:
      Attribute string value, or default if not found.
    • getDimensions

      public List<ucar.nc2.Dimension> getDimensions()
      Description copied from interface: UGridDatatype
      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.
      Specified by:
      getDimensions in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getDimensions in interface UGridDatatype
      Returns:
      List with objects of type Dimension, in canonical order.
    • getDimension

      public ucar.nc2.Dimension getDimension(int i)
      Description copied from interface: UGridDatatype
      get the ith dimension
      Specified by:
      getDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getDimension in interface UGridDatatype
      Parameters:
      i - index of dimension
      Returns:
      the ith dimension
    • getTimeDimension

      public ucar.nc2.Dimension getTimeDimension()
      Description copied from interface: UGridDatatype
      get the time Dimension, if it exists
      Specified by:
      getTimeDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getTimeDimension in interface UGridDatatype
      Returns:
      the time Dimension, or null
    • getZDimension

      public ucar.nc2.Dimension getZDimension()
      Description copied from interface: UGridDatatype
      get the z Dimension, if it exists
      Specified by:
      getZDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getZDimension in interface UGridDatatype
      Returns:
      the z Dimension, or null
    • getYDimension

      public ucar.nc2.Dimension getYDimension()
      Description copied from interface: UGridDatatype
      get the y Dimension, if it exists
      Specified by:
      getYDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getYDimension in interface UGridDatatype
      Returns:
      the y Dimension, or null
    • getXDimension

      public ucar.nc2.Dimension getXDimension()
      Description copied from interface: UGridDatatype
      get the x Dimension, if it exists
      Specified by:
      getXDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getXDimension in interface UGridDatatype
      Returns:
      the x Dimension, or null
    • getEnsembleDimension

      public ucar.nc2.Dimension getEnsembleDimension()
      Description copied from interface: UGridDatatype
      get the ensemble Dimension, if it exists
      Specified by:
      getEnsembleDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getEnsembleDimension in interface UGridDatatype
      Returns:
      the ensemble Dimension, or null
    • getRunTimeDimension

      public ucar.nc2.Dimension getRunTimeDimension()
      Description copied from interface: UGridDatatype
      get the runtime Dimension, if it exists
      Specified by:
      getRunTimeDimension in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getRunTimeDimension in interface UGridDatatype
      Returns:
      the runtime Dimension, or null
    • getTimeDimensionIndex

      public int getTimeDimensionIndex()
      Description copied from interface: UGridDatatype
      get the time Dimension index in the geogrid (canonical order), or -1 if none
      Specified by:
      getTimeDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getTimeDimensionIndex in interface UGridDatatype
      Returns:
      the time Dimension index in canonical order, or -1
    • getZDimensionIndex

      public int getZDimensionIndex()
      Description copied from interface: UGridDatatype
      get the z Dimension index in the geogrid (canonical order), or -1 if none
      Specified by:
      getZDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getZDimensionIndex in interface UGridDatatype
      Returns:
      the z Dimension index in canonical order, or -1
    • getYDimensionIndex

      public int getYDimensionIndex()
      Description copied from interface: UGridDatatype
      get the y Dimension index in the geogrid (canonical order)
      Specified by:
      getYDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getYDimensionIndex in interface UGridDatatype
      Returns:
      the y Dimension index in canonical order, or -1
    • getXDimensionIndex

      public int getXDimensionIndex()
      Description copied from interface: UGridDatatype
      get the x Dimension index in the geogrid (canonical order)
      Specified by:
      getXDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getXDimensionIndex in interface UGridDatatype
      Returns:
      the x Dimension index in canonical order, or -1
    • getEnsembleDimensionIndex

      public int getEnsembleDimensionIndex()
      Description copied from interface: UGridDatatype
      get the ensemble Dimension index in the geogrid (canonical order), or -1 if none
      Specified by:
      getEnsembleDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getEnsembleDimensionIndex in interface UGridDatatype
      Returns:
      the ensemble Dimension index in canonical order, or -1
    • getRunTimeDimensionIndex

      public int getRunTimeDimensionIndex()
      Description copied from interface: UGridDatatype
      get the runtime Dimension index in the geogrid (canonical order), or -1 if none
      Specified by:
      getRunTimeDimensionIndex in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getRunTimeDimensionIndex in interface UGridDatatype
      Returns:
      the runtime Dimension index in canonical order, or -1
    • getCoordinateSystem

      public ucar.nc2.dt.GridCoordSystem getCoordinateSystem()
      Specified by:
      getCoordinateSystem in interface ucar.nc2.dt.GridDatatype
    • getMeshset

      public UGridDataset.Meshset getMeshset()
      Description copied from interface: UGridDatatype
      get the Grid's Coordinate System.
      Specified by:
      getMeshset in interface UGridDatatype
      Returns:
      the Grid's Coordinate System.
    • getProjection

      public ucar.unidata.geoloc.ProjectionImpl getProjection()
      Description copied from interface: UGridDatatype
      get the Projection, if it exists.
      Specified by:
      getProjection in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getProjection in interface UGridDatatype
      Returns:
      the Projection, or null
    • hasMissingData

      public boolean hasMissingData()
      Description copied from interface: UGridDatatype
      true if there may be missing data
      Specified by:
      hasMissingData in interface ucar.nc2.dt.GridDatatype
      Specified by:
      hasMissingData in interface UGridDatatype
      Returns:
      true if there may be missing data
    • isMissingData

      public boolean isMissingData(double val)
      Description copied from interface: UGridDatatype
      if val is missing data
      Specified by:
      isMissingData in interface ucar.nc2.dt.GridDatatype
      Specified by:
      isMissingData in interface UGridDatatype
      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: UGridDatatype
      Get the minimum and the maximum data value of the previously read Array, skipping missing values as defined by isMissingData(double val).
      Specified by:
      getMinMaxSkipMissingData in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getMinMaxSkipMissingData in interface UGridDatatype
      Parameters:
      a - Array to get min/max values
      Returns:
      both min and max value.
    • setMissingToNaN

      public float[] setMissingToNaN(float[] values)
      Description copied from interface: UGridDatatype
      Convert (in place) all values in the given array that are considered as "missing" to Float.NaN, according to isMissing(val).
      Specified by:
      setMissingToNaN in interface ucar.nc2.dt.GridDatatype
      Specified by:
      setMissingToNaN in interface UGridDatatype
      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: UGridDatatype
      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.
      Specified by:
      readDataSlice in interface ucar.nc2.dt.GridDatatype
      Specified by:
      readDataSlice in interface UGridDatatype
      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:
      readSubset in interface ucar.nc2.dt.GridDatatype
      Throws:
      ucar.ma2.InvalidRangeException
      IOException
    • readDataSlice

      public ucar.ma2.Array readDataSlice(int t_index, int z_index, int y_index, int x_index) throws IOException
      Description copied from interface: UGridDatatype
      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.
      Specified by:
      readDataSlice in interface ucar.nc2.dt.GridDatatype
      Specified by:
      readDataSlice in interface UGridDatatype
      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

      public ucar.ma2.Array readVolumeData(int t_index) throws IOException
      Description copied from interface: UGridDatatype
      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
      Specified by:
      readVolumeData in interface ucar.nc2.dt.GridDatatype
      Specified by:
      readVolumeData in interface UGridDatatype
      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: UGridDatatype
      Create a new GeoGrid that is a logical subset of this GeoGrid.
      Specified by:
      makeSubset in interface ucar.nc2.dt.GridDatatype
      Specified by:
      makeSubset in interface UGridDatatype
      Parameters:
      rt_range - subset the runtime dimension, or null if you want all of it
      e_range - subset the ensemble dimension, or null if you want all of it
      t_range - subset the time dimension, or null if you want all of it
      z_range - subset the vertical dimension, or null if you want all of it
      y_range - subset the y dimension, or null if you want all of it
      x_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: UGridDatatype
      Create a new GeoGrid that is a logical subset of this GeoGrid. For backwards compatibility for grids with no runtime or ensemble dimensions.
      Specified by:
      makeSubset in interface ucar.nc2.dt.GridDatatype
      Specified by:
      makeSubset in interface UGridDatatype
      Parameters:
      t_range - subset the time dimension, or null if you want all of it
      z_range - subset the vertical dimension, or null if you want all of it
      bbox - a lat/lon bounding box, or null if you want all x,y
      z_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

      public UGridDataset subsetToSelf(ucar.unidata.geoloc.LatLonRect bounds)
    • readPointData

      public double readPointData(ucar.unidata.geoloc.LatLonPoint point) throws IOException
      Specified by:
      readPointData in interface UGridDatatype
      Throws:
      IOException
    • getInfo

      public String getInfo()
      Description copied from interface: UGridDatatype
      human readable information about this Grid.
      Specified by:
      getInfo in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getInfo in interface UGridDatatype
      Returns:
      human readable information about this Grid.
    • getVariable

      public ucar.nc2.dataset.VariableDS getVariable()
      Description copied from interface: UGridDatatype
      Get the underlying Variable, if it exists.
      Specified by:
      getVariable in interface ucar.nc2.dt.GridDatatype
      Specified by:
      getVariable in interface UGridDatatype
      Returns:
      the underlying Variable, if it exists, else null
    • compareTo

      public int compareTo(UGridDatatype g)
    • compareTo

      public int compareTo(ucar.nc2.dt.GridDatatype o)
      Specified by:
      compareTo in interface Comparable<ucar.nc2.dt.GridDatatype>
    • hasMissing

      public boolean hasMissing()
      Specified by:
      hasMissing in interface ucar.ma2.IsMissingEvaluator
    • isMissing

      public boolean isMissing(double val)
      Specified by:
      isMissing in interface ucar.ma2.IsMissingEvaluator