Package ucar.nc2.grib.collection
Class GribCollectionImmutable
- java.lang.Object
-
- ucar.nc2.grib.collection.GribCollectionImmutable
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,FileCacheable
- Direct Known Subclasses:
Grib1Collection
,Grib2Collection
,PartitionCollectionImmutable
@Immutable public abstract class GribCollectionImmutable extends Object implements Closeable, FileCacheable
An Immutable GribCollection, corresponds to one index (ncx) file. The index file has already been read; it is opened and the closed when a variable is first accessed to read in the record array (sa).Could use the Proto equivalents, and eliminate GribCollectionMutable ?
- Since:
- 11/10/2014
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GribCollectionImmutable.Dataset
class
GribCollectionImmutable.GroupGC
static class
GribCollectionImmutable.Record
static class
GribCollectionImmutable.Type
class
GribCollectionImmutable.VariableIndex
-
Field Summary
Fields Modifier and Type Field Description protected FeatureCollectionConfig
config
static int
countGC
protected GribTables
cust
protected List<GribCollectionImmutable.Dataset>
datasets
protected CalendarDateRange
dateRange
protected File
directory
protected Map<Integer,MFile>
fileMap
protected String
indexFilename
protected ucar.nc2.grib.collection.GribCollectionImmutable.Info
info
boolean
isGrib1
protected CoordinateRuntime
masterRuntime
protected String
name
-
Method Summary
-
-
-
Field Detail
-
countGC
public static int countGC
-
name
protected final String name
-
directory
protected final File directory
-
config
protected final FeatureCollectionConfig config
-
isGrib1
public final boolean isGrib1
-
info
protected final ucar.nc2.grib.collection.GribCollectionImmutable.Info info
-
datasets
protected final List<GribCollectionImmutable.Dataset> datasets
-
masterRuntime
protected final CoordinateRuntime masterRuntime
-
dateRange
protected final CalendarDateRange dateRange
-
cust
protected final GribTables cust
-
indexFilename
protected final String indexFilename
-
-
Method Detail
-
makeVariableIndex
protected GribCollectionImmutable.VariableIndex makeVariableIndex(GribCollectionImmutable.GroupGC group, GribCollectionMutable.VariableIndex mutableVar)
-
getDatasets
public List<GribCollectionImmutable.Dataset> getDatasets()
-
getDataset
public GribCollectionImmutable.Dataset getDataset(int idx)
-
getDatasetCanonical
public GribCollectionImmutable.Dataset getDatasetCanonical()
-
getName
public String getName()
-
getDirectory
public File getDirectory()
-
getMasterRuntime
public CoordinateRuntime getMasterRuntime()
-
getMasterFirstDate
public CalendarDate getMasterFirstDate()
-
getVersion
public int getVersion()
-
getCenter
public int getCenter()
-
getSubcenter
public int getSubcenter()
-
getMaster
public int getMaster()
-
getLocal
public int getLocal()
-
getGenProcessType
public int getGenProcessType()
-
getGenProcessId
public int getGenProcessId()
-
getBackProcessId
public int getBackProcessId()
-
getGlobalAttributes
public AttributeContainer getGlobalAttributes()
-
addGlobalAttributes
public abstract void addGlobalAttributes(AttributeContainer result)
-
addVariableAttributes
public abstract void addVariableAttributes(AttributeContainer v, GribCollectionImmutable.VariableIndex vindex)
-
makeVariableId
protected abstract String makeVariableId(GribCollectionImmutable.VariableIndex v)
-
close
public void close() throws IOException
Description copied from interface:FileCacheable
Close the FileCacheable, release all resources. Must call cache.release(this) if cache is not null.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceFileCacheable
- Throws:
IOException
- on io error
-
release
@Deprecated public void release()
Deprecated.do not use.release any resources like file handles.- Specified by:
release
in interfaceFileCacheable
-
reacquire
@Deprecated public void reacquire()
Deprecated.do not use.reacquire any resources like file handles.- Specified by:
reacquire
in interfaceFileCacheable
-
getLocation
public String getLocation()
Description copied from interface:FileCacheable
The location of the FileCacheable. This must be sufficient for FileFactory.factory() to create the FileCacheable object- Specified by:
getLocation
in interfaceFileCacheable
- Returns:
- location
-
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 withFileFactory
.- Specified by:
getLastModified
in interfaceFileCacheable
- Returns:
- a
long
value representing the time the file(s) were last modified or0L
if the last-modified time couldn't be determined for any reason.
-
setFileCache
@Deprecated public void setFileCache(FileCacheIF fileCache)
Deprecated.do not useDescription 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 interfaceFileCacheable
- Parameters:
fileCache
- must store this, use it on close as above.
-
showStatus
public void showStatus(Formatter f)
-
showIndex
public void showIndex(Formatter f)
-
getIndexFileSize
public long getIndexFileSize()
-
getFile
public MFile getFile(int fileno)
-
getFilename
public String getFilename(int fileno)
-
getFiles
public Collection<MFile> getFiles()
-
buildNetcdfDataset
protected static NetcdfDataset buildNetcdfDataset(AbstractIOServiceProvider iosp, String location) throws IOException
- Throws:
IOException
-
getNetcdfDataset
@Nullable public abstract NetcdfDataset getNetcdfDataset(GribCollectionImmutable.Dataset ds, GribCollectionImmutable.GroupGC group, String filename, FeatureCollectionConfig gribConfig, Formatter errlog, org.slf4j.Logger logger) throws IOException
- Throws:
IOException
-
getGridDataset
@Nullable public abstract GridDataset getGridDataset(GribCollectionImmutable.Dataset ds, GribCollectionImmutable.GroupGC group, String filename, FeatureCollectionConfig gribConfig, Formatter errlog, org.slf4j.Logger logger) throws IOException
- Throws:
IOException
-
getGridCoverage
@Nullable public abstract CoverageCollection getGridCoverage(GribCollectionImmutable.Dataset ds, GribCollectionImmutable.GroupGC group, String filename, FeatureCollectionConfig gribConfig, Formatter errlog, org.slf4j.Logger logger) throws IOException
- Throws:
IOException
-
-