Package ucar.nc2.ncml
Class NcMLWriter
- java.lang.Object
-
- ucar.nc2.ncml.NcMLWriter
-
@Deprecated public class NcMLWriter extends Object
Deprecated.use ucar.nc2.write.NcmlWriterHelper class to write NcML.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NcMLWriter.WriteVariablesWithNamesPredicate
Deprecated.Predicate that returnstrue
for variables whose names are specified to the constructor.
-
Field Summary
Fields Modifier and Type Field 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 returnstrue
.static com.google.common.base.Predicate<Variable>
writeCoordinateVariablesPredicate
Deprecated.Predicate that returnstrue
for variables that arecoordinate variables
.static com.google.common.base.Predicate<Variable>
writeMetadataVariablesPredicate
Deprecated.Predicate that returnstrue
for variables that aremetadata variables
.static com.google.common.base.Predicate<Variable>
writeNoVariablesPredicate
Deprecated.Predicate that always returnsfalse
.
-
Constructor Summary
Constructors Constructor Description NcMLWriter()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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, String location)
Deprecated.org.jdom2.Element
makeGroupElement(Group group)
Deprecated.org.jdom2.Element
makeNetcdfElement(NetcdfFile ncFile, 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, File outFile)
Deprecated.Writes an NcML element to an output file.void
writeToStream(org.jdom2.Element elem, OutputStream outStream)
Deprecated.Writes an NcML element to an output stream.String
writeToString(org.jdom2.Element elem)
Deprecated.Writes an NcML element to a string.void
writeToWriter(org.jdom2.Element elem, Writer writer)
Deprecated.Writes an NcML element to a Writer.
-
-
-
Field Detail
-
ncmlDefaultNamespace
public static final org.jdom2.Namespace ncmlDefaultNamespace
Deprecated.A default namespace constructed from the NcML URI:http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2
.
-
writeNoVariablesPredicate
public static final com.google.common.base.Predicate<Variable> writeNoVariablesPredicate
Deprecated.Predicate that always returnsfalse
.
-
writeMetadataVariablesPredicate
public static final com.google.common.base.Predicate<Variable> writeMetadataVariablesPredicate
Deprecated.Predicate that returnstrue
for variables that aremetadata 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 aelement of the input NcML.
-
writeCoordinateVariablesPredicate
public static final com.google.common.base.Predicate<Variable> writeCoordinateVariablesPredicate
Deprecated.Predicate that returnstrue
for variables that arecoordinate variables
.
-
writeAllVariablesPredicate
public static final com.google.common.base.Predicate<Variable> writeAllVariablesPredicate
Deprecated.Predicate that always returnstrue
.
-
-
Method Detail
-
getNamespace
public org.jdom2.Namespace getNamespace()
Deprecated.Gets the XML namespace for the elements in the NcML. By default, it isncmlDefaultNamespace
.- Returns:
- the XML namespace.
-
setNamespace
public void setNamespace(org.jdom2.Namespace namespace)
Deprecated.Sets the XML namespace.- Parameters:
namespace
- the new namespace.null
impliesNamespace.NO_NAMESPACE
.
-
getXmlFormat
public org.jdom2.output.Format getXmlFormat()
Deprecated.Gets the object that encapsulates XML formatting options. By default, the format ispretty
withUNIX line separators
.- Returns:
- the XML formatting options.
-
setXmlFormat
public void setXmlFormat(org.jdom2.output.Format xmlFormat)
Deprecated.
-
getWriteVariablesPredicate
public 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. The values will be contained within a<values>
element.- Returns:
- the predicate.
-
setWriteVariablesPredicate
public 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. The values will be contained within a<values>
element. By default, the predicate will bewriteMetadataVariablesPredicate
. 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:Predicate
compoundPred = Predicates.or(writeMetadataVariablesPredicate, writeCoordinateVariablesPredicate); ncmlWriter.setWriteVariablesPredicate(compoundPred); - Parameters:
predicate
- the predicate to apply.
-
writeToString
public String writeToString(org.jdom2.Element elem)
Deprecated.Writes an NcML element to a string.- Parameters:
elem
- an NcML element.- Returns:
- the string that represents the NcML document.
-
writeToFile
public void writeToFile(org.jdom2.Element elem, File outFile) throws IOException
Deprecated.Writes an NcML element to an output file.- Parameters:
elem
- an NcML element.outFile
- the file to write the NcML document to.- Throws:
IOException
- if there's any problem writing.
-
writeToStream
public void writeToStream(org.jdom2.Element elem, OutputStream outStream) throws IOException
Deprecated.Writes an NcML element to an output stream.- Parameters:
elem
- an NcML element.outStream
- the stream to write the NcML document to. Will be closed at end of the method.- Throws:
IOException
- if there's any problem writing.
-
writeToWriter
public void writeToWriter(org.jdom2.Element elem, Writer writer) throws IOException
Deprecated.Writes an NcML element to a Writer.- Parameters:
elem
- an NcML element.writer
- the Writer to write the NcML document to. Will be closed at end of the method.- Throws:
IOException
- if there's any problem writing.
-
makeExplicitNetcdfElement
public org.jdom2.Element makeExplicitNetcdfElement(NetcdfFile ncFile, String location)
Deprecated.
-
makeNetcdfElement
public org.jdom2.Element makeNetcdfElement(NetcdfFile ncFile, String location)
Deprecated.
-
makeGroupElement
public org.jdom2.Element makeGroupElement(Group group)
Deprecated.
-
makeEnumTypedefElement
public org.jdom2.Element makeEnumTypedefElement(EnumTypedef etd)
Deprecated.
-
makeDimensionElement
public org.jdom2.Element makeDimensionElement(Dimension dim) throws IllegalArgumentException
Deprecated.- Throws:
IllegalArgumentException
-
makeVariableElement
public org.jdom2.Element makeVariableElement(Variable var, boolean showValues)
Deprecated.
-
makeAttributeElement
public org.jdom2.Element makeAttributeElement(Attribute attribute)
Deprecated.
-
makeValuesElement
public org.jdom2.Element makeValuesElement(Variable variable, boolean allowRegular) throws IOException
Deprecated.Creates a<values>
element from the variable's data.- Parameters:
variable
- the variable to read values fromallowRegular
-true
if regular values should be represented withstart
,increment
, andnpts
attributes instead of space-separated Element text. Has no effect if the data isn't regular.- Returns:
- the
<values>
element. - Throws:
IOException
- if there was an I/O error when reading the variable's data.
-
-