public class NetcdfDatasets extends Object
Constructor and Description |
---|
NetcdfDatasets() |
Modifier and Type | Method and Description |
---|---|
static NetcdfDataset |
acquireDataset(DatasetUrl location,
boolean enhanceMode,
CancelTask cancelTask)
Same as openDataset, but file is acquired through the File Cache, with defaultEnhanceMode.
|
static NetcdfDataset |
acquireDataset(DatasetUrl location,
CancelTask cancelTask)
Same as openDataset, but file is acquired through the File Cache, with defaultEnhanceMode,
without the need of setting the enhanceMode via the signature.
|
static NetcdfDataset |
acquireDataset(DatasetUrl location,
Set<NetcdfDataset.Enhance> enhanceMode,
CancelTask cancelTask)
Same as openDataset, but file is acquired through the File Cache, with specified enhancements.
|
static NetcdfDataset |
acquireDataset(ucar.nc2.util.cache.FileFactory fac,
DatasetUrl durl,
Set<NetcdfDataset.Enhance> enhanceMode,
int buffer_size,
CancelTask cancelTask,
Object iospMessage)
Same as openDataset, but file is acquired through the File Cache.
|
static NetcdfFile |
acquireFile(DatasetUrl location,
CancelTask cancelTask)
Same as openFile, but file is acquired through the File Cache.
|
static NetcdfFile |
acquireFile(ucar.nc2.util.cache.FileFactory factory,
Object hashKey,
DatasetUrl location,
int buffer_size,
CancelTask cancelTask,
Object spiObject)
Same as openFile, but file is acquired through the File Cache.
|
static void |
disableNetcdfFileCache() |
static NetcdfDataset |
enhance(NetcdfFile ncfile,
Set<NetcdfDataset.Enhance> mode,
CancelTask cancelTask)
Make NetcdfFile into NetcdfDataset and enhance if needed
|
static ucar.nc2.util.cache.FileCacheIF |
getNetcdfFileCache()
Get the File Cache
|
static void |
initNetcdfFileCache(int minElementsInMemory,
int maxElementsInMemory,
int period)
Enable file caching.
|
static void |
initNetcdfFileCache(int minElementsInMemory,
int maxElementsInMemory,
int hardLimit,
int period)
Enable file caching.
|
static NetcdfDataset |
openDataset(DatasetUrl location,
Set<NetcdfDataset.Enhance> enhanceMode,
int buffer_size,
CancelTask cancelTask,
Object spiObject)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(String location)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(String location,
boolean enhance,
CancelTask cancelTask)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(String location,
boolean enhance,
int buffer_size,
CancelTask cancelTask,
Object spiObject)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfFile |
openFile(DatasetUrl location,
int buffer_size,
CancelTask cancelTask,
Object spiObject)
Factory method for opening a NetcdfFile through the netCDF API.
|
static NetcdfFile |
openFile(String location,
CancelTask cancelTask) |
static void |
shutdown()
Call when application exits, if you have previously called initNetcdfFileCache.
|
public static void initNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int period)
minElementsInMemory
- keep this number in the cachemaxElementsInMemory
- trigger a cleanup if it goes over this number.period
- (secs) do periodic cleanups every this number of seconds. set to < 0 to not cleanuppublic static void initNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int hardLimit, int period)
minElementsInMemory
- keep this number in the cachemaxElementsInMemory
- trigger a cleanup if it goes over this number.hardLimit
- if > 0, never allow more than this many elements. This causes a cleanup to be done in
the calling thread.period
- (secs) do periodic cleanups every this number of seconds.public static void disableNetcdfFileCache()
public static void shutdown()
public static ucar.nc2.util.cache.FileCacheIF getNetcdfFileCache()
public static NetcdfDataset openDataset(String location) throws IOException
location
- location of fileIOException
- on read errorpublic static NetcdfDataset openDataset(String location, boolean enhance, CancelTask cancelTask) throws IOException
location
- location of fileenhance
- if true, use defaultEnhanceMode, else no enhancementscancelTask
- allow task to be cancelled; may be null.IOException
- on read errorpublic static NetcdfDataset openDataset(String location, boolean enhance, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
location
- location of fileenhance
- if true, use defaultEnhanceMode, else no enhancementsbuffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.spiObject
- sent to iosp.setSpecial() if not nullIOException
- on read errorpublic static NetcdfDataset openDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
location
- location of fileenhanceMode
- set of enhancements. If null, then nonebuffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.spiObject
- sent to iosp.setSpecial() if not nullIOException
- on read errorpublic static NetcdfDataset enhance(NetcdfFile ncfile, Set<NetcdfDataset.Enhance> mode, CancelTask cancelTask) throws IOException
ncfile
- wrap thismode
- using this enhance mode (may be null, meaning no enhance)IOException
- on io errorpublic static NetcdfDataset acquireDataset(DatasetUrl location, CancelTask cancelTask) throws IOException
location
- location of file, passed to FileFactorycancelTask
- allow task to be cancelled; may be null.IOException
- on read errorpublic static NetcdfDataset acquireDataset(DatasetUrl location, boolean enhanceMode, CancelTask cancelTask) throws IOException
location
- location of file, passed to FileFactoryenhanceMode
- how to enhance. if null, then no enhancementcancelTask
- allow task to be cancelled; may be null.IOException
- on read errorpublic static NetcdfDataset acquireDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, CancelTask cancelTask) throws IOException
location
- location of file, passed to FileFactoryenhanceMode
- how to enhance. if null, then no enhancementcancelTask
- allow task to be cancelled; may be null.IOException
- on read errorpublic static NetcdfDataset acquireDataset(ucar.nc2.util.cache.FileFactory fac, DatasetUrl durl, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException
fac
- if not null, use this factory if the file is not in the cache. If null, use the default factory.durl
- location of file, passed to FileFactoryenhanceMode
- how to enhance. if null, then no enhancementbuffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.iospMessage
- sent to iosp.setSpecial() if not nullIOException
public static NetcdfFile openFile(String location, CancelTask cancelTask) throws IOException
IOException
public static NetcdfFile openFile(DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
This does not necessarily return a NetcdfDataset, or enhance the dataset; use NetcdfDataset.openDataset() method for that.
location
- location of dataset.buffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.spiObject
- sent to iosp.setSpecial() if not nullIOException
- on read errorpublic static NetcdfFile acquireFile(DatasetUrl location, CancelTask cancelTask) throws IOException
location
- location of file, passed to FileFactorycancelTask
- allow task to be cancelled; may be null.IOException
- on read errorpublic static NetcdfFile acquireFile(ucar.nc2.util.cache.FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
factory
- if not null, use this factory to read the file. If null, use the default factory.hashKey
- if not null, use as the cache key, else use the locationlocation
- location of file, passed to FileFactorybuffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.spiObject
- sent to iosp.setSpecial(); may be nullIOException
- on read error