public class NetcdfDatasets
extends java.lang.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,
java.util.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,
java.util.Set<NetcdfDataset.Enhance> enhanceMode,
int buffer_size,
CancelTask cancelTask,
java.lang.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,
java.lang.Object hashKey,
DatasetUrl location,
int buffer_size,
CancelTask cancelTask,
java.lang.Object spiObject)
Same as openFile, but file is acquired through the File Cache.
|
static void |
disableNetcdfFileCache() |
static NetcdfDataset |
enhance(NetcdfFile ncfile,
java.util.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,
java.util.Set<NetcdfDataset.Enhance> enhanceMode,
int buffer_size,
CancelTask cancelTask,
java.lang.Object spiObject)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(java.lang.String location)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(java.lang.String location,
boolean enhance,
CancelTask cancelTask)
Factory method for opening a dataset through the netCDF API, and identifying its coordinate variables.
|
static NetcdfDataset |
openDataset(java.lang.String location,
boolean enhance,
int buffer_size,
CancelTask cancelTask,
java.lang.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,
java.lang.Object spiObject)
Factory method for opening a NetcdfFile through the netCDF API.
|
static NetcdfFile |
openFile(java.lang.String location,
CancelTask cancelTask) |
static NetcdfDataset |
openNcmlDataset(java.io.Reader reader,
java.lang.String ncmlLocation,
CancelTask cancelTask)
Read NcML doc from a Reader, and construct a NetcdfDataset.Builder.
|
static void |
shutdown()
Call when application exits, if you have previously called initNetcdfFileCache.
|
public static NetcdfDataset acquireDataset(DatasetUrl location, boolean enhanceMode, CancelTask cancelTask) throws java.io.IOException
location
- location of file, passed to FileFactoryenhanceMode
- how to enhance. if null, then no enhancementcancelTask
- allow task to be cancelled; may be null.java.io.IOException
- on read errorpublic static NetcdfDataset acquireDataset(DatasetUrl location, CancelTask cancelTask) throws java.io.IOException
location
- location of file, passed to FileFactorycancelTask
- allow task to be cancelled; may be null.java.io.IOException
- on read errorpublic static NetcdfDataset acquireDataset(DatasetUrl location, java.util.Set<NetcdfDataset.Enhance> enhanceMode, CancelTask cancelTask) throws java.io.IOException
location
- location of file, passed to FileFactoryenhanceMode
- how to enhance. if null, then no enhancementcancelTask
- allow task to be cancelled; may be null.java.io.IOException
- on read errorpublic static NetcdfDataset acquireDataset(ucar.nc2.util.cache.FileFactory fac, DatasetUrl durl, java.util.Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, java.lang.Object iospMessage) throws java.io.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 nulljava.io.IOException
public static NetcdfFile acquireFile(DatasetUrl location, CancelTask cancelTask) throws java.io.IOException
location
- location of file, passed to FileFactorycancelTask
- allow task to be cancelled; may be null.java.io.IOException
- on read errorpublic static NetcdfFile acquireFile(ucar.nc2.util.cache.FileFactory factory, java.lang.Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, java.lang.Object spiObject) throws java.io.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 nulljava.io.IOException
- on read errorpublic static void disableNetcdfFileCache()
public static NetcdfDataset enhance(NetcdfFile ncfile, java.util.Set<NetcdfDataset.Enhance> mode, CancelTask cancelTask) throws java.io.IOException
ncfile
- wrap thismode
- using this enhance mode (may be null, meaning no enhance)java.io.IOException
- on io errorpublic static ucar.nc2.util.cache.FileCacheIF getNetcdfFileCache()
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 NetcdfDataset openDataset(DatasetUrl location, java.util.Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, java.lang.Object spiObject) throws java.io.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 nulljava.io.IOException
- on read errorpublic static NetcdfDataset openDataset(java.lang.String location) throws java.io.IOException
location
- location of filejava.io.IOException
- on read errorpublic static NetcdfDataset openDataset(java.lang.String location, boolean enhance, CancelTask cancelTask) throws java.io.IOException
location
- location of fileenhance
- if true, use defaultEnhanceMode, else no enhancementscancelTask
- allow task to be cancelled; may be null.java.io.IOException
- on read errorpublic static NetcdfDataset openDataset(java.lang.String location, boolean enhance, int buffer_size, CancelTask cancelTask, java.lang.Object spiObject) throws java.io.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 nulljava.io.IOException
- on read errorpublic static NetcdfFile openFile(DatasetUrl location, int buffer_size, CancelTask cancelTask, java.lang.Object spiObject) throws java.io.IOException
This does not necessarily return a NetcdfDataset, or enhance the dataset; use NetcdfDatasets.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 nulljava.io.IOException
- on read errorpublic static NetcdfFile openFile(java.lang.String location, CancelTask cancelTask) throws java.io.IOException
java.io.IOException
public static NetcdfDataset openNcmlDataset(java.io.Reader reader, java.lang.String ncmlLocation, CancelTask cancelTask) throws java.io.IOException
reader
- the Reader containing the NcML documentncmlLocation
- the URL location string of the NcML document, used to resolve relative path of the referenced
dataset,
or may be just a unique name for caching purposes.cancelTask
- allow user to cancel the task; may be nulljava.io.IOException
- on read error, or bad referencedDatasetUri URIpublic static void shutdown()