You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

WaterML2 import

This is an import that makes use of the custom import mechanism described in Custom time series import. The WaterML2 import consists of a xml parser, WaterMLTimeSeriesParser.java, a server parser, WaterMlServerParser.java and a bin directory containing all dependant library files (WaterML.zip).

The WaterML standard has been adopted as an OGC standard. The specifications of the WaterML standard can be found at OGC-WaterML2. This import make use of a Request - Response mechanism. First the WaterMlServerParser makes an XML request file and sends this to the WaterMl2 server. Depending on the request a XML Response file is returned containing the timeseries information. The WaterMlServerParser then hands the returned content over to the WaterMlTimeSeriesParser which extracts the timeseries data from the response.

It is possible to setup the WaterMl2 import to read from a WaterMl2 webserver using the WaterMlServerParser or it is possible to read directly form an import directory using the WaterMLTimeSeriesParser.

TimeSeries XML Request format

Here is an example of an XML request file:

<?xml version="1.0" ?>
<sos:GetObservation version="2.0.0" service="SOS"
    maxFeatures="3"
    xmlns:sos="http://schemas.opengis.net/sos/2.0.0/"
    xmlns:wfs="http://www.opengis.net/wfs"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:om="http://www.opengis.net/om/2.0"
    xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0.0/sos.xsd">
    <sos:featureOfInterest>01446500</sos:featureOfInterest>
    <sos:observedProperty>Discharge</sos:observedProperty>
    <!-- OPTIONAL -->    <om:procedure>Continuous/Instantaneous</om:procedure>
    <!-- OPTIONAL -->
    <om:offering>UNIT</om:offering>
    <sos:temporalFilter>
        <fes:ValueReference>phenomenonTime</fes:ValueReference>
        <gml:TimeInstant gml:id='beginPosition'>
            <gml:timePosition>2012-06-29</gml:timePosition>
        </gml:TimeInstant>
        <gml:TimeInstant gml:id='endPosition'>
            <gml:timePosition>2012-07-06</gml:timePosition>
        </gml:TimeInstant>
    </sos:temporalFilter>
</sos:GetObservation>                                                          

TimeSeries XML Response format

Here is an example of an XML response file:

