Class 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 Detail

      • DtCoverage

        public DtCoverage​(DtCoverageDataset dataset,
                          DtCoverageCS gcs,
                          VariableDS dsvar)
        Constructor.
        Parameters:
        dataset - belongs to this dataset
        dsvar - wraps this Variable
        gcs - 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 attribute
        defaultValue - 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()
      • 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 interface IsMissingEvaluator
        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 interface IsMissingEvaluator
        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.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Override Object.hashCode() to be consistent with equals.
        Overrides:
        hashCode in class Object
      • getInfo

        public String getInfo()
        nicely formatted information
      • compareTo

        public int compareTo​(DtCoverage g)