Class NetcdfDataset
- All Implemented Interfaces:
Closeable,AutoCloseable,ucar.nc2.util.cache.FileCacheable
NetcdfDataset extends the netCDF API, adding standard attribute parsing such as
scale and offset, and explicit support for Coordinate Systems.
A NetcdfDataset wraps a NetcdfFile, or is defined by an NcML document.
Be sure to close the dataset when done.
Using statics in NetcdfDatets, best practice is to use try-with-resource:
try (NetcdfDataset ncd = NetcdfDatasets.openDataset(fileName)) {
...
}
By default @code NetcdfDataset} is opened with all enhancements turned on. The default "enhance mode" can be set through setDefaultEnhanceMode(). One can also explicitly set the enhancements you want in the dataset factory methods. The enhancements are:
- ConvertEnums: convert enum values to their corresponding Strings. If you want to do this manually, you can call Variable.lookupEnumString().
- ConvertUnsigned: reinterpret the bit patterns of any negative values as unsigned.
- ApplyScaleOffset: process scale/offset attributes, and automatically convert the data.
- ConvertMissing: replace missing data with NaNs, for efficiency.
- CoordSystems: extract CoordinateSystem using the CoordSysBuilder plug-in mechanism.
Automatic scale/offset processing has some overhead that you may not want to incur up-front. If so, open the
NetcdfDataset without ApplyScaleOffset. The VariableDS data type is not promoted and the data is not
converted on a read, but you can call the convertScaleOffset() routines to do the conversion later.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNetcdfDataset.Builder<T extends NetcdfDataset.Builder<T>>static enumPossible enhancements for a NetcdfDataset -
Field Summary
Fields inherited from class ucar.nc2.NetcdfFile
IOSP_MESSAGE_ADD_RECORD_STRUCTURE, IOSP_MESSAGE_CONVERT_RECORD_STRUCTURE, IOSP_MESSAGE_GET_NETCDF_FILE_FORMAT, IOSP_MESSAGE_RANDOM_ACCESS_FILE, IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Use NetcdfDataset.builder()NetcdfDataset(NetcdfFile ncfile) Deprecated.Use NetcdfDataset.builder()NetcdfDataset(NetcdfFile.Builder<?> builder) Deprecated.Use NetcdfDataset.builder()NetcdfDataset(NetcdfFile ncfile, boolean enhance) Deprecated.Use NetcdfDataset.builder()NetcdfDataset(NetcdfFile ncfile, Set<NetcdfDataset.Enhance> mode) Deprecated.Use NetcdfDataset.builder() -
Method Summary
Modifier and TypeMethodDescriptionstatic NetcdfDatasetacquireDataset(DatasetUrl location, boolean enhanceMode, CancelTask cancelTask) Deprecated.use NetcdfDatasets.acquireDatasetstatic NetcdfDatasetacquireDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, CancelTask cancelTask) Deprecated.use NetcdfDatasets.acquireDatasetstatic NetcdfDatasetacquireDataset(DatasetUrl location, CancelTask cancelTask) Deprecated.use NetcdfDatasets.acquireDatasetstatic NetcdfDatasetacquireDataset(ucar.nc2.util.cache.FileFactory fac, DatasetUrl durl, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object iospMessage) Deprecated.use NetcdfDatasets.acquireDatasetstatic NetcdfFileacquireFile(DatasetUrl location, CancelTask cancelTask) Deprecated.use NetcdfDatasets.acquireFilestatic NetcdfFileacquireFile(ucar.nc2.util.cache.FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) Deprecated.use NetcdfDatasets.acquireFileDeprecated.Use NetcdfDataset.builder()voidDeprecated.Use NetcdfDataset.builder()voidDeprecated.Use NetcdfDataset.builder()addVariable(Group g, Variable v) Deprecated.Use NetcdfDataset.builder()static NetcdfDataset.Builder<?>builder()Get Builder for this class that allows subclassing.static NetcdfDataset.Builderbuilder(NetcdfFile from) voidDeprecated.do not usevoidDeprecated.Use NetcdfDataset.builder()voidclose()Close all resources (files, sockets, etc) associated with this dataset.static voiddebugDump(PrintWriter out, NetcdfDataset ncd) Deprecated.do not usestatic voidDeprecated.use NetcdfDatasets.disableNetcdfFileCachevoidempty()Deprecated.Use NetcdfDataset.builder()enhance()Deprecated.Use NetcdfDataset.builder()voidenhance(Set<NetcdfDataset.Enhance> mode) Deprecated.Use NetcdfDataset.builder()booleanDeprecated.Do not use.findCoordinateAxis(String fullName) Retrieve the CoordinateAxis with the specified type.findCoordinateAxis(AxisType type) Retrieve the CoordinateAxis with the specified Axis Type.findCoordinateSystem(String name) Retrieve the CoordinateSystem with the specified name.Retrieve the CoordinateTransform with the specified name.ucar.nc2.ncml.AggregationIFDeprecated.Do not use.Get conventions used to analyse coordinate systems.com.google.common.collect.ImmutableList<CoordinateAxis>Get the list of all CoordinateAxis objects used by this dataset.com.google.common.collect.ImmutableList<CoordinateSystem>Get the list of all CoordinateSystem objects used by this dataset.com.google.common.collect.ImmutableList<CoordinateTransform>Get the list of all CoordinateTransform objects used by this dataset.static Set<NetcdfDataset.Enhance>voidShow debug / underlying implementation detailsstatic Set<NetcdfDataset.Enhance>Get the current state of dataset enhancement.static Set<NetcdfDataset.Enhance>Get a human-readable description for this file type.Get the file type id for the underlying data source.static booleanDeprecated.do not usestatic booleanDeprecated.do not usegetIosp()Deprecated.do not uselongstatic booleanDeprecated.do not usestatic ucar.nc2.util.cache.FileCacheIFDeprecated.use NetcdfDatasets.getNetcdfFileCacheDeprecated.Do not usestatic voidinitNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int period) Deprecated.use NetcdfDatasets.initNetcdfFileCachestatic voidinitNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int hardLimit, int period) Deprecated.use NetcdfDatasets.initNetcdfFileCachestatic voidDeprecated.use ucar.nc2.writer.Nccopystatic ArrayDeprecated.use Array#makeArray directlystatic NetcdfDatasetopenDataset(String location) Deprecated.use NetcdfDatasets.openDatasetstatic NetcdfDatasetopenDataset(String location, boolean enhance, int buffer_size, CancelTask cancelTask, Object spiObject) Deprecated.use NetcdfDatasets.openDatasetstatic NetcdfDatasetopenDataset(String location, boolean enhance, CancelTask cancelTask) Deprecated.use NetcdfDatasets.openDatasetstatic NetcdfDatasetopenDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object spiObject) Deprecated.use NetcdfDatasets.openDatasetstatic NetcdfFileopenFile(String location, CancelTask cancelTask) Deprecated.use NetcdfDatasets.openFilestatic NetcdfFileopenFile(DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) Deprecated.use NetcdfDatasets.openFilestatic Set<NetcdfDataset.Enhance>parseEnhanceMode(String enhanceMode) Deprecated.this is moving to Ncml packagevoidDeprecated.do not usevoidrelease()Deprecated.do not usevoidsetAggregation(ucar.nc2.ncml.AggregationIF agg) Deprecated.Use NetcdfDataset.builder()static voidSet the default set of Enhancements to do for all subsequent dataset opens and acquires.static voidsetFillValueIsMissing(boolean b) Deprecated.do not usestatic voidsetInvalidDataIsMissing(boolean b) Deprecated.do not usestatic voidsetMissingDataIsMissing(boolean b) Deprecated.do not usevoidsetReferencedFile(NetcdfFile ncfile) Deprecated.Use NetcdfDataset.builder()voidDeprecated.use Variable.setValues()voidDeprecated.use Variable.setValues()static voidshutdown()Deprecated.use NetcdfDatasets.shutdownvoidsort()Deprecated.Use NetcdfDataset.builder()booleanDeprecated.do not useTurn into a mutable Builder.static NetcdfDatasetwrap(NetcdfFile ncfile, Set<NetcdfDataset.Enhance> mode) Deprecated.use NetcdfDatasets.wrapMethods inherited from class ucar.nc2.NetcdfFile
addAttribute, addAttribute, addDimension, addGroup, addStringVariable, addVariable, addVariableAttribute, canonicalizeUriString, canOpen, findAttribute, findAttValueIgnoreCase, findDimension, findGlobalAttribute, findGlobalAttributeIgnoreCase, findGroup, findVariable, findVariable, findVariableByAttribute, finish, getCacheName, getDetailInfo, getDimensions, getFileTypeVersion, getGlobalAttributes, getId, getLocation, getRootGroup, getTitle, getUnlimitedDimension, getVariables, hasUnlimitedDimension, iospDeRegister, iospRegistered, makeNameUnescaped, makeValidCDLName, makeValidCdmObjectName, makeValidPathName, makeValidSectionSpecName, open, open, open, open, open, open, openInMemory, openInMemory, openInMemory, openInMemory, read, readArrays, readAttributeDouble, readAttributeInteger, readSection, registerIOProvider, registerIOProvider, registerIOProvider, registerIOProviderPreferred, removeDimension, removeVariable, sendIospMessage, setDebugFlags, setFileCache, setId, setImmutable, setLocation, setProperty, setRootGroup, setTitle, toNcml, toString, writeCDL, writeCDL, writeNcml, writeNcml
-
Constructor Details
-
NetcdfDataset
Deprecated.Use NetcdfDataset.builder()Transform a NetcdfFile into a NetcdfDataset, with default enhancement. You must not use the underlying NetcdfFile after this call, because it gets modified. Therefore you should not use this with a cached file.- Parameters:
ncfile- NetcdfFile to transform.- Throws:
IOException- on read error
-
NetcdfDataset
Deprecated.Use NetcdfDataset.builder()Transform a NetcdfFile into a NetcdfDataset, optionally enhance it. You must not use the original NetcdfFile after this call.- Parameters:
ncfile- NetcdfFile to transform, do not use independently after this.enhance- if true, enhance with defaultEnhanceMode- Throws:
IOException- on read error
-
NetcdfDataset
@Deprecated public NetcdfDataset(NetcdfFile ncfile, Set<NetcdfDataset.Enhance> mode) throws IOException Deprecated.Use NetcdfDataset.builder()Transform a NetcdfFile into a NetcdfDataset, optionally enhance it. You must not use the original NetcdfFile after this call.- Parameters:
ncfile- NetcdfFile to transform, do not use independently after this.mode- set of enhance modes. If null, then none- Throws:
IOException- on read error
-
NetcdfDataset
Deprecated.Use NetcdfDataset.builder()No-arg Constructor -
NetcdfDataset
Deprecated.Use NetcdfDataset.builder()
-
-
Method Details
-
getEnhanceAll
-
getEnhanceNone
-
getDefaultEnhanceMode
-
setDefaultEnhanceMode
Set the default set of Enhancements to do for all subsequent dataset opens and acquires.- Parameters:
mode- the default set of Enhancements for open and acquire factory methods
-
parseEnhanceMode
Deprecated.this is moving to Ncml packageRetrieve the set of Enhancements that is associated with the given string.String Enhancements All ConvertEnums, ConvertUnsigned, ApplyScaleOffset, ConvertMissing, CoordSystems None <empty> ConvertEnums ConvertEnums ConvertUnsigned ConvertUnsigned ApplyScaleOffset ApplyScaleOffset ConvertMissing ConvertMissing CoordSystems CoordSystems IncompleteCoordSystems CoordSystems true Alias for "All" ScaleMissingDefer Alias for "None" AllDefer ConvertEnums, CoordSystems ScaleMissing ConvertUnsigned, ApplyScaleOffset, ConvertMissing - Parameters:
enhanceMode- a string from the above table.- Returns:
- the set corresponding to
enhanceMode, ornullif there is no correspondence.
-
setFillValueIsMissing
Deprecated.do not useSet if _FillValue attribute is considered isMissing()- Parameters:
b- true if _FillValue are missing (default true)
-
getFillValueIsMissing
Deprecated.do not useGet if _FillValue attribute is considered isMissing()- Returns:
- if _FillValue attribute is considered isMissing()
-
setInvalidDataIsMissing
Deprecated.do not useSet if valid_range attribute is considered isMissing()- Parameters:
b- true if valid_range are missing (default true)
-
getInvalidDataIsMissing
Deprecated.do not useGet if valid_range attribute is considered isMissing()- Returns:
- if valid_range attribute is considered isMissing()
-
setMissingDataIsMissing
Deprecated.do not useSet if missing_data attribute is considered isMissing()- Parameters:
b- true if missing_data are missing (default true)
-
getMissingDataIsMissing
Deprecated.do not useGet if missing_data attribute is considered isMissing()- Returns:
- if missing_data attribute is considered isMissing()
-
initNetcdfFileCache
@Deprecated public static void initNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int period) Deprecated.use NetcdfDatasets.initNetcdfFileCacheEnable file caching. call this before calling acquireFile(). When application terminates, call NetcdfDataset.shutdown().- Parameters:
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 cleanup
-
initNetcdfFileCache
@Deprecated public static void initNetcdfFileCache(int minElementsInMemory, int maxElementsInMemory, int hardLimit, int period) Deprecated.use NetcdfDatasets.initNetcdfFileCacheEnable file caching. call this before calling acquireFile(). When application terminates, call NetcdfDataset.shutdown().- Parameters:
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.
-
disableNetcdfFileCache
Deprecated.use NetcdfDatasets.disableNetcdfFileCache -
shutdown
Deprecated.use NetcdfDatasets.shutdownCall when application exits, if you have previously called initNetcdfFileCache. This shuts down any background threads in order to get a clean process shutdown. -
getNetcdfFileCache
Deprecated.use NetcdfDatasets.getNetcdfFileCacheGet the File Cache- Returns:
- File Cache or null if not enabled.
-
wrap
@Deprecated public static NetcdfDataset wrap(NetcdfFile ncfile, Set<NetcdfDataset.Enhance> mode) throws IOException Deprecated.use NetcdfDatasets.wrapMake NetcdfFile into NetcdfDataset with given enhance mode- Parameters:
ncfile- wrap thismode- using this enhance mode (may be null, meaning no enhance)- Returns:
- NetcdfDataset wrapping the given ncfile
- Throws:
IOException- on io error
-
openDataset
Deprecated.use NetcdfDatasets.openDatasetFactory method for opening a dataset through the netCDF API, and identifying its coordinate variables.- Parameters:
location- location of file- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
openDataset
@Deprecated public static NetcdfDataset openDataset(String location, boolean enhance, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.openDatasetFactory method for opening a dataset through the netCDF API, and identifying its coordinate variables.- Parameters:
location- location of fileenhance- if true, use defaultEnhanceMode, else no enhancementscancelTask- allow task to be cancelled; may be null.- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
openDataset
@Deprecated public static NetcdfDataset openDataset(String location, boolean enhance, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException Deprecated.use NetcdfDatasets.openDatasetFactory method for opening a dataset through the netCDF API, and identifying its coordinate variables.- Parameters:
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 null- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
openDataset
@Deprecated public static NetcdfDataset openDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException Deprecated.use NetcdfDatasets.openDatasetFactory method for opening a dataset through the netCDF API, and identifying its coordinate variables.- Parameters:
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 null- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
acquireDataset
@Deprecated public static NetcdfDataset acquireDataset(DatasetUrl location, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.acquireDatasetSame as openDataset, but file is acquired through the File Cache, with defaultEnhanceMode, without the need of setting the enhanceMode via the signature. You still close with NetcdfDataset.close(), the release is handled automatically. You must first call initNetcdfFileCache() for caching to actually take place.- Parameters:
location- location of file, passed to FileFactorycancelTask- allow task to be cancelled; may be null.- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
acquireDataset
@Deprecated public static NetcdfDataset acquireDataset(DatasetUrl location, boolean enhanceMode, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.acquireDatasetSame as openDataset, but file is acquired through the File Cache, with defaultEnhanceMode. You still close with NetcdfDataset.close(), the release is handled automatically. You must first call initNetcdfFileCache() for caching to actually take place.- Parameters:
location- location of file, passed to FileFactoryenhanceMode- how to enhance. if null, then no enhancementcancelTask- allow task to be cancelled; may be null.- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
acquireDataset
@Deprecated public static NetcdfDataset acquireDataset(DatasetUrl location, Set<NetcdfDataset.Enhance> enhanceMode, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.acquireDatasetSame as openDataset, but file is acquired through the File Cache, with specified enhancements. You still close with NetcdfDataset.close(), the release is handled automatically. You must first call initNetcdfFileCache() for caching to actually take place.- Parameters:
location- location of file, passed to FileFactoryenhanceMode- how to enhance. if null, then no enhancementcancelTask- allow task to be cancelled; may be null.- Returns:
- NetcdfDataset object
- Throws:
IOException- on read error
-
acquireDataset
@Deprecated public static NetcdfDataset acquireDataset(ucar.nc2.util.cache.FileFactory fac, DatasetUrl durl, Set<NetcdfDataset.Enhance> enhanceMode, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException Deprecated.use NetcdfDatasets.acquireDatasetSame as openDataset, but file is acquired through the File Cache. You must first call initNetcdfFileCache() for caching to actually take place. You still close with NetcdfDataset.close(), the release is handled automatically.- Parameters:
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 null- Returns:
- NetcdfDataset or throw Exception
- Throws:
IOException
-
openFile
@Deprecated public static NetcdfFile openFile(String location, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.openFileFactory method for opening a NetcdfFile through the netCDF API.- Parameters:
location- location of dataset.cancelTask- use to allow task to be cancelled; may be null.- Returns:
- NetcdfFile object
- Throws:
IOException- on read error
-
openFile
@Deprecated public static NetcdfFile openFile(DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException Deprecated.use NetcdfDatasets.openFileFactory method for opening a NetcdfFile through the netCDF API. May be any kind of file that can be read through the netCDF API, including OpenDAP and NcML.This does not necessarily return a NetcdfDataset, or enhance the dataset; use NetcdfDatasets.openDataset() method for that.
- Parameters:
location- location of dataset. This may be a- local filename (with a file: prefix or no prefix) for netCDF (version 3), hdf5 files, or any file type registered with NetcdfFile.registerIOProvider().
- OpenDAP dataset URL (with a dods:, dap4:, or http: prefix).
- NcML file or URL if the location ends with ".xml" or ".ncml"
- NetCDF file through an HTTP server (http: prefix)
- thredds dataset (thredds: prefix), see DataFactory.openDataset(String location, ...));
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 null- Returns:
- NetcdfFile object
- Throws:
IOException- on read error
-
acquireFile
@Deprecated public static NetcdfFile acquireFile(DatasetUrl location, CancelTask cancelTask) throws IOException Deprecated.use NetcdfDatasets.acquireFileSame as openFile, but file is acquired through the File Cache. You still close with NetcdfFile.close(), the release is handled automatically. You must first call initNetcdfFileCache() for caching to actually take place.- Parameters:
location- location of file, passed to FileFactorycancelTask- allow task to be cancelled; may be null.- Returns:
- NetcdfFile object
- Throws:
IOException- on read error
-
acquireFile
@Deprecated public static NetcdfFile acquireFile(ucar.nc2.util.cache.FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException Deprecated.use NetcdfDatasets.acquireFileSame as openFile, but file is acquired through the File Cache. You still close with NetcdfFile.close(), the release is handled automatically. You must first call initNetcdfFileCache() for caching to actually take place.- Parameters:
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 null- Returns:
- NetcdfFile object
- Throws:
IOException- on read error
-
getAggregation
Deprecated.Do not use.If its an NcML aggregation, it has an Aggregation object associated. This is public for use by NcmlWriter.- Returns:
- Aggregation or null
-
setAggregation
Deprecated.Use NetcdfDataset.builder()Set the Aggregation object associated with this NcML dataset- Parameters:
agg- the Aggregation object
-
getCoordinateSystems
Get the list of all CoordinateSystem objects used by this dataset.- Returns:
- list of type CoordinateSystem; may be empty, not null.
-
getConventionUsed
Get conventions used to analyse coordinate systems.- Returns:
- conventions used to analyse coordinate systems
-
getEnhanceMode
Get the current state of dataset enhancement.- Returns:
- the current state of dataset enhancement.
-
getCoordinateTransforms
Get the list of all CoordinateTransform objects used by this dataset.- Returns:
- list of type CoordinateTransform; may be empty, not null.
-
getCoordinateAxes
Get the list of all CoordinateAxis objects used by this dataset.- Returns:
- list of type CoordinateAxis; may be empty, not null.
-
clearCoordinateSystems
Deprecated.Use NetcdfDataset.builder()Clear Coordinate System metadata, to allow them to be redone -
findCoordinateAxis
Retrieve the CoordinateAxis with the specified Axis Type.- Parameters:
type- axis type- Returns:
- the first CoordinateAxis that has that type, or null if not found
-
findCoordinateAxis
Retrieve the CoordinateAxis with the specified type.- Parameters:
fullName- full escaped name of the coordinate axis- Returns:
- the CoordinateAxis, or null if not found
-
findCoordinateSystem
Retrieve the CoordinateSystem with the specified name.- Parameters:
name- String which identifies the desired CoordinateSystem- Returns:
- the CoordinateSystem, or null if not found
-
findCoordinateTransform
Retrieve the CoordinateTransform with the specified name.- Parameters:
name- String which identifies the desired CoordinateSystem- Returns:
- the CoordinateSystem, or null if not found
-
close
Close all resources (files, sockets, etc) associated with this dataset. If the underlying file was acquired, it will be released, otherwise closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceucar.nc2.util.cache.FileCacheable- Overrides:
closein classNetcdfFile- Throws:
IOException- if error when closing
-
release
Deprecated.do not useDescription copied from class:NetcdfFilePublic by accident. Release any resources like file handles- Specified by:
releasein interfaceucar.nc2.util.cache.FileCacheable- Overrides:
releasein classNetcdfFile- Throws:
IOException
-
reacquire
Deprecated.do not useDescription copied from class:NetcdfFilePublic by accident. Reacquire any resources like file handles- Specified by:
reacquirein interfaceucar.nc2.util.cache.FileCacheable- Overrides:
reacquirein classNetcdfFile- Throws:
IOException
-
getLastModified
public long getLastModified()- Specified by:
getLastModifiedin interfaceucar.nc2.util.cache.FileCacheable- Overrides:
getLastModifiedin classNetcdfFile
-
empty
Deprecated.Use NetcdfDataset.builder()Description copied from class:NetcdfFileCompletely empty the objects in the netcdf file. Used for rereading the file on a sync().- Overrides:
emptyin classNetcdfFile
-
syncExtend
Deprecated.do not useDescription copied from class:NetcdfFileExtend the file if needed, in a way that is compatible with the current metadata, that is, does not invalidate structural metadata held by the application. For example, ok if dimension lengths, data has changed. All previous object references (variables, dimensions, etc) remain valid.- Overrides:
syncExtendin classNetcdfFile- Returns:
- true if file was extended.
- Throws:
IOException- if error
-
sort
Deprecated.Use NetcdfDataset.builder()Sort Variables, CoordAxes by name. -
getReferencedFile
Deprecated.Do not useA NetcdfDataset usually wraps a NetcdfFile, where the actual I/O happens. This is called the "referenced file". CAUTION : this may have been modified in ways that make it unsuitable for general use.- Returns:
- underlying NetcdfFile, or null if none.
-
getIosp
Deprecated.do not use- Overrides:
getIospin classNetcdfFile
-
setReferencedFile
Deprecated.Use NetcdfDataset.builder()Set underlying file. CAUTION - normally only done through the constructor.- Parameters:
ncfile- underlying "referenced file"
-
addCoordinateSystem
Deprecated.Use NetcdfDataset.builder()Add a CoordinateSystem to the dataset.- Parameters:
cs- add this CoordinateSystem to the dataset
-
addCoordinateTransform
Deprecated.Use NetcdfDataset.builder()Add a CoordinateTransform to the dataset.- Parameters:
ct- add this CoordinateTransform to the dataset
-
addCoordinateAxis
Deprecated.Use NetcdfDataset.builder()Add a CoordinateAxis to the dataset, by turning the VariableDS into a CoordinateAxis (if needed). Also adds it to the list of variables. Replaces any existing Variable and CoordinateAxis with the same name.- Parameters:
v- make this VariableDS into a CoordinateAxis- Returns:
- the CoordinateAxis
-
addVariable
Deprecated.Use NetcdfDataset.builder()Description copied from class:NetcdfFileAdd a Variable to the given group.- Overrides:
addVariablein classNetcdfFile- Parameters:
g- add to this group. If group is null, use root groupv- add this Variable- Returns:
- the variable that was added
-
enhance
Deprecated.Use NetcdfDataset.builder()recalc enhancement info - use default enhance mode- Returns:
- the CoordSysBuilder used, for debugging. do not modify or retain a reference
- Throws:
IOException- on error
-
enhance
Deprecated.Use NetcdfDataset.builder()recalc enhancement info- Parameters:
mode- how to enhance- Throws:
IOException- on error
-
enhanceNeeded
Deprecated.Do not use.is this enhancement already done ?- Parameters:
want- enhancements wanted- Returns:
- true if wanted enhancement is not done
-
setValues
Deprecated.use Variable.setValues()Generate the list of values from a starting value and an increment. Will reshape to variable if needed.- Parameters:
v- for this variablenpts- number of values, must = v.getSize()start- starting valueincr- increment
-
setValues
Deprecated.use Variable.setValues()Set the data values from a list of Strings.- Parameters:
v- for this variablevalues- list of Strings- Throws:
IllegalArgumentException- if values array not correct size, or values wont parse to the correct type
-
makeArray
@Deprecated public static Array makeArray(DataType dtype, List<String> stringValues) throws NumberFormatException Deprecated.use Array#makeArray directlyMake a 1D array from a list of strings.- Parameters:
dtype- data type of the array.stringValues- list of strings.- Returns:
- resulting 1D array.
- Throws:
NumberFormatException- if string values not parssable to specified data type
-
getDetailInfo
Show debug / underlying implementation details- Overrides:
getDetailInfoin classNetcdfFile
-
debugDump
Deprecated.do not useDebugging- Parameters:
out- write herencd- info about this
-
getFileTypeId
Description copied from class:NetcdfFileGet the file type id for the underlying data source.- Overrides:
getFileTypeIdin classNetcdfFile- Returns:
- registered id of the file type
- See Also:
-
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getFileTypeDescription
Description copied from class:NetcdfFileGet a human-readable description for this file type.- Overrides:
getFileTypeDescriptionin classNetcdfFile- Returns:
- description of the file type
- See Also:
-
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
check
Deprecated.do not use -
toBuilder
Description copied from class:NetcdfFileTurn into a mutable Builder. Can use toBuilder().build() to copy.- Overrides:
toBuilderin classNetcdfFile
-
builder
Get Builder for this class that allows subclassing.- See Also:
-
- "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"
-
builder
-
main
Deprecated.use ucar.nc2.writer.NccopyMain program - cover to ucar.nc2.FileWriter, for all files that can be read by NetcdfDataset.openFile()ucar.nc2.dataset.NetcdfDataset -in fileIn -out fileOut
where:
- fileIn : path of any CDM readable file
- fileOut: local pathname where netdf-3 file will be written
- Parameters:
arg- -in-out [-isLargeFile] [-netcdf4] - Throws:
IOException- on read or write error
-