Package ucar.nc2.dt

Interface UGridDatatype

  • All Superinterfaces:
    Comparable<ucar.nc2.dt.GridDatatype>, ucar.nc2.dt.GridDatatype, ucar.ma2.IsMissingEvaluator
    All Known Implementing Classes:
    MeshVariable

    public interface UGridDatatype
    extends ucar.nc2.dt.GridDatatype
    Interface for scientific datatype Grid.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ucar.nc2.Attribute findAttributeIgnoreCase​(String name)
      Convenience function; lookup Attribute by name.
      String findAttValueIgnoreCase​(String attName, String defaultValue)
      Convenience function; lookup Attribute value by name.
      List<ucar.nc2.Attribute> getAttributes()
      Get a List of Attribute specific to the Grid
      ucar.ma2.DataType getDataType()
      get the data type
      String getDescription()
      Get the description/long_name of the Grid
      ucar.nc2.Dimension getDimension​(int i)
      get the ith dimension
      List<ucar.nc2.Dimension> getDimensions()
      Returns a List of Dimension containing the dimensions used by this grid.
      ucar.nc2.Dimension getEnsembleDimension()
      get the ensemble Dimension, if it exists
      int getEnsembleDimensionIndex()
      get the ensemble Dimension index in the geogrid (canonical order), or -1 if none
      String getInfo()
      human readable information about this Grid.
      UGridDataset.Meshset getMeshset()
      get the Grid's Coordinate System.
      ucar.ma2.MAMath.MinMax getMinMaxSkipMissingData​(ucar.ma2.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()
      Get the name of the Grid
      String getNameEscaped()
      Get the escaped name of the Grid
      ucar.unidata.geoloc.ProjectionImpl getProjection()
      get the Projection, if it exists.
      int getRank()
      get the rank
      ucar.nc2.Dimension getRunTimeDimension()
      get the runtime Dimension, if it exists
      int getRunTimeDimensionIndex()
      get the runtime Dimension index in the geogrid (canonical order), or -1 if none
      int[] getShape()
      get the shape (canonical ordering)
      ucar.nc2.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
      String getUnitsString()
      Get the unit string
      ucar.nc2.dataset.VariableDS getVariable()
      Get the underlying Variable, if it exists.
      ucar.nc2.Dimension getXDimension()
      get the x Dimension, if it exists
      int getXDimensionIndex()
      get the x Dimension index in the geogrid (canonical order)
      ucar.nc2.Dimension getYDimension()
      get the y Dimension, if it exists
      int getYDimensionIndex()
      get the y Dimension index in the geogrid (canonical order)
      ucar.nc2.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
      boolean hasMissingData()
      true if there may be missing data
      boolean isMissingData​(double val)
      if val is missing data
      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)
      Create a new GeoGrid that is a logical subset of this GeoGrid.
      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)
      Create a new GeoGrid that is a logical subset of this GeoGrid.
      ucar.ma2.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).
      ucar.ma2.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).
      double readPointData​(ucar.unidata.geoloc.LatLonPoint point)  
      ucar.ma2.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 ucar.nc2.dt.GridDatatype

        getCoordinateSystem, getFullName, getShortName, readSubset
      • Methods inherited from interface ucar.ma2.IsMissingEvaluator

        hasMissing, isMissing
    • Method Detail

      • getName

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

        String getNameEscaped()
        Get the escaped name of the Grid
        Returns:
        the escaped name of the Grid
      • getDescription

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

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

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

        int getRank()
        get the rank
        Specified by:
        getRank in interface ucar.nc2.dt.GridDatatype
        Returns:
        the rank
      • getShape

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

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

        ucar.nc2.Attribute findAttributeIgnoreCase​(String name)
        Convenience function; lookup Attribute by name.
        Specified by:
        findAttributeIgnoreCase in interface ucar.nc2.dt.GridDatatype
        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
        Specified by:
        findAttValueIgnoreCase in interface ucar.nc2.dt.GridDatatype
        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

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

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

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

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

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

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

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

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

        int getTimeDimensionIndex()
        get the time Dimension index in the geogrid (canonical order), or -1 if none
        Specified by:
        getTimeDimensionIndex in interface ucar.nc2.dt.GridDatatype
        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
        Specified by:
        getZDimensionIndex in interface ucar.nc2.dt.GridDatatype
        Returns:
        the z Dimension index in canonical order, or -1
      • getYDimensionIndex

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

        int getXDimensionIndex()
        get the x Dimension index in the geogrid (canonical order)
        Specified by:
        getXDimensionIndex in interface ucar.nc2.dt.GridDatatype
        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
        Specified by:
        getEnsembleDimensionIndex in interface ucar.nc2.dt.GridDatatype
        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
        Specified by:
        getRunTimeDimensionIndex in interface ucar.nc2.dt.GridDatatype
        Returns:
        the runtime Dimension index in canonical order, or -1
      • getMeshset

        UGridDataset.Meshset getMeshset()
        get the Grid's Coordinate System.
        Returns:
        the Grid's Coordinate System.
      • getProjection

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

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

        boolean isMissingData​(double val)
        if val is missing data
        Specified by:
        isMissingData in interface ucar.nc2.dt.GridDatatype
        Parameters:
        val - test this value
        Returns:
        true if val is missing data
      • getMinMaxSkipMissingData

        ucar.ma2.MAMath.MinMax getMinMaxSkipMissingData​(ucar.ma2.Array data)
        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
        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).
        Specified by:
        setMissingToNaN in interface ucar.nc2.dt.GridDatatype
        Parameters:
        data - input array
        Returns:
        input array, with missing values converted to NaNs.
      • readDataSlice

        ucar.ma2.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.
        Specified by:
        readDataSlice in interface ucar.nc2.dt.GridDatatype
        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
      • readDataSlice

        ucar.ma2.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.
        Specified by:
        readDataSlice in interface ucar.nc2.dt.GridDatatype
        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

        ucar.ma2.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
        Specified by:
        readVolumeData in interface ucar.nc2.dt.GridDatatype
        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

        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
        Create a new GeoGrid that is a logical subset of this GeoGrid.
        Specified by:
        makeSubset in interface ucar.nc2.dt.GridDatatype
        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

        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
        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
        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
      • readPointData

        double readPointData​(ucar.unidata.geoloc.LatLonPoint point)
                      throws IOException
        Throws:
        IOException
      • getInfo

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

        ucar.nc2.dataset.VariableDS getVariable()
        Get the underlying Variable, if it exists.
        Specified by:
        getVariable in interface ucar.nc2.dt.GridDatatype
        Returns:
        the underlying Variable, if it exists, else null