Dap:Attribute Extension Example 3b

From OPeNDAP Documentation
Revision as of 20:49, 21 January 2009 by Ndp (talk | contribs) (Source XML)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1 Example 3b

Here we embed an entire wcs:CoverageDescription and wcs:CoverageSummary at the top level of a DDX.


1.1 Source XML

<?xml version="1.0" encoding="UTF-8"?>
<Dataset name="200803061600_HFRadar_USEGC_6km_rtv_SIO.nc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xml.opendap.org/ns/DAP2"
xsi:schemaLocation="http://xml.opendap.org/ns/DAP2  http://xml.opendap.org/dap/dap2.xsd">



  <Attribute name="wcsStuff" type="xml" >
    <CoverageDescription xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:owcs="http://www.opengis.net/wcs/1.1/ows" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://www.opengis.net/wcs/1.1  http://schemas.opengis.net/wcs/1.1.0/wcsDescribeCoverage.xsd  http://www.opengis.net/ows/1.1  http://schemas.opengis.net/ows/1.1.0/owsAll.xsd  http://www.opengis.net/wcs/1.1/ows http://schemas.opengis.net/wcs/1.1.0/owsDataIdentification.xsd http://www.opengis.net/gml/3.2  http://schemas.opengis.net/gml/3.2.1/gml.xsd">
        <ows:Title>Near-Real Time Surface Ocean Velocity</ows:Title>
        <ows:Abstract>CoverageDescription generated by OPeNDAP WCS UseCase 2.0</ows:Abstract>
        <Identifier>coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc</Identifier>
        <Domain>
            <SpatialDomain>
                <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::4326">
                    <ows:LowerCorner>-97.8839 21.736</ows:LowerCorner>
                    <ows:UpperCorner>-57.2312 46.4944</ows:UpperCorner>
                </ows:BoundingBox>
            </SpatialDomain>
            <TemporalDomain>
                <gml:timePosition>2008-03-27T16:00:00.000Z</gml:timePosition>
            </TemporalDomain>
        </Domain>
        <Range>
        </Range>
        <SupportedCRS>urn:ogc:def:crs:EPSG::4326</SupportedCRS>
        <SupportedFormat>netcdf-cf1.0</SupportedFormat>
        <SupportedFormat>dap2.0</SupportedFormat>
    </CoverageDescription>

    <CoverageSummary xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:owcs="http://www.opengis.net/wcs/1.1/ows" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://www.opengis.net/wcs/1.1  http://schemas.opengis.net/wcs/1.1.0/wcsDescribeCoverage.xsd  http://www.opengis.net/ows/1.1  http://schemas.opengis.net/ows/1.1.0/owsAll.xsd  http://www.opengis.net/wcs/1.1/ows http://schemas.opengis.net/wcs/1.1.0/owsDataIdentification.xsd http://www.opengis.net/gml/3.2  http://schemas.opengis.net/gml/3.2.1/gml.xsd">
       <ows:Title>6km HF Radar data</ows:Title>
       <ows:Abstract>A test dataset for use developing WCS services.</ows:Abstract>
       <ows:Metadata xlink:href="http://ndp.opendap:8080/opendap/coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc.das"/>
       <ows:WGS84BoundingBox>
          <ows:LowerCorner>-97.8839 21.736</ows:LowerCorner>
          <ows:UpperCorner>-57.2312 46.4944</ows:UpperCorner>
       </ows:WGS84BoundingBox>
       <Identifier>coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc</Identifier>
    </CoverageSummary>
  </Attribute>

    <Attribute name="NC_GLOBAL" type="Container">
        <Attribute name="title" type="String">
            <value>Near-Real Time Surface Ocean Velocity</value>
        </Attribute>
        <Attribute name="institution" type="String">
            <value>Scripps Institution of Oceanography</value>
        </Attribute>
        <Attribute name="source" type="String">
            <value>Surface Ocean HF-Radar</value>
        </Attribute>
        <Attribute name="history" type="String">
            <value>12-Mar-2008 22:26:19:  NetCDF file created</value>
        </Attribute>
        <Attribute name="references" type="String">
            <value>Terrill, E. et al., 2006. Data Management and Real-time\\012Distribution in the HF-Radar National Network. Proceedings\\012of the MTS/IEEE Oceans 2006 Conference, Boston MA,\\012September 2006.</value>
        </Attribute>
    </Attribute>

    <Grid name="u">
      <Attribute name="wcsStuff" type="xml" >
        <Field>
            <ows:Title>surface_eastward_sea_water_velocity</ows:Title>
            <ows:Abstract>Eastward component of a 2D sea surface velocity vector.</ows:Abstract>
            <Identifier>u</Identifier>
            <Definition>
                <ows:AnyValue/>
            </Definition>
            <NullValue>-32768</NullValue>
            <owcs:InterpolationMethods>
                <owcs:DefaultMethod>nearest</owcs:DefaultMethod>
            </owcs:InterpolationMethods>
        </Field>
      </Attribute>
        <Attribute name="standard_name" type="String">
            <value>surface_eastward_sea_water_velocity</value>
        </Attribute>
        <Attribute name="units" type="String">
            <value>m s-1</value>
        </Attribute>
        <Attribute name="_FillValue" type="Int16">
            <value>-32768</value>
        </Attribute>
        <Attribute name="scale_factor" type="Float32">
            <value>0.009999999776</value>
        </Attribute>
        <Attribute name="ancillary_variables" type="String">
            <value>DOPx</value>
        </Attribute>
        <Array name="u">
            <Int16/>
            <dimension name="time" size="1"/>
            <dimension name="lat" size="460"/>
            <dimension name="lon" size="701"/>
        </Array>
        <Map name="time">
            <Int32/>
            <dimension name="time" size="1"/>
        </Map>
        <Map name="lat">
            <Float32/>
            <dimension name="lat" size="460"/>
        </Map>
        <Map name="lon">
            <Float32/>
            <dimension name="lon" size="701"/>
        </Map>
    </Grid>

    <dataBLOB href=""/>
