COMMENTED SCHEMA FOR NcML
(Netcdf Markup Language)
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema targetNamespace="http://www.ucar.edu/schemas/netcdf"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nc="http://www.ucar.edu/schemas/netcdf"
elementFormDefault="qualified">
Netcdf
The Netcdf object represents a generic netCDF dataset, i.e. a container
for data conforming to the netCDF model. For instance, a Netcdf object
might represent a netCDF file, a subset of a netCDF file, a set of potential
netCDF files, an aggregation of netCDF files or a self-contained dataset (i.e.
all the data is already included in the NcML document and there is no netCDF
file holding the data). A Netcdf object
therefore should not necessarily be thought of as a physical netCDF file, but
rather the "public interface" or API to a set of data, which may or
may not be implemented with a physical netCDF file. The element netcdf
is the root tag of the NcML instance document.
<!-- XML encoding of Netcdf container object -->
<xsd:complexType name="NetcdfType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
(1)
<xsd:element ref="nc:dimension"/>
<xsd:element ref="nc:variable" />
<xsd:element ref="nc:attribute"/>
</xsd:choice>
<xsd:attribute name="id" type="xsd:token"
use="optional" /> (2)
<xsd:attribute name="uri" type="xsd:anyURI"
use="optional" /> (3)
</xsd:complexType>
<xsd:element name="netcdf" type="nc:NetcdfType">
<!-- uniqueness constraints among children of netcdf element
-->
<xsd:key name="dimensionName"> (4)
<xsd:selector xpath="nc:dimension" />
<xsd:field xpath="@name" />
</xsd:key>
<xsd:key name="variableName"> (5)
<xsd:selector xpath="nc:variable" />
<xsd:field xpath="@name" />
</xsd:key>
<xsd:key name="globalAttributeName"> (6)
<xsd:selector xpath="nc:attribute" />
<xsd:field xpath="@name" />
</xsd:key>
</xsd:element>
The name attribute of a variable element must be unique within the scope of the enclosing netcdf element (this constraint is compatible with the netCDF requirements that there cannot be two variables in the same file with the same name
The name attribute of a global attribute element must be unique within the scope of the enclosing netcdf element (this constraint is compatible with the netCDF requirements that there cannot be two global attributes in the same file with the same name)
Dimension
A Dimension object represents a netCDF
dimension, i.e. a named index of specified length.
<!-- XML encoding of Dimension object -->
<xsd:complexType name="DimensionType">
<xsd:attribute name="name" type="xsd:token"
use="required" /> (1)
<xsd:attribute name="length" type="xsd:nonNegativeInteger"
use="required" /> (2)
<xsd:attribute name="isUnlimited" type="xsd:boolean"
default="false" /> (3)
</xsd:complexType>
<xsd:element name="dimension" type="nc:DimensionType" />
Variable
A Variable object represents a netCDF variable,
i.e. a scalar or multidimensional array of specified type indexed by 0 or more
dimensions.
<!-- XML encoding of Variable object -->
<xsd:complexType name="VariableType">
<xsd:sequence> (1)
<xsd:element ref="nc:attribute" minOccurs="0"
maxOccurs="unbounded" /> (2)
<xsd:element ref="nc:values" minOccurs="0"
maxOccurs="1" /> (3)
</xsd:sequence>
<xsd:attribute name="name" type="xsd:token"
use="required" /> (4)
<xsd:attribute name="shape" type="xsd:token"
use="optional" /> (5)
<xsd:attribute name="type" type="nc:DataType"
use="required" /> (6)
</xsd:complexType>
<xsd:element name="variable" type="nc:VariableType">
<xsd:key name="variableAttributeName"> (7)
<xsd:selector xpath="nc:attribute" />
<xsd:field xpath="@name" />
</xsd:key>
</xsd:element>
<!-- XML encoding of Variable values -->
<xsd:complexType name="ValuesType" mixed="true">
<xsd:attribute name="separator" type="xsd:string"
default=" " /> (8)
</xsd:complexType>
<xsd:element name="values" type="nc:ValuesType" />
Attribute
The Attribute object represents a netCDF attribute,
i.e. a name-value pair of specified type. This could be a global netCDF attribute
(if it is a child of a netcdf element) or a netCDF variable attribute
(if it is a child of a variable element).
<!-- XML encoding of Attribute object -->
<xsd:complexType name="AttributeType">
<xsd:attribute name="name" type="xsd:token"
use="required" /> (1)
<xsd:attribute name="type" type="nc:DataType"
use="required" /> (2)
<xsd:attribute name="value" type="xsd:string"
use="optional" /> (3)
<xsd:attribute name="separator" type="xsd:string"
default=" " /> (4)
</xsd:complexType>
<xsd:element name="attribute" type="nc:AttributeType" />
Data Types
The DataType object
represents an enumerated list of the numerical data types allowed for NcML Variable
and Attribute objects. Note that the type "char" (which is
allowed in netCDF files) is not allowed in NcML, but it is substituted with
"string" (including strings of lenght 1).
<!-- possible data types for Variable, Attribute objects -->
<xsd:simpleType name="DataType">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="byte" />
<xsd:enumeration value="short" />
<xsd:enumeration value="int" />
<xsd:enumeration value="float" />
<xsd:enumeration value="double" />
<xsd:enumeration value="string" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>