@Immutable public class NetcdfDataset extends NetcdfFile
An "enhanced" NetcdfFile, 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:
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.
NetcdfFile| Modifier and Type | Class and Description |
|---|---|
static class |
NetcdfDataset.Builder<T extends NetcdfDataset.Builder<T>> |
static class |
NetcdfDataset.Enhance
Possible enhancements for a NetcdfDataset
|
| Modifier and Type | Field and Description |
|---|---|
static String |
AGGREGATION |
protected static boolean |
fillValueIsMissing |
protected static boolean |
invalidDataIsMissing |
protected static boolean |
missingDataIsMissing |
cache, IOSP_MESSAGE_ADD_RECORD_STRUCTURE, IOSP_MESSAGE_GET_IOSP, IOSP_MESSAGE_GET_NETCDF_FILE_FORMAT, IOSP_MESSAGE_RANDOM_ACCESS_FILE| Modifier and Type | Method and Description |
|---|---|
static NetcdfDataset.Builder<?> |
builder()
Get Builder for NetcdfDataset.
|
void |
close()
Close all resources (files, sockets, etc) associated with this dataset.
|
CoordinateAxis |
findCoordinateAxis(AxisType type)
Retrieve the CoordinateAxis with the specified Axis Type.
|
CoordinateAxis |
findCoordinateAxis(String fullName)
Retrieve the CoordinateAxis with the specified fullName.
|
CoordinateSystem |
findCoordinateSystem(String name)
Retrieve the CoordinateSystem with the specified name.
|
CoordinateTransform |
findCoordinateTransform(String name)
Deprecated.
get transform from CoordinateSystem.
|
String |
getConventionUsed()
Get conventions used to analyse coordinate systems.
|
com.google.common.collect.ImmutableList<CoordinateAxis> |
getCoordinateAxes()
Get the list of all CoordinateAxis objects used by this dataset.
|
com.google.common.collect.ImmutableList<CoordinateSystem> |
getCoordinateSystems()
Get the list of all CoordinateSystem objects used by this dataset.
|
com.google.common.collect.ImmutableList<CoordinateTransform> |
getCoordinateTransforms()
Deprecated.
get transform from CoordinateSystem.
|
static Set<NetcdfDataset.Enhance> |
getDefaultEnhanceMode()
The set of default enhancements.
|
void |
getDetailInfo(Formatter f)
Show debug / underlying implementation details
|
static Set<NetcdfDataset.Enhance> |
getEnhanceAll()
The set of all enhancements.
|
Set<NetcdfDataset.Enhance> |
getEnhanceMode()
Get the current state of dataset enhancement.
|
static Set<NetcdfDataset.Enhance> |
getEnhanceNone()
The set of no enhancements.
|
String |
getFileTypeDescription()
Get a human-readable description for this file type.
|
String |
getFileTypeId()
Get the file type id for the underlying data source.
|
static boolean |
getFillValueIsMissing()
Deprecated.
do not use
|
static boolean |
getInvalidDataIsMissing()
Deprecated.
do not use
|
long |
getLastModified()
Deprecated.
|
static boolean |
getMissingDataIsMissing()
Deprecated.
do not use
|
NetcdfFile |
getReferencedFile()
Deprecated.
Do not use
|
boolean |
isIndependentCoordinate(CoordinateAxis axis)
Return true if axis is 1D with a unique dimension.
|
void |
reacquire()
Deprecated.
do not use
|
void |
release()
Deprecated.
do not use
|
Object |
sendIospMessage(Object message)
Generic way to send a "message" to the underlying IOSP.
|
static void |
setDefaultEnhanceMode(Set<NetcdfDataset.Enhance> mode)
Set the default set of Enhancements to do for all subsequent dataset opens and acquires.
|
static void |
setFillValueIsMissing(boolean b)
Deprecated.
do not use
|
static void |
setInvalidDataIsMissing(boolean b)
Deprecated.
do not use
|
static void |
setMissingDataIsMissing(boolean b)
Deprecated.
do not use
|
NetcdfDataset.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
addLocalFieldsToBuilder, findAttribute, findDimension, findGlobalAttribute, findGlobalAttributeIgnoreCase, findGroup, findVariable, getDetailInfo, getDimensions, getFileTypeVersion, getGlobalAttributes, getId, getLocation, getRootGroup, getStructureDataArrayIterator, getStructureIterator, getTitle, getUnlimitedDimension, getVariables, hasUnlimitedDimension, readArrayData, readData, readSection, readSectionArray, readToOutputStream, setCachedData, setDebugFlags, setFileCache, showCached, showProxies, toNcml, toString, toStringDebug, writeNcml, writeNcmlpublic static final String AGGREGATION
protected static boolean fillValueIsMissing
protected static boolean invalidDataIsMissing
protected static boolean missingDataIsMissing
public static Set<NetcdfDataset.Enhance> getEnhanceAll()
public static Set<NetcdfDataset.Enhance> getEnhanceNone()
public static Set<NetcdfDataset.Enhance> getDefaultEnhanceMode()
public static void setDefaultEnhanceMode(Set<NetcdfDataset.Enhance> mode)
mode - the default set of Enhancements for open and acquire factory methods@Deprecated public static void setFillValueIsMissing(boolean b)
b - true if _FillValue are missing (default true)@Deprecated public static boolean getFillValueIsMissing()
@Deprecated public static void setInvalidDataIsMissing(boolean b)
b - true if valid_range are missing (default true)@Deprecated public static boolean getInvalidDataIsMissing()
@Deprecated public static void setMissingDataIsMissing(boolean b)
b - true if missing_data are missing (default true)@Deprecated public static boolean getMissingDataIsMissing()
public com.google.common.collect.ImmutableList<CoordinateSystem> getCoordinateSystems()
public String getConventionUsed()
public Set<NetcdfDataset.Enhance> getEnhanceMode()
@Deprecated public com.google.common.collect.ImmutableList<CoordinateTransform> getCoordinateTransforms()
public com.google.common.collect.ImmutableList<CoordinateAxis> getCoordinateAxes()
public CoordinateAxis findCoordinateAxis(AxisType type)
type - axis typepublic CoordinateAxis findCoordinateAxis(String fullName)
fullName - full escaped name of the coordinate axispublic CoordinateSystem findCoordinateSystem(String name)
name - String which identifies the desired CoordinateSystem@Deprecated public CoordinateTransform findCoordinateTransform(String name)
name - String which identifies the desired CoordinateSystempublic boolean isIndependentCoordinate(CoordinateAxis axis)
public Object sendIospMessage(Object message)
NetcdfFilesendIospMessage in class NetcdfFilemessage - iosp specific messagepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface FileCacheableclose in class NetcdfFileIOException - if error when closing@Deprecated public void release() throws IOException
NetcdfFilerelease in interface FileCacheablerelease in class NetcdfFileIOException@Deprecated public void reacquire() throws IOException
NetcdfFilereacquire in interface FileCacheablereacquire in class NetcdfFileIOException@Deprecated public long getLastModified()
FileCacheableFileFactory.getLastModified in interface FileCacheablegetLastModified in class NetcdfFilelong value representing the time the file(s) were last modified or 0L if the
last-modified time couldn't be determined for any reason.@Deprecated public NetcdfFile getReferencedFile()
public void getDetailInfo(Formatter f)
getDetailInfo in class NetcdfFile@Nullable public String getFileTypeId()
NetcdfFilegetFileTypeId in class NetcdfFilepublic String getFileTypeDescription()
NetcdfFilegetFileTypeDescription in class NetcdfFilepublic NetcdfDataset.Builder<?> toBuilder()
NetcdfFiletoBuilder in class NetcdfFilepublic static NetcdfDataset.Builder<?> builder()