Class Aggregation

  • All Implemented Interfaces:
    AggregationIF
    Direct Known Subclasses:
    AggregationNew

    public abstract class Aggregation
    extends Object
    implements AggregationIF
    Superclass for NcML Aggregation Builder. An Aggregation acts as a ProxyReader for VariableDS. That, is it must implement:
     public Array read(Variable mainv);
     
     public Array read(Variable mainv, Section section);
     
    • Field Detail

      • logger

        protected static org.slf4j.Logger logger
      • diskCache2

        protected static DiskCache2 diskCache2
      • executor

        protected static Executor executor
      • debug

        protected static boolean debug
      • debugOpenFile

        protected static boolean debugOpenFile
      • debugSyncDetail

        protected static boolean debugSyncDetail
      • debugProxy

        protected static boolean debugProxy
      • debugRead

        protected static boolean debugRead
      • debugDateParse

        protected static boolean debugDateParse
      • debugConvert

        protected static boolean debugConvert
      • spiObject

        protected Object spiObject
      • explicitDatasets

        protected List<ucar.nc2.internal.ncml.AggDataset> explicitDatasets
      • datasets

        protected List<ucar.nc2.internal.ncml.AggDataset> datasets
      • cacheDirty

        protected boolean cacheDirty
      • dimName

        protected String dimName
      • dateFormatMark

        protected String dateFormatMark
      • isDate

        protected boolean isDate
    • Constructor Detail

      • Aggregation

        protected Aggregation​(NetcdfDataset.Builder ncd,
                              String dimName,
                              Aggregation.Type type,
                              String recheckS)
        Create an Aggregation for the given NetcdfDataset. The following addXXXX methods are called, then build(), before the object is ready for use.
        Parameters:
        ncd - Aggregation belongs to this NetcdfDataset
        dimName - the aggregation dimension name
        type - the Aggregation.Type
        recheckS - how often to check if files have changes
    • Method Detail

      • setPersistenceCache

        public static void setPersistenceCache​(DiskCache2 dc)
      • setExecutor

        public static void setExecutor​(Executor exec)
      • setTypicalDatasetMode

        public static void setTypicalDatasetMode​(String mode)
      • addExplicitDataset

        public void addExplicitDataset​(String cacheName,
                                       String location,
                                       String id,
                                       String ncoordS,
                                       String coordValueS,
                                       String sectionSpec,
                                       FileFactory reader)
        Add a nested dataset, specified by an explicit netcdf element. enhance is handled by the reader, so its always false here.
        Parameters:
        cacheName - a unique name to use for caching
        location - attribute "location" on the netcdf element
        id - attribute "id" on the netcdf element
        ncoordS - attribute "ncoords" on the netcdf element
        coordValueS - attribute "coordValue" on the netcdf element
        sectionSpec - attribute "section" on the netcdf element
        reader - factory for reading this netcdf dataset
      • addDataset

        public void addDataset​(ucar.nc2.internal.ncml.AggDataset nested)
      • addDatasetScan

        public void addDatasetScan​(org.jdom2.Element crawlableDatasetElement,
                                   String dirName,
                                   String suffix,
                                   String regexpPatternString,
                                   String dateFormatMark,
                                   Set<NetcdfDataset.Enhance> enhanceMode,
                                   String subdirs,
                                   String olderThan)
        Add a dataset scan
        Parameters:
        crawlableDatasetElement - defines a CrawlableDataset, or null
        dirName - scan this directory
        suffix - filter on this suffix (may be null)
        regexpPatternString - include if full name matches this regular expression (may be null)
        dateFormatMark - create dates from the filename (may be null)
        enhanceMode - how should files be enhanced
        subdirs - equals "false" if should not descend into subdirectories
        olderThan - files must be older than this time (now - lastModified >= olderThan); must be a time unit, may ne bull
      • addCollection

        public void addCollection​(String spec,
                                  String olderThan)
      • setModifications

        public void setModifications​(org.jdom2.Element ncmlMods)
      • getType

        public Aggregation.Type getType()
        Get type of aggregation
        Returns:
        type of aggregation
      • getDimensionName

        public String getDimensionName()
        Get dimension name to join on
        Returns:
        dimension name or null if type union/tiled
      • getLocation

        protected String getLocation()
      • syncExtend

        public boolean syncExtend()
                           throws IOException
        Check to see if its time to rescan directory, and if so, rescan and extend dataset if needed. Note that this just calls sync(), so structural metadata may be modified (!!)
        Specified by:
        syncExtend in interface AggregationIF
        Returns:
        true if directory was rescanned and dataset may have been updated
        Throws:
        IOException - on io error
      • buildNetcdfDataset

        protected abstract void buildNetcdfDataset​(CancelTask cancelTask)
                                            throws IOException
        Call this to build the dataset objects in the NetcdfDataset
        Parameters:
        cancelTask - maybe cancel
        Throws:
        IOException - on read error
      • persistRead

        protected void persistRead()
        read info from the persistent XML file, if it exists; overridden in AggregationExisting
      • getDatasets

        public List<ucar.nc2.internal.ncml.AggDataset> getDatasets()
      • makeDatasets

        protected void makeDatasets​(CancelTask cancelTask)
                             throws IOException
        Make the list of Datasets, from explicit and scans.
        Parameters:
        cancelTask - user can cancel
        Throws:
        IOException - on i/o error
      • getTypicalDataset

        protected ucar.nc2.internal.ncml.AggDataset getTypicalDataset()
                                                               throws IOException
        Open one of the nested datasets as a template for the aggregation dataset.
        Returns:
        a typical Dataset
        Throws:
        IOException - if there are no datasets
      • makeDataset

        protected ucar.nc2.internal.ncml.AggDataset makeDataset​(String cacheName,
                                                                String location,
                                                                String id,
                                                                String ncoordS,
                                                                String coordValueS,
                                                                String sectionSpec,
                                                                EnumSet<NetcdfDataset.Enhance> enhance,
                                                                FileFactory reader)
        Dataset factory, so subclasses can override
        Parameters:
        cacheName - a unique name to use for caching
        location - attribute "location" on the netcdf element
        id - attribute "id" on the netcdf element
        ncoordS - attribute "ncoords" on the netcdf element
        coordValueS - attribute "coordValue" on the netcdf element
        sectionSpec - attribute "sectionSpec" on the netcdf element
        enhance - open dataset in enhance mode NOT USED
        reader - factory for reading this netcdf dataset
        Returns:
        a Dataset
      • makeDataset

        protected ucar.nc2.internal.ncml.AggDataset makeDataset​(MFile dset)