Class GridDataset

  • All Implemented Interfaces:
    Closeable, AutoCloseable, GridDataset, FeatureDataset, FileCacheable

    public class GridDataset
    extends Object
    implements GridDataset, FeatureDataset
    Make a NetcdfDataset into a collection of GeoGrids with Georeferencing coordinate systems.

    A variable will be made into a GeoGrid if it has a Georeferencing coordinate system, using GridCoordSys.isGridCoordSys(), and it has no extra dimensions, ie GridCoordSys.isComplete( var) is true. If it has multiple Georeferencing coordinate systems, any one that is a product set will be given preference.

    Example:

     GridDataset gridDs = GridDataset.open(uriString);
     List grids = gridDs.getGrids();
     for (int i = 0; i < grids.size(); i++) {
       GeoGrid grid = (Geogrid) grids.get(i);
     }
     
    • Constructor Detail

      • GridDataset

        public GridDataset​(NetcdfDataset ncd)
                    throws IOException
        Create a GridDataset from a NetcdfDataset.
        Parameters:
        ncd - underlying NetcdfDataset, will do Enhance.CoordSystems if not already done.
        Throws:
        IOException - on read error
      • GridDataset

        public GridDataset​(NetcdfDataset ncd,
                           Formatter parseInfo)
                    throws IOException
        Create a GridDataset from a NetcdfDataset.
        Parameters:
        ncd - underlying NetcdfDataset, will do Enhance.CoordSystems if not already done.
        parseInfo - put parse info here, may be null
        Throws:
        IOException - on read error
    • Method Detail

      • getDescription

        public String getDescription()
        Description copied from interface: FeatureDataset
        Text information about this dataset.
        Specified by:
        getDescription in interface FeatureDataset
        Returns:
        any text information about this dataset, or null.
      • getDateRange

        public DateRange getDateRange()
        Deprecated.
        use getCalendarDateRange
      • getStartDate

        public Date getStartDate()
        Deprecated.
        use getStartCalendarDate
      • getEndDate

        public Date getEndDate()
        Deprecated.
        use getEndCalendarDate
      • getCalendarDateStart

        public CalendarDate getCalendarDateStart()
        Description copied from interface: FeatureDataset
        Starting Calendar date for the entire dataset.
        Specified by:
        getCalendarDateStart in interface FeatureDataset
        Returns:
        the starting date for the entire dataset, or null if unknown
      • getCalendarDateEnd

        public CalendarDate getCalendarDateEnd()
        Description copied from interface: FeatureDataset
        Ending Calendar date for the entire dataset.
        Specified by:
        getCalendarDateEnd in interface FeatureDataset
        Returns:
        the ending date for the entire dataset, or null if unknown
      • getBoundingBox

        public LatLonRect getBoundingBox()
        Description copied from interface: FeatureDataset
        The lat/lon boundingBox for the entire dataset.
        Specified by:
        getBoundingBox in interface FeatureDataset
        Returns:
        the lat/lon boundingBox for the entire dataset, or null if unknown.
      • calcBounds

        public void calcBounds()
      • getDataVariables

        public List<VariableSimpleIF> getDataVariables()
        Description copied from interface: FeatureDataset
        The data Variables available in this dataset. Should just be data variables others might be searching for, not metadata or coordinate system variables, etc. The shapes of the VariableSimpleIF do not necessarily match the StructureData member.
        Specified by:
        getDataVariables in interface FeatureDataset
        Returns:
        List of subclass of VariableSimpleIF, may be empty but not null
      • getNetcdfFile

        public NetcdfFile getNetcdfFile()
        Description copied from interface: FeatureDataset
        Return underlying NetcdfFile, or null if none.
        Specified by:
        getNetcdfFile in interface FeatureDataset
        Returns:
        the underlying NetcdfFile, or null if none.
      • getName

        public String getName()
        the name of the dataset is the last part of the location
        Returns:
        the name of the dataset
      • getNetcdfDataset

        public NetcdfDataset getNetcdfDataset()
        Returns:
        the underlying NetcdfDataset
      • getGrids

        public List<GridDatatype> getGrids()
        Description copied from interface: GridDataset
        get the list of GridDatatype objects contained in this dataset.
        Specified by:
        getGrids in interface GridDataset
        Returns:
        the list of GeoGrid objects contained in this dataset.
      • findGridDatatype

        public GridDatatype findGridDatatype​(String name)
        Description copied from interface: GridDataset
        find the named GridDatatype.
        Specified by:
        findGridDatatype in interface GridDataset
        Parameters:
        name - full unescaped name
        Returns:
        the named GridDatatype, or null if not found
      • getGridsets

        public List<GridDataset.Gridset> getGridsets()
        Return GridDatatype objects grouped by GridCoordSys. All GridDatatype in a Gridset have the same GridCoordSystem.
        Specified by:
        getGridsets in interface GridDataset
        Returns:
        List of type ucar.nc2.dt.GridDataset.Gridset
      • findGridByName

        public GeoGrid findGridByName​(String fullName)
        find the named GeoGrid.
        Parameters:
        fullName - find this GeoGrid by full name
        Returns:
        the named GeoGrid, or null if not found
      • findGridByShortName

        public GeoGrid findGridByShortName​(String shortName)
        find the named GeoGrid.
        Specified by:
        findGridByShortName in interface GridDataset
        Parameters:
        shortName - find this GeoGrid by short name
        Returns:
        the named GeoGrid, or null if not found
      • findGridDatatypeByAttribute

        public GeoGrid findGridDatatypeByAttribute​(String attName,
                                                   String attValue)
      • getDetailInfo

        public String getDetailInfo()
        Get Details about the dataset.
      • getDetailInfo

        public void getDetailInfo​(Formatter buff)
        Description copied from interface: FeatureDataset
        Show debug / underlying implementation details
        Specified by:
        getDetailInfo in interface FeatureDataset
        Parameters:
        buff - append info here
      • release

        @Deprecated
        public void release()
                     throws IOException
        Deprecated.
        do not use
        Description copied from interface: FileCacheable
        Release any system resources like file handles. Optional, implement only if you are able to reacquire. Used when object is made inactive in cache.
        Specified by:
        release in interface FileCacheable
        Throws:
        IOException
      • getLastModified

        public long getLastModified()
        Description copied from interface: FileCacheable
        Returns the time that the underlying file(s) were last modified. If they've changed since they were stored in the cache, they will be closed and reopened with FileFactory.
        Specified by:
        getLastModified in interface FileCacheable
        Returns:
        a long value representing the time the file(s) were last modified or 0L if the last-modified time couldn't be determined for any reason.
      • setFileCache

        @Deprecated
        public void setFileCache​(FileCacheIF fileCache)
        Deprecated.
        do not use
        Description copied from interface: FileCacheable
        If the FileCache is not null, FileCacheable.close() must call FileCache.release()
         public synchronized void close() throws java.io.IOException {
           if (cache != null) {
             if (cache.release(this))
               return;
           }
         
           reallyClose();
         }
         
        Specified by:
        setFileCache in interface FileCacheable
        Parameters:
        fileCache - must store this, use it on close as above.
      • factory

        public static GridDataset factory​(String netcdfFileURI)
                                   throws IOException
        Deprecated.
        : use GridDataset.open().
        Open a netcdf dataset, parse Conventions, find all the geoGrids, return a GridDataset.
        Throws:
        IOException