Class GribCdmIndex

  • All Implemented Interfaces:
    thredds.inventory.partition.IndexReader

    public class GribCdmIndex
    extends Object
    implements thredds.inventory.partition.IndexReader
    Utilities for creating GRIB CDM index (ncx) files, both collections and partitions. Can be used as a standalone program. TODO review - is this working?
    • Field Detail

      • gribCollectionCache

        public static ucar.nc2.util.cache.FileCacheIF gribCollectionCache
    • Constructor Detail

      • GribCdmIndex

        public GribCdmIndex​(org.slf4j.Logger logger)
    • Method Detail

      • initDefaultCollectionCache

        public static void initDefaultCollectionCache​(int minElementsInMemory,
                                                      int maxElementsInMemory,
                                                      int period)
      • disableGribCollectionCache

        public static void disableGribCollectionCache()
      • setGribCollectionCache

        public static void setGribCollectionCache​(ucar.nc2.util.cache.FileCacheIF cache)
      • shutdown

        public static void shutdown()
      • getTopIndexFileFromConfig

        public static File getTopIndexFileFromConfig​(thredds.featurecollection.FeatureCollectionConfig config)
      • openMutableGCFromIndex

        @Nullable
        public static GribCollectionMutable openMutableGCFromIndex​(String indexFilename,
                                                                   thredds.featurecollection.FeatureCollectionConfig config,
                                                                   boolean dataOnly,
                                                                   boolean useCache,
                                                                   org.slf4j.Logger logger)
      • updateGribCollectionFromPCollection

        public static boolean updateGribCollectionFromPCollection​(boolean isGrib1,
                                                                  thredds.inventory.partition.PartitionManager dcm,
                                                                  thredds.inventory.CollectionUpdateType updateType,
                                                                  Formatter errlog,
                                                                  org.slf4j.Logger logger)
                                                           throws IOException
        Throws:
        IOException
      • updateGribCollection

        public static boolean updateGribCollection​(thredds.featurecollection.FeatureCollectionConfig config,
                                                   thredds.inventory.CollectionUpdateType updateType,
                                                   org.slf4j.Logger logger)
                                            throws IOException
        Update Grib Collection if needed
        Returns:
        true if the collection was updated
        Throws:
        IOException
      • updateGribCollection

        public static boolean updateGribCollection​(boolean isGrib1,
                                                   thredds.inventory.MCollection dcm,
                                                   thredds.inventory.CollectionUpdateType updateType,
                                                   thredds.featurecollection.FeatureCollectionConfig.PartitionType ptype,
                                                   org.slf4j.Logger logger,
                                                   Formatter errlog)
                                            throws IOException
        Throws:
        IOException
      • makeIndex

        public static boolean makeIndex​(thredds.featurecollection.FeatureCollectionConfig config,
                                        Formatter errlog,
                                        Path topPath)
                                 throws IOException
        Throws:
        IOException
      • moveCdmIndex

        public static boolean moveCdmIndex​(String indexFilename,
                                           org.slf4j.Logger logger)
                                    throws IOException
        Throws:
        IOException
      • openGribCollection

        public static GribCollectionImmutable openGribCollection​(thredds.featurecollection.FeatureCollectionConfig config,
                                                                 thredds.inventory.CollectionUpdateType updateType,
                                                                 org.slf4j.Logger logger)
                                                          throws IOException
        Open GribCollection from config. CollectionUpdater calls InvDatasetFc.update() calls InvDatasetFcGrib.updateCollection()
        Throws:
        IOException
      • openGribCollectionFromRaf

        public static GribCollectionImmutable openGribCollectionFromRaf​(ucar.unidata.io.RandomAccessFile raf,
                                                                        thredds.featurecollection.FeatureCollectionConfig config,
                                                                        thredds.inventory.CollectionUpdateType updateType,
                                                                        org.slf4j.Logger logger)
                                                                 throws IOException
        Throws:
        IOException
      • openGribCollectionFromDataFile

        @Nullable
        public static GribCollectionImmutable openGribCollectionFromDataFile​(boolean isGrib1,
                                                                             thredds.inventory.MFile mfile,
                                                                             thredds.inventory.CollectionUpdateType updateType,
                                                                             thredds.featurecollection.FeatureCollectionConfig config,
                                                                             Formatter errlog,
                                                                             org.slf4j.Logger logger)
                                                                      throws IOException
        Throws:
        IOException
      • openGribCollectionFromIndexFile

        @Nullable
        public static GribCollectionImmutable openGribCollectionFromIndexFile​(ucar.unidata.io.RandomAccessFile indexRaf,
                                                                              thredds.featurecollection.FeatureCollectionConfig config,
                                                                              org.slf4j.Logger logger)
                                                                       throws IOException
        Create a grib collection / partition collection from an existing ncx2 file. PartionCollection.partition.getGribCollection().
        Parameters:
        indexRaf - the ncx2 file already open
        config - special configuration
        Returns:
        the resulting GribCollection, or null on failure
        Throws:
        IOException - on io error
      • readChildren

        public boolean readChildren​(Path indexFile,
                                    thredds.inventory.partition.IndexReader.AddChildCallback callback)
                             throws IOException
        Specified by:
        readChildren in interface thredds.inventory.partition.IndexReader
        Throws:
        IOException
      • isPartition

        public boolean isPartition​(Path indexFile)
                            throws IOException
        Specified by:
        isPartition in interface thredds.inventory.partition.IndexReader
        Throws:
        IOException
      • readMFiles

        public boolean readMFiles​(Path indexFile,
                                  List<thredds.inventory.MFile> result)
                           throws IOException
        Specified by:
        readMFiles in interface thredds.inventory.partition.IndexReader
        Throws:
        IOException