<wml2:Collection xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:om="http://www.opengis.net/om/2.0"
    xmlns:sa="http://www.opengis.net/sampling/2.0" xmlns:swe="http://www.opengis.net/swe/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wml2="http://www.opengis.net/waterml/2.0"
    xmlns:x-wml2="http://www.opengis.net/waterml/2.0" xmlns:gmd="http://www.isotc211.org/2005/gmd"
    xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:sf="http://www.opengis.net/sampling/2.0"
    xmlns:sams="http://www.opengis.net/samplingSpatial/2.0"
    xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gss="http://www.isotc211.org/2005/gss"
    xmlns:gsr="http://www.isotc211.org/2005/gsr"
    xsi:schemaLocation="http://www.opengis.net/waterml/2.0 http://nwisvaws02.er.usgs.gov/ogc-swie/schemas/waterml2.xsd"
    gml:id="TO_BE_DETERMINED">
    <gml:identifier codeSpace="http://nwis.waterdata.usgs.gov/NJ/nwis"
        >USGS.01446500</gml:identifier>
    <gml:name codeSpace="http://nwis.waterdata.usgs.gov/NJ/nwis">Delaware River at Belvidere
        NJ</gml:name>
    <wml2:metadata>
        <wml2:DocumentMetadata gml:id="doc.USGS.MP.USGS.01446500">
            <gml:metaDataProperty xlink:href="contact">
                <gml:GenericMetaData>http://cida.usgs.gov</gml:GenericMetaData>
            </gml:metaDataProperty>
            <wml2:generationDate>2012-07-06T05:58:44</wml2:generationDate>
            <wml2:version xlink:href="http://www.opengis.net/waterml/2.0" xlink:title="WaterML 2.0"
            />
        </wml2:DocumentMetadata>
    </wml2:metadata>
    <wml2:observationMember>
        <om:OM_Observation gml:id="obs.USGS.01446500">
            <om:metadata>
                <wml2:ObservationMetadata>
                    <gmd:contact>
                        <gmd:CI_ResponsibleParty>
                            <gmd:organisationName>
                                <gco:CharacterString>New Jersey Water Science
                                    Center</gco:CharacterString>
                            </gmd:organisationName>
                            <gmd:role>
                                <gmd:CI_RoleCode
                                    codeList="http://www.isotc211.org/2005/resources/CodeList/gmxCodelists.xml#CI_RoleCode"
                                    codeListValue="owner"/>
                            </gmd:role>
                        </gmd:CI_ResponsibleParty>
                    </gmd:contact>
                    <gmd:dateStamp>
                        <gco:DateTime>2012-07-06T05:58:44</gco:DateTime>
                    </gmd:dateStamp>
                    <gmd:identificationInfo/>
                </wml2:ObservationMetadata>
            </om:metadata>
            <om:phenomenonTime>
                <gml:TimePeriod gml:id="pt.USGS.01446500">
                    <gml:beginPosition>2012-06-29</gml:beginPosition>
                    <gml:endPosition>2012-07-06</gml:endPosition>
                </gml:TimePeriod>
            </om:phenomenonTime>
            <om:resultTime>
                <gml:TimeInstant gml:id="forecast.2012-07-06">
                    <gml:timePosition>2012-07-06T05:58:44</gml:timePosition>
                </gml:TimeInstant>
            </om:resultTime>
            <om:validTime>
                <gml:TimePeriod gml:id="vt.USGS.01446500">
                    <gml:beginPosition>2012-06-29</gml:beginPosition>
                    <gml:endPosition>2012-07-06</gml:endPosition>
                </gml:TimePeriod>
            </om:validTime>
            <om:procedure xlink:href="http://www.nemi.gov/Continuous/Instantaneous"
                xlink:title="Continuous/Instantaneous"/>
            <om:observedProperty xlink:href="urn:ogc:def:phenomenon:OGC:Discharge"
                xlink:title="Discharge"/>
            <om:featureOfInterest>
                <wml2:MonitoringPoint gml:id="USGS.MP.01446500">
                    <sf:sampledFeature
                        xlink:href="http://nwisvaws02.er.usgs.gov/ogc-swie/wfs?request=GetFeature&amp;featureId=01446500"/>
                    <sf:parameter>
                        <om:NamedValue>
                            <om:name xlink:title="Watershed"/>
                            <om:value>Middle Delaware-Musconetcong</om:value>
                        </om:NamedValue>
                    </sf:parameter>
                    <sams:shape>
                        <gml:Point gml:id="USGS.P.01446500">
                            <gml:pos srsName="urn:ogc:def:crs:EPSG:4269">40.82638889
                                -75.08250000</gml:pos>
                        </gml:Point>
                    </sams:shape>
                    <wml2:descriptionReference
                        xlink:href="http://external.opengis.org/twiki_public/bin/view/HydrologyDWG/SurfacewaterInteroperabilityExperiment#Use_Case_2"
                        xlink:title="This wiki page describes the IE"/>
                    <wml2:timeZone>
                        <wml2:TimeZone>
                            <wml2:zoneOffset>+00:00</wml2:zoneOffset>
                            <wml2:zoneAbbreviation>EDT</wml2:zoneAbbreviation>
                        </wml2:TimeZone>
                    </wml2:timeZone>
                </wml2:MonitoringPoint>
            </om:featureOfInterest>
            <om:result>
                <wml2:MeasurementTimeseries gml:id="ts_01446500_00060_00000">
                    <wml2:metadata>
                        <wml2:TimeseriesMetadata>
                            <wml2:temporalExtent>
                                <gml:TimePeriod gml:id="USGS.TP.00060_00000">
                                    <gml:beginPosition>2012-06-29</gml:beginPosition>
                                    <gml:endPosition>2012-07-06</gml:endPosition>
                                </gml:TimePeriod>
                            </wml2:temporalExtent>
                        </wml2:TimeseriesMetadata>
                    </wml2:metadata>
                    <wml2:defaultPointMetadata>
                        <wml2:DefaultTVPMeasurementMetadata>
                            <wml2:qualifier xlink:href="http://waterdata.usgs.gov/NJ/nwis/help"
                                xlink:title="Provisional data subject to revision."/>
                            <wml2:uom code="cfs"/>
                            <wml2:interpolationType
                                xlink:href="http://www.opengis.net/def/interpolationType/WaterML/2.0/Continuous"
                                xlink:title="Continuous/Instantaneous"/>
                        </wml2:DefaultTVPMeasurementMetadata>
                    </wml2:defaultPointMetadata>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-06-29T00:00:00-04:00</wml2:time>
                            <wml2:value>2860</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-06-29T00:15:00-04:00</wml2:time>
                            <wml2:value>2860</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-06-29T00:30:00-04:00</wml2:time>
                            <wml2:value>2860</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-06-29T00:45:00-04:00</wml2:time>
                            <wml2:value>2860</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-06-29T01:00:00-04:00</wml2:time>
                            <wml2:value>2860</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                    
