public class NetcdfFile extends java.lang.Object implements FileCacheable, java.io.Closeable
Read-only scientific datasets that are accessible through the netCDF API.
Immutable after setImmutable()
is called. Reading data is not
thread-safe because of the use of RandomAccessFile
.
Using this class's Builder
scheme to create a NetcdfFile
object could, for
example, be accomplished as follows, using a try/finally block to ensure that the
NetcdfFile
is closed when done.
NetcdfFile ncfile = null; try { ncfile = NetcdfFile.builder().setLocation(fileName).build(); // do stuff } finally { if (ncfile != null) { ncfile.close(); } }More conveniently, a
NetcdfFile
object may be created using one of the static methods
in NetcdfFiles
:
NetcdfFile ncfile = null; try { ncfile = NetcdfFiles.open(fileName); // do stuff } finally { if (ncfile != null) { ncfile.close(); } }Or better yet, use try-with-resources:
try (NetcdfFile ncfile = NetcdfFiles.open(fileName)) { // do stuff }
Modifier and Type | Class and Description |
---|---|
static class |
NetcdfFile.Builder<T extends NetcdfFile.Builder<T>>
A builder of NetcdfFile objects.
|
Modifier and Type | Field and Description |
---|---|
protected FileCacheIF |
cache |
protected java.util.List<Dimension> |
dimensions
Deprecated.
|
protected java.util.List<Attribute> |
gattributes
Deprecated.
|
protected java.lang.String |
id |
protected IOServiceProvider |
iosp |
static java.lang.String |
IOSP_MESSAGE_ADD_RECORD_STRUCTURE
Deprecated.
|
static java.lang.String |
IOSP_MESSAGE_CONVERT_RECORD_STRUCTURE
Deprecated.
|
static java.lang.String |
IOSP_MESSAGE_GET_NETCDF_FILE_FORMAT |
static java.lang.String |
IOSP_MESSAGE_RANDOM_ACCESS_FILE |
static java.lang.String |
IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE
Deprecated.
|
protected java.lang.String |
location |
protected Group |
rootGroup |
protected java.lang.String |
title |
protected java.util.List<Variable> |
variables
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
NetcdfFile()
Deprecated.
use NetcdfFile.builder()
|
protected |
NetcdfFile(IOServiceProvider spi,
RandomAccessFile raf,
java.lang.String location,
CancelTask cancelTask)
Deprecated.
use NetcdfFile.builder()
|
protected |
NetcdfFile(IOServiceProvider spi,
java.lang.String location)
Deprecated.
use NetcdfFile.builder()
|
protected |
NetcdfFile(NetcdfFile.Builder<?> builder) |
protected |
NetcdfFile(NetcdfFile ncfile)
Deprecated.
use NetcdfFile.builder()
|
|
NetcdfFile(java.lang.String filename)
Deprecated.
use NetcdfFiles.open( location) or NetcdfDatasets.openFile( location)
|
protected |
NetcdfFile(java.lang.String iospClassName,
java.lang.Object iospParam,
java.lang.String location,
int buffer_size,
CancelTask cancelTask)
Deprecated.
use NetcdfFile.builder()
|
|
NetcdfFile(java.net.URL url)
Deprecated.
use NetcdfFiles.open( http:location) or NetcdfDatasets.openFile( http:location)
|
Modifier and Type | Method and Description |
---|---|
Attribute |
addAttribute(Group parent,
Attribute att)
Deprecated.
Use NetcdfFile.builder()
|
Attribute |
addAttribute(Group parent,
java.lang.String name,
java.lang.String value)
Deprecated.
Use NetcdfFile.builder()
|
Dimension |
addDimension(Group parent,
Dimension d)
Deprecated.
Use NetcdfFile.builder()
|
Group |
addGroup(Group parent,
Group g)
Deprecated.
Use NetcdfFile.builder()
|
protected NetcdfFile.Builder<?> |
addLocalFieldsToBuilder(NetcdfFile.Builder<? extends NetcdfFile.Builder<?>> b) |
Variable |
addStringVariable(Group g,
java.lang.String shortName,
java.lang.String dims,
int strlen)
Deprecated.
Use NetcdfFile.builder()
|
Variable |
addVariable(Group g,
java.lang.String shortName,
DataType dtype,
java.lang.String dims)
Deprecated.
Use NetcdfFile.builder()
|
Variable |
addVariable(Group g,
Variable v)
Deprecated.
Use NetcdfFile.builder()
|
Attribute |
addVariableAttribute(Variable v,
Attribute att)
Deprecated.
Use NetcdfFile.builder()
|
static NetcdfFile.Builder<?> |
builder()
Get Builder for this class.
|
static java.lang.String |
canonicalizeUriString(java.lang.String location)
Deprecated.
use NetcdfFiles.canonicalizeUriString
|
static boolean |
canOpen(java.lang.String location)
Deprecated.
use NetcdfFiles.canOpen
|
void |
close()
Close all resources (files, sockets, etc) associated with this file.
|
void |
empty()
Deprecated.
|
Attribute |
findAttribute(java.lang.String fullNameEscaped)
Find an attribute, with the specified (escaped full) name.
|
java.lang.String |
findAttValueIgnoreCase(Variable v,
java.lang.String attName,
java.lang.String defaultValue)
Deprecated.
use getRootGroup() or Variable attributes().findAttributeString().
|
Dimension |
findDimension(java.lang.String fullName)
Finds a Dimension with the specified full name.
|
Attribute |
findGlobalAttribute(java.lang.String attName)
Look up an Attribute by (short) name in the root Group or nested Groups, exact match.
|
Attribute |
findGlobalAttributeIgnoreCase(java.lang.String name)
Look up an Attribute by (short) name in the root Group or nested Groups, ignore case.
|
Group |
findGroup(java.lang.String fullName)
Find a Group, with the specified (full) name.
|
Variable |
findVariable(Group g,
java.lang.String shortName)
Deprecated.
use g.findVariable(shortName)
|
Variable |
findVariable(java.lang.String fullNameEscaped)
Find a Variable, with the specified (escaped full) name.
|
Variable |
findVariableByAttribute(Group g,
java.lang.String attName,
java.lang.String attValue)
Deprecated.
use g.findVariableByAttribute(String attName, String attValue)
|
void |
finish()
Deprecated.
Use NetcdfFile.builder()
|
java.lang.String |
getCacheName()
Deprecated.
do not use
|
java.lang.String |
getDetailInfo()
Show debug / underlying implementation details
|
void |
getDetailInfo(java.util.Formatter f) |
com.google.common.collect.ImmutableList<Dimension> |
getDimensions()
Deprecated.
use ncfile.getRootGroup().getDimensions() for files without nested groups,
or recurse through nested groups to get dimensions.
|
java.lang.String |
getFileTypeDescription()
Get a human-readable description for this file type.
|
java.lang.String |
getFileTypeId()
Get the file type id for the underlying data source.
|
java.lang.String |
getFileTypeVersion()
Get the version of this file type.
|
com.google.common.collect.ImmutableList<Attribute> |
getGlobalAttributes()
Returns the set of global attributes associated with this file, which are the attributes associated
with the root group, or any subgroup.
|
java.lang.String |
getId()
Get the globally unique dataset identifier, if it exists.
|
IOServiceProvider |
getIosp()
Deprecated.
do not use.
|
long |
getLastModified()
Deprecated.
|
java.lang.String |
getLocation()
Get the NetcdfFile location.
|
Group |
getRootGroup()
Get the root group.
|
protected StructureDataIterator |
getStructureIterator(Structure s,
int bufferSize) |
java.lang.String |
getTitle()
Get the human-readable title, if it exists.
|
Dimension |
getUnlimitedDimension()
Return the unlimited (record) dimension, or null if not exist.
|
com.google.common.collect.ImmutableList<Variable> |
getVariables()
Get all of the variables in the file, in all groups.
|
boolean |
hasUnlimitedDimension()
Return true if this file has one or more unlimited (record) dimension.
|
static boolean |
iospDeRegister(java.lang.Class iospClass)
Deprecated.
use NetcdfFiles.iospDeRegister
|
static boolean |
iospRegistered(java.lang.Class iospClass)
Deprecated.
use NetcdfFiles.iospRegistered
|
protected static java.lang.String |
makeFullName(CDMNode v)
Deprecated.
use NetcdfFiles.makeFullName
|
protected static java.lang.String |
makeFullName(CDMNode node,
java.lang.String reservedChars)
Deprecated.
use NetcdfFiles.makeFullName
|
protected static java.lang.String |
makeFullNameSectionSpec(CDMNode v)
Deprecated.
use NetcdfFiles.makeFullNameSectionSpec
|
protected java.lang.String |
makeFullNameWithString(Group parent,
java.lang.String name)
Deprecated.
use NetcdfFiles.makeFullNameWithString
|
static java.lang.String |
makeNameUnescaped(java.lang.String vname)
Deprecated.
use NetcdfFiles.makeNameUnescaped
|
protected java.lang.Boolean |
makeRecordStructure()
Deprecated.
|
static java.lang.String |
makeValidCDLName(java.lang.String vname)
Deprecated.
use NetcdfFiles.makeValidCDLName
|
static java.lang.String |
makeValidCdmObjectName(java.lang.String shortName)
Deprecated.
use NetcdfFiles.makeValidCdmObjectName
|
static java.lang.String |
makeValidPathName(java.lang.String vname)
Deprecated.
use NetcdfFiles.makeValidPathName
|
static java.lang.String |
makeValidSectionSpecName(java.lang.String vname)
Deprecated.
use NetcdfFiles.makeValidSectionSpecName
|
static NetcdfFile |
open(RandomAccessFile raf,
java.lang.String location,
CancelTask cancelTask,
java.lang.Object iospMessage)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
open(java.lang.String location)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
open(java.lang.String location,
CancelTask cancelTask)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
open(java.lang.String location,
int buffer_size,
CancelTask cancelTask)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
open(java.lang.String location,
int buffer_size,
CancelTask cancelTask,
java.lang.Object iospMessage)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
open(java.lang.String location,
java.lang.String iospClassName,
int bufferSize,
CancelTask cancelTask,
java.lang.Object iospMessage)
Deprecated.
use NetcdfFiles.open
|
static NetcdfFile |
openInMemory(java.lang.String filename)
Deprecated.
use NetcdfFiles.openInMemory
|
static NetcdfFile |
openInMemory(java.lang.String name,
byte[] data)
Deprecated.
use NetcdfFiles.openInMemory
|
static NetcdfFile |
openInMemory(java.lang.String name,
byte[] data,
java.lang.String iospClassName)
Deprecated.
use NetcdfFiles.openInMemory
|
static NetcdfFile |
openInMemory(java.net.URI uri)
Deprecated.
use NetcdfFiles.openInMemory
|
void |
reacquire()
Deprecated.
do not use
|
Array |
read(java.lang.String variableSection,
boolean flatten)
Deprecated.
use readSection(), flatten=false no longer supported
|
java.util.List<Array> |
readArrays(java.util.List<Variable> variables)
Deprecated.
will be moved to DODSNetcdfFile in version 6.
|
double |
readAttributeDouble(Variable v,
java.lang.String attName,
double defValue)
Deprecated.
use use getRootGroup() or Variable attributes().findAttributeDouble
|
int |
readAttributeInteger(Variable v,
java.lang.String attName,
int defValue)
Deprecated.
use use getRootGroup() or Variable attributes().findAttributeInteger
|
protected Array |
readData(Variable v,
Section ranges)
Do not call this directly, use Variable.read() !!
Ranges must be filled (no nulls)
|
Array |
readSection(java.lang.String variableSection)
Read a variable using the given section specification.
|
protected long |
readToByteChannel(Variable v,
Section section,
java.nio.channels.WritableByteChannel wbc)
Deprecated.
do not use
|
protected long |
readToOutputStream(Variable v,
Section section,
java.io.OutputStream out) |
static void |
registerIOProvider(java.lang.Class iospClass)
Deprecated.
use NetcdfFiles.registerIOProvider
|
static void |
registerIOProvider(java.lang.Class iospClass,
boolean last)
Deprecated.
use NetcdfFiles.registerIOProvider
|
static void |
registerIOProvider(java.lang.String className)
Deprecated.
use NetcdfFiles.registerIOProvider
|
static void |
registerIOProviderPreferred(java.lang.Class iospClass,
java.lang.Class target)
Deprecated.
use NetcdfFiles.registerIOProvider
|
void |
release()
Deprecated.
do not use
|
boolean |
removeDimension(Group g,
java.lang.String dimName)
Deprecated.
Use NetcdfFile.builder()
|
protected java.lang.Boolean |
removeRecordStructure()
Deprecated.
|
boolean |
removeVariable(Group g,
java.lang.String varName)
Deprecated.
Use NetcdfFile.builder()
|
java.lang.Object |
sendIospMessage(java.lang.Object message)
Generic way to send a "message" to the underlying IOSP.
|
protected void |
setCacheName(java.lang.String cacheName)
Deprecated.
do not use
|
static void |
setDebugFlags(DebugFlags debugFlag)
Deprecated.
do not use
|
void |
setFileCache(FileCacheIF cache)
Deprecated.
do not use
|
void |
setId(java.lang.String id)
Deprecated.
Use NetcdfFile.builder()
|
NetcdfFile |
setImmutable()
Deprecated.
Use NetcdfFile.builder()
|
void |
setLocation(java.lang.String location)
Deprecated.
Use NetcdfFile.builder()
|
static void |
setProperty(java.lang.String name,
java.lang.String value)
Deprecated.
do not use
|
void |
setRootGroup(Group rootGroup)
Deprecated.
Use NetcdfFile.builder()
|
void |
setTitle(java.lang.String title)
Deprecated.
Use NetcdfFile.builder()
|
protected void |
showCached(java.util.Formatter f)
Deprecated.
do not use
|
protected void |
showProxies(java.util.Formatter f) |
boolean |
syncExtend()
Deprecated.
do not use
|
NetcdfFile.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
java.lang.String |
toNcml(java.lang.String url)
NcML representation of Netcdf header info, non strict
|
java.lang.String |
toString()
CDL representation of Netcdf header info, non strict
|
protected java.lang.String |
toStringDebug(java.lang.Object o)
Access to iosp debugging info.
|
protected void |
writeCDL(java.util.Formatter f,
Indent indent,
boolean strict) |
void |
writeCDL(java.io.OutputStream out,
boolean strict)
Deprecated.
use CDLWriter
|
void |
writeCDL(java.io.PrintWriter pw,
boolean strict)
Deprecated.
use CDLWriter
|
void |
writeNcml(java.io.OutputStream os,
java.lang.String uri)
Write the NcML representation: dont show coordinate values
|
void |
writeNcml(java.io.Writer writer,
java.lang.String uri)
Write the NcML representation: dont show coordinate values
|
@Deprecated public static final java.lang.String IOSP_MESSAGE_ADD_RECORD_STRUCTURE
@Deprecated public static final java.lang.String IOSP_MESSAGE_CONVERT_RECORD_STRUCTURE
@Deprecated public static final java.lang.String IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE
public static final java.lang.String IOSP_MESSAGE_RANDOM_ACCESS_FILE
public static final java.lang.String IOSP_MESSAGE_GET_NETCDF_FILE_FORMAT
protected java.lang.String location
protected java.lang.String id
protected java.lang.String title
protected Group rootGroup
protected IOServiceProvider iosp
protected FileCacheIF cache
@Deprecated protected java.util.List<Variable> variables
@Deprecated protected java.util.List<Dimension> dimensions
@Deprecated protected java.util.List<Attribute> gattributes
@Deprecated public NetcdfFile(java.lang.String filename) throws java.io.IOException
filename
- locationjava.io.IOException
- if error@Deprecated public NetcdfFile(java.net.URL url) throws java.io.IOException
url
- HTTP URL locationjava.io.IOException
- if error@Deprecated protected NetcdfFile(java.lang.String iospClassName, java.lang.Object iospParam, java.lang.String location, int buffer_size, CancelTask cancelTask) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException
iospClassName
- the name of the class implementing IOServiceProvideriospParam
- parameter to pass to the IOSP (before open is called)location
- location of file. This is a URL string, or a local pathname.buffer_size
- use this buffer size on the RandomAccessFilecancelTask
- allow user to canceljava.lang.ClassNotFoundException
- if the iospClassName cannot be foundjava.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.java.lang.InstantiationException
- if the class cannot be instatiated, eg if it has no nullary constructorjava.io.IOException
- if I/O error@Deprecated protected NetcdfFile(IOServiceProvider spi, RandomAccessFile raf, java.lang.String location, CancelTask cancelTask) throws java.io.IOException
spi
- use this IOServiceProvider instanceraf
- read from this RandomAccessFilecancelTask
- allow user to cancellocation
- location of datajava.io.IOException
- if I/O error@Deprecated protected NetcdfFile(IOServiceProvider spi, java.lang.String location)
spi
- use this IOServiceProvider instancelocation
- location of data@Deprecated protected NetcdfFile()
@Deprecated protected NetcdfFile(NetcdfFile ncfile)
ncfile
- copy from hereprotected NetcdfFile(NetcdfFile.Builder<?> builder)
@Deprecated public static void setDebugFlags(DebugFlags debugFlag)
@Deprecated public static void registerIOProvider(java.lang.String className) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException
className
- Class that implements IOServiceProvider.java.lang.IllegalAccessException
- if class is not accessible.java.lang.InstantiationException
- if class doesnt have a no-arg constructor.java.lang.ClassNotFoundException
- if class not found.@Deprecated public static void registerIOProvider(java.lang.Class iospClass) throws java.lang.IllegalAccessException, java.lang.InstantiationException
iospClass
- Class that implements IOServiceProvider.java.lang.IllegalAccessException
- if class is not accessible.java.lang.InstantiationException
- if class doesnt have a no-arg constructor.java.lang.ClassCastException
- if class doesnt implement IOServiceProvider interface.@Deprecated public static void registerIOProvider(java.lang.Class iospClass, boolean last) throws java.lang.IllegalAccessException, java.lang.InstantiationException
iospClass
- Class that implements IOServiceProvider.last
- true=>insert at the end of the list; otherwise frontjava.lang.IllegalAccessException
- if class is not accessible.java.lang.InstantiationException
- if class doesnt have a no-arg constructor.java.lang.ClassCastException
- if class doesnt implement IOServiceProvider interface.@Deprecated public static void registerIOProviderPreferred(java.lang.Class iospClass, java.lang.Class target) throws java.lang.IllegalAccessException, java.lang.InstantiationException
iospClass
- Class that implements IOServiceProvider.target
- Class to overridejava.lang.IllegalAccessException
- if class is not accessible.java.lang.InstantiationException
- if class doesnt have a no-arg constructor.java.lang.ClassCastException
- if class doesnt implement IOServiceProvider interface.@Deprecated public static boolean iospRegistered(java.lang.Class iospClass)
iospClass
- Class for which to search@Deprecated public static boolean iospDeRegister(java.lang.Class iospClass)
iospClass
- Class for which to search and remove@Deprecated public static void setProperty(java.lang.String name, java.lang.String value)
name
- name of propertyvalue
- value of property@Deprecated public static NetcdfFile open(java.lang.String location) throws java.io.IOException
location
- location of file.java.io.IOException
- if error@Deprecated public static NetcdfFile open(java.lang.String location, CancelTask cancelTask) throws java.io.IOException
location
- location of the file.cancelTask
- allow task to be cancelled; may be null.java.io.IOException
- if error@Deprecated public static NetcdfFile open(java.lang.String location, int buffer_size, CancelTask cancelTask) throws java.io.IOException
location
- location of file.buffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.java.io.IOException
- if error@Deprecated public static NetcdfFile open(java.lang.String location, int buffer_size, CancelTask cancelTask, java.lang.Object iospMessage) throws java.io.IOException
location
- location of file. This may be a
buffer_size
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.iospMessage
- special iosp tweaking (sent before open is called), may be nulljava.io.IOException
- if error@Deprecated public static boolean canOpen(java.lang.String location) throws java.io.IOException
location
- same as openjava.io.IOException
- on read error@Deprecated public static NetcdfFile open(java.lang.String location, java.lang.String iospClassName, int bufferSize, CancelTask cancelTask, java.lang.Object iospMessage) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.io.IOException
location
- location of fileiospClassName
- fully qualified class name of the IOSP class to handle this filebufferSize
- RandomAccessFile buffer size, if <= 0, use default sizecancelTask
- allow task to be cancelled; may be null.iospMessage
- special iosp tweaking (sent before open is called), may be nulljava.io.IOException
- if read errorjava.lang.ClassNotFoundException
- cannat find iospClassName in thye class pathjava.lang.InstantiationException
- if class cannot be instantiatedjava.lang.IllegalAccessException
- if class is not accessible@Deprecated public static java.lang.String canonicalizeUriString(java.lang.String location)
"file:"
or "file://"
prefix from the location, if necessary. Also replaces
back slashes with forward slashes.location
- a URI string.@Deprecated public static NetcdfFile openInMemory(java.lang.String name, byte[] data, java.lang.String iospClassName) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
name
- name of the dataset. Typically use the filename or URI.data
- in-memory netcdf fileiospClassName
- fully qualified class name of the IOSP class to handle this filejava.io.IOException
- if read errorjava.lang.ClassNotFoundException
- cannat find iospClassName in the class pathjava.lang.InstantiationException
- if class cannot be instantiatedjava.lang.IllegalAccessException
- if class is not accessible@Deprecated public static NetcdfFile openInMemory(java.lang.String name, byte[] data) throws java.io.IOException
name
- name of the dataset. Typically use the filename or URI.data
- in-memory netcdf filejava.io.IOException
- if error@Deprecated public static NetcdfFile openInMemory(java.lang.String filename) throws java.io.IOException
filename
- location of CDM file, must be a local file.java.io.IOException
- if error reading file@Deprecated public static NetcdfFile openInMemory(java.net.URI uri) throws java.io.IOException
uri
- location of CDM file, must be accessible through url.toURL().openStream().java.io.IOException
- if error reading file@Deprecated public static NetcdfFile open(RandomAccessFile raf, java.lang.String location, CancelTask cancelTask, java.lang.Object iospMessage) throws java.io.IOException
raf
- The open raf, is not cloised by this method.location
- human readable locatoin of this dataset.cancelTask
- used to monitor user cancellation; may be null.iospMessage
- send this message to iosp; may be null.java.io.IOException
- if cannot open as a CDM NetCDF.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface FileCacheable
java.io.IOException
- if error when closing@Deprecated public void release() throws java.io.IOException
release
in interface FileCacheable
java.io.IOException
@Deprecated public void reacquire() throws java.io.IOException
reacquire
in interface FileCacheable
java.io.IOException
@Deprecated public void setFileCache(FileCacheIF cache)
setFileCache
in interface FileCacheable
cache
- must store this, use it on close as above.@Deprecated public java.lang.String getCacheName()
@Deprecated protected void setCacheName(java.lang.String cacheName)
cacheName
- name in the cache, should be unique for this NetcdfFile. Usually the location.public java.lang.String getLocation()
getLocation
in interface FileCacheable
@Nullable public java.lang.String getId()
@Nullable public java.lang.String getTitle()
public Group getRootGroup()
@Nullable public Group findGroup(@Nullable java.lang.String fullName)
fullName
- eg "/group/subgroup/wantGroup". Null or empty string returns the root group.@Deprecated @Nullable public Variable findVariable(Group g, java.lang.String shortName)
g
- A group in this file. Null for root group.shortName
- short name of the Variable.@Nullable public Variable findVariable(java.lang.String fullNameEscaped)
fullNameEscaped
- eg "/group/subgroup/name1.name2.name".@Deprecated @Nullable public Variable findVariableByAttribute(Group g, java.lang.String attName, java.lang.String attValue)
g
- start with this Group, null for the root Group.attName
- look for an Attribuite with this name.attValue
- look for an Attribuite with this value.@Nullable public Dimension findDimension(java.lang.String fullName)
fullName
will be treated as if it were there. In other words, the first name token in
fullName
is treated as the short name of a Group or Dimension, relative to the root group.fullName
- Dimension full name, e.g. "/group/subgroup/dim".null
if it wasn't found.public boolean hasUnlimitedDimension()
@Nullable public Dimension getUnlimitedDimension()
@Deprecated public com.google.common.collect.ImmutableList<Dimension> getDimensions()
If the dimensions are in a group, the dimension name will have the group name, in order to disambiguate the dimensions. This means that a Variable's dimensions will not match Dimensions in this list. Therefore it is better to get the shared Dimensions directly from the Groups.
public com.google.common.collect.ImmutableList<Variable> getVariables()
public com.google.common.collect.ImmutableList<Attribute> getGlobalAttributes()
@Nullable public Attribute findGlobalAttribute(java.lang.String attName)
attName
- the name of the attribute@Nullable public Attribute findGlobalAttributeIgnoreCase(java.lang.String name)
name
- the name of the attribute@Nullable public Attribute findAttribute(java.lang.String fullNameEscaped)
fullNameEscaped
- eg "@attName", "/group/subgroup/@attName" or "/group/subgroup/varname.name2.name@attName"@Deprecated public java.lang.String findAttValueIgnoreCase(Variable v, java.lang.String attName, java.lang.String defaultValue)
v
- the variable or null to look in the root group.attName
- the (full) name of the attribute, case insensitivedefaultValue
- return this if attribute not found@Deprecated public double readAttributeDouble(Variable v, java.lang.String attName, double defValue)
@Deprecated public int readAttributeInteger(Variable v, java.lang.String attName, int defValue)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toNcml(java.lang.String url)
public void writeNcml(java.io.OutputStream os, java.lang.String uri) throws java.io.IOException
os
- : write to this OutputStream. Will be closed at end of the method.uri
- use this for the url attribute; if null use getLocation(). // ??java.io.IOException
- if errorpublic void writeNcml(java.io.Writer writer, java.lang.String uri) throws java.io.IOException
writer
- : write to this Writer, should have encoding of UTF-8. Will be closed at end of the
method.uri
- use this for the url attribute; if null use getLocation().java.io.IOException
- if error@Deprecated public void writeCDL(java.io.OutputStream out, boolean strict)
out
- write to this OutputStreamstrict
- if true, make it stricly CDL, otherwise, add a little extra info@Deprecated public void writeCDL(java.io.PrintWriter pw, boolean strict)
pw
- write to this PrintWriterstrict
- if true, make it stricly CDL, otherwise, add a little extra infoprotected void writeCDL(java.util.Formatter f, Indent indent, boolean strict)
@Deprecated public boolean syncExtend() throws java.io.IOException
java.io.IOException
- if error@Deprecated public long getLastModified()
FileCacheable
FileFactory
.getLastModified
in interface FileCacheable
long
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 Attribute addAttribute(Group parent, Attribute att)
parent
- add to this group. If group is null, use root groupatt
- add this attribute@Deprecated public Attribute addAttribute(Group parent, java.lang.String name, java.lang.String value)
parent
- add to this group. If group is null, use root groupname
- attribute name, may not be nullvalue
- attribute value, may be null, in which case, do not addd@Deprecated public Group addGroup(Group parent, Group g)
parent
- add to this group. If group is null, use root groupg
- add this group@Deprecated public void setRootGroup(Group rootGroup)
@Deprecated public Dimension addDimension(Group parent, Dimension d)
parent
- add to this group. If group is null, use root groupd
- add this Dimension@Deprecated public boolean removeDimension(Group g, java.lang.String dimName)
g
- remove from this group. If group is null, use root groupdimName
- name of Dimension to remove.@Deprecated public Variable addVariable(Group g, Variable v)
g
- add to this group. If group is null, use root groupv
- add this Variable@Deprecated public Variable addVariable(Group g, java.lang.String shortName, DataType dtype, java.lang.String dims)
g
- add to this group. If group is null, use root groupshortName
- short name of the Variabledtype
- data type of the Variabledims
- list of dimension names@Deprecated public Variable addStringVariable(Group g, java.lang.String shortName, java.lang.String dims, int strlen)
g
- add to this group. If group is null, use root groupshortName
- short name of the Variabledims
- list of dimension namesstrlen
- dimension length of the inner (fastest changing) dimension@Deprecated public boolean removeVariable(Group g, java.lang.String varName)
g
- remove from this group. If group is null, use root groupvarName
- name of variable to remove.@Deprecated public Attribute addVariableAttribute(Variable v, Attribute att)
v
- add to this Variable.att
- add this attributepublic java.lang.Object sendIospMessage(java.lang.Object message)
message
- iosp specific message@Deprecated protected java.lang.Boolean makeRecordStructure()
@Deprecated protected java.lang.Boolean removeRecordStructure()
@Deprecated public void setId(java.lang.String id)
id
- the id@Deprecated public void setTitle(java.lang.String title)
title
- the title@Deprecated public void setLocation(java.lang.String location)
location
- the location@Deprecated public NetcdfFile setImmutable()
@Deprecated public void empty()
@Deprecated public void finish()
protected Array readData(Variable v, Section ranges) throws java.io.IOException, InvalidRangeException
java.io.IOException
InvalidRangeException
public Array readSection(java.lang.String variableSection) throws java.io.IOException, InvalidRangeException
variableSection
- the constraint expression.java.io.IOException
- if errorInvalidRangeException
- if variableSection is invalid@Deprecated protected long readToByteChannel(Variable v, Section section, java.nio.channels.WritableByteChannel wbc) throws java.io.IOException, InvalidRangeException
v
- a top-level Variablesection
- the section of data to read.
There must be a Range for each Dimension in the variable, in order.
Note: no nulls allowed. IOSP may not modify.wbc
- write data to this WritableByteChanneljava.io.IOException
- if read errorInvalidRangeException
- if invalid sectionprotected long readToOutputStream(Variable v, Section section, java.io.OutputStream out) throws java.io.IOException, InvalidRangeException
java.io.IOException
InvalidRangeException
protected StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws java.io.IOException
java.io.IOException
@Deprecated public java.util.List<Array> readArrays(java.util.List<Variable> variables) throws java.io.IOException
variables
- List of type Variablejava.io.IOException
- if read error@Deprecated public Array read(java.lang.String variableSection, boolean flatten) throws java.io.IOException, InvalidRangeException
variableSection
- the constraint expression.flatten
- MUST BE TRUEjava.io.IOException
- if errorInvalidRangeException
- if variableSection is invalidprotected java.lang.String toStringDebug(java.lang.Object o)
o
- must be a Variable, Dimension, Attribute, or Grouppublic java.lang.String getDetailInfo()
public void getDetailInfo(java.util.Formatter f)
@Deprecated protected void showCached(java.util.Formatter f)
protected void showProxies(java.util.Formatter f)
@Deprecated public IOServiceProvider getIosp()
public java.lang.String getFileTypeId()
public java.lang.String getFileTypeDescription()
public java.lang.String getFileTypeVersion()
@Deprecated public static java.lang.String makeValidCdmObjectName(java.lang.String shortName)
shortName
- from this name@Deprecated public static java.lang.String makeValidCDLName(java.lang.String vname)
vname
- the name@Deprecated public static java.lang.String makeValidPathName(java.lang.String vname)
vname
- the name@Deprecated public static java.lang.String makeValidSectionSpecName(java.lang.String vname)
vname
- the name@Deprecated public static java.lang.String makeNameUnescaped(java.lang.String vname)
vname
- the escaped name@Deprecated protected static java.lang.String makeFullName(CDMNode v)
v
- the cdm node@Deprecated protected static java.lang.String makeFullNameSectionSpec(CDMNode v)
v
- the cdm node@Deprecated protected static java.lang.String makeFullName(CDMNode node, java.lang.String reservedChars)
node
- the cdm nodereservedChars
- the set of characters to escape@Deprecated protected java.lang.String makeFullNameWithString(Group parent, java.lang.String name)
parent
- parent groupname
- synthetic name stringpublic NetcdfFile.Builder<?> toBuilder()
protected NetcdfFile.Builder<?> addLocalFieldsToBuilder(NetcdfFile.Builder<? extends NetcdfFile.Builder<?>> b)
public static NetcdfFile.Builder<?> builder()