@Deprecated
public class NcMLWriter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
NcMLWriter.WriteVariablesWithNamesPredicate
Deprecated.
Predicate that returns
true for variables whose names are specified to the constructor. |
Modifier and Type | Field and Description |
---|---|
static org.jdom2.Namespace |
ncmlDefaultNamespace
Deprecated.
A default namespace constructed from the NcML URI:
http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2 . |
static com.google.common.base.Predicate<Variable> |
writeAllVariablesPredicate
Deprecated.
Predicate that always returns
true . |
static com.google.common.base.Predicate<Variable> |
writeCoordinateVariablesPredicate
Deprecated.
Predicate that returns
true for variables that are
coordinate variables . |
static com.google.common.base.Predicate<Variable> |
writeMetadataVariablesPredicate
Deprecated.
Predicate that returns
true for variables that are metadata variables . |
static com.google.common.base.Predicate<Variable> |
writeNoVariablesPredicate
Deprecated.
Predicate that always returns
false . |
Constructor and Description |
---|
NcMLWriter()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
org.jdom2.Namespace |
getNamespace()
Deprecated.
Gets the XML namespace for the elements in the NcML.
|
com.google.common.base.Predicate<Variable> |
getWriteVariablesPredicate()
Deprecated.
Gets the predicate that will be applied to variables to determine wither their values should be written in
addition to their metadata.
|
org.jdom2.output.Format |
getXmlFormat()
Deprecated.
Gets the object that encapsulates XML formatting options.
|
org.jdom2.Element |
makeAttributeElement(Attribute attribute)
Deprecated.
|
org.jdom2.Element |
makeDimensionElement(Dimension dim)
Deprecated.
|
org.jdom2.Element |
makeEnumTypedefElement(EnumTypedef etd)
Deprecated.
|
org.jdom2.Element |
makeExplicitNetcdfElement(NetcdfFile ncFile,
java.lang.String location)
Deprecated.
|
org.jdom2.Element |
makeGroupElement(Group group)
Deprecated.
|
org.jdom2.Element |
makeNetcdfElement(NetcdfFile ncFile,
java.lang.String location)
Deprecated.
|
org.jdom2.Element |
makeValuesElement(Variable variable,
boolean allowRegular)
Deprecated.
Creates a
<values> element from the variable's data. |
org.jdom2.Element |
makeVariableElement(Variable var,
boolean showValues)
Deprecated.
|
void |
setNamespace(org.jdom2.Namespace namespace)
Deprecated.
Sets the XML namespace.
|
void |
setWriteVariablesPredicate(com.google.common.base.Predicate<Variable> predicate)
Deprecated.
Sets the predicate that will be applied to variables to determine whether their values should be written in
addition to their metadata.
|
void |
setXmlFormat(org.jdom2.output.Format xmlFormat)
Deprecated.
|
void |
writeToFile(org.jdom2.Element elem,
java.io.File outFile)
Deprecated.
Writes an NcML element to an output file.
|
void |
writeToStream(org.jdom2.Element elem,
java.io.OutputStream outStream)
Deprecated.
Writes an NcML element to an output stream.
|
java.lang.String |
writeToString(org.jdom2.Element elem)
Deprecated.
Writes an NcML element to a string.
|
void |
writeToWriter(org.jdom2.Element elem,
java.io.Writer writer)
Deprecated.
Writes an NcML element to a Writer.
|
public static final org.jdom2.Namespace ncmlDefaultNamespace
http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2
.public static final com.google.common.base.Predicate<Variable> writeNoVariablesPredicate
false
.public static final com.google.common.base.Predicate<Variable> writeMetadataVariablesPredicate
true
for variables that are metadata variables
.
For such variables, the data is not actually present in the file, so we must include it in the NcML.
It could be synthesized (i.e. generated by an IOSP) or specified in a public static final com.google.common.base.Predicate<Variable> writeCoordinateVariablesPredicate
true
for variables that are
coordinate variables
.public static final com.google.common.base.Predicate<Variable> writeAllVariablesPredicate
true
.public org.jdom2.Namespace getNamespace()
ncmlDefaultNamespace
.public void setNamespace(org.jdom2.Namespace namespace)
namespace
- the new namespace. null
implies Namespace.NO_NAMESPACE
.public org.jdom2.output.Format getXmlFormat()
pretty
with UNIX line separators
.public void setXmlFormat(org.jdom2.output.Format xmlFormat)
public com.google.common.base.Predicate<Variable> getWriteVariablesPredicate()
<values>
element.public void setWriteVariablesPredicate(com.google.common.base.Predicate<Variable> predicate)
<values>
element.
By default, the predicate will be writeMetadataVariablesPredicate
. Their could be data loss if the values
of metadata variables aren't included in the NcML, so we recommend that you always use it, possibly as part of a
compound predicate. For example, suppose you wanted to print the values of metadata and coordinate
variables. Just do:
PredicatecompoundPred = Predicates.or(writeMetadataVariablesPredicate, writeCoordinateVariablesPredicate); ncmlWriter.setWriteVariablesPredicate(compoundPred);
predicate
- the predicate to apply.public java.lang.String writeToString(org.jdom2.Element elem)
elem
- an NcML element.public void writeToFile(org.jdom2.Element elem, java.io.File outFile) throws java.io.IOException
elem
- an NcML element.outFile
- the file to write the NcML document to.java.io.IOException
- if there's any problem writing.public void writeToStream(org.jdom2.Element elem, java.io.OutputStream outStream) throws java.io.IOException
elem
- an NcML element.outStream
- the stream to write the NcML document to. Will be closed at end of the method.java.io.IOException
- if there's any problem writing.public void writeToWriter(org.jdom2.Element elem, java.io.Writer writer) throws java.io.IOException
elem
- an NcML element.writer
- the Writer to write the NcML document to. Will be closed at end of the method.java.io.IOException
- if there's any problem writing.public org.jdom2.Element makeExplicitNetcdfElement(NetcdfFile ncFile, java.lang.String location)
public org.jdom2.Element makeNetcdfElement(NetcdfFile ncFile, java.lang.String location)
public org.jdom2.Element makeGroupElement(Group group)
public org.jdom2.Element makeEnumTypedefElement(EnumTypedef etd)
public org.jdom2.Element makeDimensionElement(Dimension dim) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public org.jdom2.Element makeVariableElement(Variable var, boolean showValues)
public org.jdom2.Element makeAttributeElement(Attribute attribute)
public org.jdom2.Element makeValuesElement(Variable variable, boolean allowRegular) throws java.io.IOException
<values>
element from the variable's data.variable
- the variable to read values fromallowRegular
- true
if regular values should be represented with start
, increment
,
and npts
attributes instead of space-separated Element text. Has no effect if the data isn't
regular.<values>
element.java.io.IOException
- if there was an I/O error when reading the variable's data.