</Dataset>

1.2 Namespace Blocking Transform

Returns all elements NOT in the DAP2 namespace. Or in other words, discard elements in the DAP2 namespace:

<xsl:stylesheet version="1.0"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               xmlns:dap="http://xml.opendap.org/ns/DAP2" >
   <xsl:output method='xml' version='1.0' encoding='UTF-8' indent='yes'/>

   <xsl:strip-space elements="*" />

   <xsl:template match="*">
       <xsl:choose>
           <xsl:when test="namespace-uri()!='http://xml.opendap.org/ns/DAP2'">
               <xsl:copy >
                   <xsl:call-template name="textAndattributes" />
                   <xsl:apply-templates />
               </xsl:copy>
           </xsl:when>
           <xsl:otherwise>
               <xsl:apply-templates />
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

   <xsl:template  match="@*|text()" />

   <xsl:template name="textAndattributes" ><xsl:copy-of select="text()|@*" /></xsl:template>

</xsl:stylesheet>

1.3 Result

And we get back just the CoverageDescription and the CoverageSummary:


1.4 Namespace Passing Transform

Returns all elements IN the DAP2 namespace:

<xsl:stylesheet version="1.0"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               xmlns:dap="http://xml.opendap.org/ns/DAP2" >
   <xsl:output method='xml' version='1.0' encoding='UTF-8' indent='yes'/>

   <xsl:strip-space elements="*" />
   
   <xsl:template match="*">
       <xsl:choose>
           <xsl:when test="namespace-uri()='http://xml.opendap.org/ns/DAP2'">
               <xsl:copy >
                   <xsl:call-template name="textAndattributes" />
                   <xsl:apply-templates />
               </xsl:copy>
           </xsl:when>
           <xsl:otherwise>
               <xsl:apply-templates />
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

   <xsl:template  match="@*|text()" />

   <xsl:template name="textAndattributes" ><xsl:copy-of select="text()|@*" /></xsl:template>
 
</xsl:stylesheet>

1.5 Result

The DAP DDX document minus the foreign namespace XML.