DAP4 Array Representation: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
(New page: <dap:Float32 rdf:ID="longitude"> <att:units xmlns:att="http://dev1.opendap.org:8080/opendap/netcdf/examples/ECMWF_ERA-40_subset.nc/att#" rdf:datatype="http://www.w3.org/2001/XMLSchema#str...)
 
No edit summary
Line 1: Line 1:
=== Goal ===


<dap:Float32 rdf:ID="longitude">
Provide an improved XML representation of DAP Array objects.
<att:units xmlns:att="http://dev1.opendap.org:8080/opendap/netcdf/examples/ECMWF_ERA-40_subset.nc/att#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">degrees_east</att:units>
<att:long_name xmlns:att="http://dev1.opendap.org:8080/opendap/netcdf/examples/ECMWF_ERA-40_subset.nc/att#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">longitude</att:long_name>
<att:standard_name xmlns:att="http://dev1.opendap.org:8080/opendap/netcdf/examples/ECMWF_ERA-40_subset.nc/att#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">longitude</att:standard_name>
<dapObj:hasDimensions rdf:parseType="Collection">
<dap:dimension>
<dapObj:size>144</dapObj:size>
<dapObj:name>longitude</dapObj:name>
</dap:dimension>
</dapObj:hasDimensions>


=== Background ===


<int32 name="foo">
In the DAP2 DDX, arrays are represented as their own type, with an embedded (and nameless) template variable. So this:
<dimension >
 
</int32>
        <Array name="foo">
OK, we are at the same point
            <Int16/>
            <dimension name="i" size="2"/>
            <dimension name="j" size="3"/>
        </Array>
 
Represents 2x3  array of 16 bit integers, expressed like this a DDS:
 
    Int16 foo[2][3];
 
 
A "better", more intuitive, and more compact representation is proposed here.
 
=== Design ===
 
We think a better array representation for our DDX would be:
 
            <Int16 name="foo">
                <dimension name="i" size="2"/>
                <dimension name="j" size="3"/>
            </Int16>
 
So basically any type that contains a dap:dimension element is an array.  This is fairly straight forward for simple types and Structures. Arrays of Grids and Sequences are already disallowed. However, since the Grid data type contains 2 or more arrays types that are used as the grid's data array and Map vectors, the representation of Grid needs to be modified to accommodate this change.
 
Here is an example of a DAP2 DDX:
    <Grid name="order">
        <Array name="order">
            <Int16/>
            <dimension name="i" size="2"/>
            <dimension name="j" size="3"/>
        </Array>
        <Map name="i">
            <Int32/>
            <dimension name="i" size="2"/>
        </Map>
        <Map name="j">
            <Float32/>
            <dimension name="j" size="3"/>
        </Map>
    </Grid>
 
==== Option 1 ====
Add an optional "role" attribute to the simple types we could produce a Grid like this:
    <Grid name="order">
        <Int16 name="order" role="gridArray" >
            <dimension name="i" size="2"/>
            <dimension name="j" size="3"/>
        </Int16 >
        <Int32 name="i" role="gridMap">
            <dimension name="i" size="2"/>
        </Int32 >
        <Float32 name="j" role="gridMap">
            <dimension name="j" size="3"/>
        </Float32 >
    </Grid>
 
Developing an XML schema for this might be quite challenging.
 
==== Option 2 ====
Rely on document order to provide the differentiation between the grid Array and the Map arrays. (not probably a good idea when you consider that we want to allow multiple grid arrays in a grid.)
 
==== Option 3 ====
Encapsulate the Maps and grid Arrays:
 
    <Grid name="order">
        <grids>
            <Int16 name="order">
                <dimension name="i" size="2"/>
                <dimension name="j" size="3"/>
            </Int16>
        </grids >
        <maps>
            <Int32 name="i">
                <dimension name="i" size="2"/>
            </Int32>
            <Float32 name="j" >
                <dimension name="j" size="3"/>
            </Float32>
        </maps>
    </Grid>
 
A schema for this might look like:

Revision as of 21:38, 23 January 2009

Goal

Provide an improved XML representation of DAP Array objects.

Background

In the DAP2 DDX, arrays are represented as their own type, with an embedded (and nameless) template variable. So this:

       <Array name="foo">
           <Int16/>
           <dimension name="i" size="2"/>
           <dimension name="j" size="3"/>
       </Array>

Represents 2x3 array of 16 bit integers, expressed like this a DDS:

   Int16 foo[2][3];


A "better", more intuitive, and more compact representation is proposed here.

Design

We think a better array representation for our DDX would be:

           <Int16 name="foo">
               <dimension name="i" size="2"/>
               <dimension name="j" size="3"/>
           </Int16>

So basically any type that contains a dap:dimension element is an array. This is fairly straight forward for simple types and Structures. Arrays of Grids and Sequences are already disallowed. However, since the Grid data type contains 2 or more arrays types that are used as the grid's data array and Map vectors, the representation of Grid needs to be modified to accommodate this change.

Here is an example of a DAP2 DDX:

   <Grid name="order">
       <Array name="order">
           <Int16/>
           <dimension name="i" size="2"/>
           <dimension name="j" size="3"/>
       </Array>
       <Map name="i">
           <Int32/>
           <dimension name="i" size="2"/>
       </Map>
       <Map name="j">
           <Float32/>
           <dimension name="j" size="3"/>
       </Map>
   </Grid>

Option 1

Add an optional "role" attribute to the simple types we could produce a Grid like this:

   <Grid name="order">
       <Int16 name="order" role="gridArray" >
           <dimension name="i" size="2"/>
           <dimension name="j" size="3"/>
       </Int16 >
       <Int32 name="i" role="gridMap">
           <dimension name="i" size="2"/>
       </Int32 >
       <Float32 name="j" role="gridMap">
           <dimension name="j" size="3"/>
       </Float32 >
   </Grid>

Developing an XML schema for this might be quite challenging.

Option 2

Rely on document order to provide the differentiation between the grid Array and the Map arrays. (not probably a good idea when you consider that we want to allow multiple grid arrays in a grid.)

Option 3

Encapsulate the Maps and grid Arrays:

   <Grid name="order">
       <grids>
           <Int16 name="order">
               <dimension name="i" size="2"/>
               <dimension name="j" size="3"/>
           </Int16>
       </grids >
       <maps>
           <Int32 name="i">
               <dimension name="i" size="2"/>
           </Int32>

           <Float32 name="j" >
               <dimension name="j" size="3"/>
           </Float32>
       </maps>
   </Grid>

A schema for this might look like: