Package ucar.nc2.grib.collection
Class GribCdmIndex
- java.lang.Object
-
- ucar.nc2.grib.collection.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?
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGribCdmIndex.GribCollectionType
-
Field Summary
Fields Modifier and Type Field Description static ucar.nc2.util.cache.FileCacheIFgribCollectionCachestatic StringNCX_SUFFIX
-
Constructor Summary
Constructors Constructor Description GribCdmIndex(org.slf4j.Logger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voiddisableGribCollectionCache()static FilegetTopIndexFileFromConfig(thredds.featurecollection.FeatureCollectionConfig config)static GribCdmIndex.GribCollectionTypegetType(ucar.unidata.io.RandomAccessFile raf)Find out what kind of index this isstatic voidinitDefaultCollectionCache(int minElementsInMemory, int maxElementsInMemory, int period)booleanisPartition(Path indexFile)static voidmain(String[] args)static booleanmakeIndex(thredds.featurecollection.FeatureCollectionConfig config, Formatter errlog, Path topPath)static booleanmoveCdmIndex(String indexFilename, org.slf4j.Logger logger)static GribCollectionImmutableopenCdmIndex(String indexFilename, thredds.featurecollection.FeatureCollectionConfig config, boolean useCache, org.slf4j.Logger logger)static GribCollectionImmutableopenGribCollection(thredds.featurecollection.FeatureCollectionConfig config, thredds.inventory.CollectionUpdateType updateType, org.slf4j.Logger logger)Open GribCollection from config.static GribCollectionImmutableopenGribCollectionFromDataFile(boolean isGrib1, thredds.inventory.MFile mfile, thredds.inventory.CollectionUpdateType updateType, thredds.featurecollection.FeatureCollectionConfig config, Formatter errlog, org.slf4j.Logger logger)static GribCollectionImmutableopenGribCollectionFromIndexFile(ucar.unidata.io.RandomAccessFile indexRaf, thredds.featurecollection.FeatureCollectionConfig config, org.slf4j.Logger logger)Create a grib collection / partition collection from an existing ncx2 file.static GribCollectionImmutableopenGribCollectionFromRaf(ucar.unidata.io.RandomAccessFile raf, thredds.featurecollection.FeatureCollectionConfig config, thredds.inventory.CollectionUpdateType updateType, org.slf4j.Logger logger)static GribCollectionMutableopenMutableGCFromIndex(String indexFilename, thredds.featurecollection.FeatureCollectionConfig config, boolean dataOnly, boolean useCache, org.slf4j.Logger logger)booleanreadChildren(Path indexFile, thredds.inventory.partition.IndexReader.AddChildCallback callback)booleanreadMFiles(Path indexFile, List<thredds.inventory.MFile> result)static voidsetGribCollectionCache(ucar.nc2.util.cache.FileCacheIF cache)static voidshutdown()static booleanupdateGribCollection(boolean isGrib1, thredds.inventory.MCollection dcm, thredds.inventory.CollectionUpdateType updateType, thredds.featurecollection.FeatureCollectionConfig.PartitionType ptype, org.slf4j.Logger logger, Formatter errlog)static booleanupdateGribCollection(thredds.featurecollection.FeatureCollectionConfig config, thredds.inventory.CollectionUpdateType updateType, org.slf4j.Logger logger)Update Grib Collection if neededstatic booleanupdateGribCollectionFromPCollection(boolean isGrib1, thredds.inventory.partition.PartitionManager dcm, thredds.inventory.CollectionUpdateType updateType, Formatter errlog, org.slf4j.Logger logger)
-
-
-
Field Detail
-
NCX_SUFFIX
public static final String NCX_SUFFIX
- See Also:
- Constant Field Values
-
gribCollectionCache
public static ucar.nc2.util.cache.FileCacheIF gribCollectionCache
-
-
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)
-
getType
public static GribCdmIndex.GribCollectionType getType(ucar.unidata.io.RandomAccessFile raf) throws IOException
Find out what kind of index this is- Parameters:
raf- open RAF- Returns:
- GribCollectionType
- Throws:
IOException- on read error
-
openCdmIndex
@Nullable public static GribCollectionImmutable openCdmIndex(String indexFilename, thredds.featurecollection.FeatureCollectionConfig config, boolean useCache, org.slf4j.Logger logger) throws IOException
- Throws:
IOException
-
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 IOExceptionUpdate 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 openconfig- 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:
readChildrenin interfacethredds.inventory.partition.IndexReader- Throws:
IOException
-
isPartition
public boolean isPartition(Path indexFile) throws IOException
- Specified by:
isPartitionin interfacethredds.inventory.partition.IndexReader- Throws:
IOException
-
readMFiles
public boolean readMFiles(Path indexFile, List<thredds.inventory.MFile> result) throws IOException
- Specified by:
readMFilesin interfacethredds.inventory.partition.IndexReader- Throws:
IOException
-
-