<!-- A lot of points inbetween -->
                    
                    <wml2:point>
                        <wml2:MeasurementTVP>
                            <wml2:time>2012-07-06T05:30:00-04:00</wml2:time>
                            <wml2:value>2690</wml2:value>
                        </wml2:MeasurementTVP>
                    </wml2:point>
                </wml2:MeasurementTimeseries>
            </om:result>
        </om:OM_Observation>
    </wml2:observationMember>
</wml2:Collection>

Fews configuration

In order to activate the WaterML import as a FEWS import, it is required to setup a TimeSeriesImportRun module configuration file and an accompanying IdMap file. Also the bin directory containing all WaterML resources must be placed in a location that can be accessed by the FEWS system.

Here is an example import module configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
    <!-- This is an example import configuration file for importing WaterML data from a WaterMl server    -->
    <import>
        <general>
           <!-- Class name of WaterML server parser -->
            <parserClassName>nl.deltares.webapps.waterml.client.WaterML2Parser</parserClassName>

            <!-- Path to directory containing libraries -->
            <binDir>%REGION_HOME%/Modules/waterml2-bin</binDir>

            <!-- Directory from which CSV files are to be imported -->
            <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/dv/sos</serverUrl>
            <idMapId>IdImportWaterML</idMapId>
            <importTimeZone>
                <timeZoneOffset>+00:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <timeSeriesSet>
            <moduleInstanceId>ImportWaterML</moduleInstanceId>
            <valueType>scalar</valueType>
            <parameterId>MyPar</parameterId>
            <locationSetId>MyLocSet</locationSetId>
            <timeSeriesType>external historical</timeSeriesType>
            <timeStep unit="nonequidistant"/>
            <readWriteMode>add originals</readWriteMode>
            <synchLevel>1</synchLevel>
        </timeSeriesSet>
    </import>
</timeSeriesImportRun>

Here is an example id-map file:

<?xml version="1.0" encoding="UTF-8"?>
<idMap xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/idMap.xsd" version="1.1">
    <!-- Id mapping for import from WaterML 2 service
        Required fields:
         externalLocation: maps to featureId. Enter value that is inserted in URL request
         externalParameter: maps to observedProperty. Enter value that is inserted in URL request

       Optional fields:
         externalQualifier: maps to procedure. Enter value that is inserted in URL request.
         If not required but 'offering' is required then fill in 'unknown'.
         externalQualifier1: maps to offering.  Enter value that is inserted in URL request.
         If not required can be omitted or fill in 'unknown'.
     -->
    <map internalLocation="LOC-001" internalParameter="PAR-001" externalLocation="featureId"
         externalParameter="observedProperty" externalQualifier="procedure" externalQualifier1="offering" />
</idMap>

Id-Mapping goes as follows:

Internal timeseries location and parameter combinations are mapped to external location, parameter and qualifier sets as follows:

  • externalLocation values are written as Feature Id
  • externalParameter values are written as ObservedProperty
  • 1st externalQualifier values are written as procedure (if not required fill in 'unknown')
  • 2nd externalQualifier values are written as offering (if not required fill in 'unknown' or omit)
  • No labels