Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

WaterML2 Server import

As of Stable 2017.02 the WaterMlServerParser and WaterMlTimeSeriesParser have been moved to the module lib-parsers-serializer. This implies that they can be configured using the importTypeStandard option and that there is no longer a need to provide the parser classes is a separate binary directory.

Version 2017.02 and later

Here is a 2017.02 and later Here is an example import module configuration file that imports data from a WaterMl2 webserver:

Code Block
<?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>
			<importTypeStandard>wml2_server</importTypeStandard>
              <!-- Class name of WaterML server parser -->     <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/wml2/uv/sos</serverUrl>
			<relativeViewPeriod unit="hour" end="0" start="-3"/>             
			<idMapId>IdImportWaterML2_usgs</idMapId>
            <parserClassName>nl.wldelft.waterml.timeseriesparsers.WaterMlServerParser</parserClassName>
<importTimeZone>
            <!-- Path to directory containing libraries --><timeZoneOffset>-06:00</timeZoneOffset>
            <binDir>%REGION_HOME%/Modules/waterml-bin</binDir>

</importTimeZone>
        </general>
     <!-- Directory from which<properties>
 CSV files are to be imported -->
            <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/wml2/uv/sos</serverUrl>
            <idMapId>IdImportWaterML2_usgs</idMapId> <!-- Optional: Use this option to write request and response messages to file. -->
            <importTimeZone>
  <string key="RequestsOutputDirectory" value="c:/temp/"/>
              <timeZoneOffset>-06:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <properties><!-- Optional: Use this option to define what the request string must look like. This depends on how the WaterML2 webservice is setup. By using tags in the 
            <!-- Optional: Use this option to write request and response messages to file. -->  request template it is possible to insert the import parameters at run-time.
            <string key="RequestsOutputDirectory" value="c:/temp/"/>
   The following tags can be set:
				 @starttime@ = start <!-- Optional: Use this option to define what the request string must look like. This depends on how the WaterML2 webservice is setup. By using tags in the 
                 request template it is possible to insert the import parameters at run-time.time request period
				 @endtime@ = end time of request period
				 @locationid@ = location identifier
				 @parameterid@ = parameter identifier
				 @qualifier0@ = qualifier value 0 (can be used freely for additional purposes if required)
				 @qualifier1@ = qualifier value 1
				 @qualifier2@ = qualifier value 2
				 @qualifier3@ = qualifier value 3
            -->
            <string key="requestTemplate" value="format=wml2&amp;from=@starttime@&amp;to=@endtime@&amp;loc_id=@locationid@@&amp;par_id=@parameterid@"/>
   The following tags can be set:
				 @starttime@ = start time request period
				 @endtime@ = end time of request period
				 @locationid@ = location identifier
				 @parameterid@ = parameter identifier
				 @qualifier0@ = qualifier value 0 (can be used freely for additional purposes if required)
				 @qualifier1@ = qualifier value 1
				 @qualifier2@ = qualifier value 2
				 @qualifier3@ = qualifier value 3
           <!-- Optional: Maximum time in millis before a read action times-out. Read time is defined by the time betweend sending a request and start reading the response -->
            <int key="ReadTimeoutMillis" value="10000"/>
            <!-- Optional: Maximum time in millis for making the connection to the WaterML2 service. -->
            <string<int key="requestTemplateConnectionTimeoutMillis" value="format=wml2&amp;from=@starttime@&amp;to=@endtime@&amp;loc_id=@locationid@@&amp;par_id=@parameterid@"/>
  "1000"/>
                <!-- Optional: MaximumOption timeto inimport millismultiple beforelocations ain read action times-out. Read time is defined by the time betweend sending a request and start reading the responsesingle request. -->
            <string<bool key="ReadTimeoutMillisRequestMultipleLocations" value="10000true"/>
            <!-- Optional: Maximum time in millis for making the connection to the WaterML2 service. -->
            <string key="ConnectionTimeoutMillis" value="1000"/>
        < </properties>
        <timeSeriesSet>
            <moduleInstanceId>ImportWaterML2_usgs</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>

WaterML2 file import



Note that when using qualifiers in the timeSeriesSet, in the idMapping both an internal and external qualifier need to be defined (with the same value):

<map externalParameter="206194010" internalParameter="DP.obs" internalQualifier="normal" externalQualifier="normal"/>

Versions before 2017.02

Here is a pre-2017.02 Here is an example import module configuration file that imports data from a directoryWaterMl2 webserver:

Code Block
<?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.wldelft.waterml.timeseriesparsers.WaterMlTimeSeriesParser<WaterMlServerParser</parserClassName>

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

            <!-- Directory from which CSV files are to be imported -->
	    <folder>$IMPORT_FOLDER_WATERML$</folder>
            <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/wml2/uv/sos</serverUrl>
            <idMapId>IdImportWaterML2_usgs</idMapId>
            <importTimeZone>
                <timeZoneOffset>-06:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <timeSeriesSet><properties>
            <moduleInstanceId>ImportWaterML2_usgs</moduleInstanceId>
            <valueType>scalar</valueType>
<!-- Optional: Use this option to write request and response messages to file. -->
             <parameterId>MyPar</parameterId>
            <locationSetId>MyLocSet</locationSetId>
            <timeSeriesType>external historical</timeSeriesType>
            <timeStep unit="nonequidistant"/>
            <readWriteMode>add originals</readWriteMode>
            <synchLevel>1</synchLevel>
        </timeSeriesSet>
    </import>
</timeSeriesImportRun>
<string key="RequestsOutputDirectory" value="c:/temp/"/>
            <!-- Optional: Use this option to define what the request string must look like. This depends on how the WaterML2 webservice is setup. By using tags in the 
                 request template it is possible to insert the import parameters at run-time.
                 The following tags can be set:
				 @starttime@ = start time request period
				 @endtime@ = end time of request period
				 @locationid@ = location identifier
				 @parameterid@ = parameter identifier
				 @qualifier0@ = qualifier value 0 (can be used freely for additional purposes if required)
				 @qualifier1@ = qualifier value 1
				 @qualifier2@ = qualifier value 2
				 @qualifier3@ = qualifier value 3
            -->
            <string key="requestTemplate" value="format=wml2&amp;from=@starttime@&amp;to=@endtime@&amp;loc_id=@locationid@@&amp;par_id=@parameterid@"/>
            <!-- Optional: Maximum time in millis before a read action times-out. Read time is defined by the time betweend sending a request and start reading the response -->
            <int key="ReadTimeoutMillis" value="10000"/>
            <!-- Optional: Maximum time in millis for making the connection to the WaterML2 service. -->
            <int key="ConnectionTimeoutMillis" value="1000"/>
            <!-- Optional: Option to import multiple locations in single request. -->
            <bool key="RequestMultipleLocations" value="true"/>

        </properties>
        <timeSeriesSet>
            <moduleInstanceId>ImportWaterML2_usgs</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>

WaterML2 file import

Version 2017.02 and later

Here is a 2017.02 and later example import module configuration file that imports data from a directory

Code Block
<?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>
            <importTypeStandard>wml2</importTypeStandard>

            <!-- Directory from which CSV files are to be imported -->
  	        <folder>$IMPORT_FOLDER_WATERML$</folder>
            <idMapId>IdImportWaterML2_usgs</idMapId>
            <importTimeZone>
                <timeZoneOffset>-06:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <timeSeriesSet>
            <moduleInstanceId>ImportWaterML2_usgs</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>

Versions before 2017.02

Here is a pre-2017.02 example import module configuration file that imports data from a directory:

Code Block
<?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.wldelft.waterml.timeseriesparsers.WaterMlTimeSeriesParser</parserClassName>

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

            <!-- Directory from which CSV files are to be imported -->
	    <folder>$IMPORT_FOLDER_WATERML$</folder>
            <idMapId>IdImportWaterML2_usgs</idMapId>
            <importTimeZone>
                <timeZoneOffset>-06:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <timeSeriesSet>
            <moduleInstanceId>ImportWaterML2_usgs</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>

WaterML2 Authentication

Currently the server import support two types of authentication: Basic Authentication and OAuth2.

Basic Authentication

Here is an configuration example showing how to configure Basic Authentication. Only a user name and password need to be configured.

Code Block
<general>
	<importTypeStandard>wml2_server</importTypeStandard>
    <serverUrl>https://dummy_hostname/KiWIS/KiWIS</serverUrl>
    <user>dummy_username</user>
    <password>dummy_password</password>
	...
 </general>


As of release 2017.02 it is also possible to configure OAuth2 authentication. This functionality has been backported to Stable 2016.02 and 2017.01, however the way to configure this in the older releases differs.

OAuth2 Authentication version 2017.02 and later

Code Block
<general>
	<importTypeStandard>wml2_server</importTypeStandard>
    <serverUrl>https://dummy_hostname/KiWIS/KiWIS</serverUrl>
    <!-- <user>dummy_username</user> -->				<!-- normally not required for OAuth2 -->
    <!-- <password>dummy_password</password> -->	<!-- normally not required for OAuth2 -->
    <oauth2Config>
		<!-- Required: URL from which to receive the access token -->
    	<authUrl>https://dummy_hostname/auth</authUrl>
 		<!-- Optional: For proper OAuth2 authentication a client_id and client_secret are required. However in some cases the authentication URL does not require this. 
			 Instead Basic Authentication is required to access the authUrl. Here the user and password fields shown above are required -->
		<clientId>openid client id</clientId>
		<clientSecret>openid client secret</clientSecret>
		<!-- Optional Array: Scope of request -->
        <scope>openid</scope>
        <scope>email</scope>
		<!-- Optional Array: Audience for whom request is intended. Used to validate response. If omitted the clientId and username become are used -->
        <audience>audienceId</audience>
        <audience>audienceId2</audience>
       <!-- Optional: Issuer of the access token. Used to validate response. If omitted the root url of authUrl is used. -->
        <issuer>http://localhost:8080/KiWebPortal/auth</issuer>
       <!-- Optional: A refresh token can be used if provider supports this. -->
        <refreshToken>refresh access token</refreshToken>
	</oauth2Config>
	...
 </general>

OAuth2 Authentication versions before 2017.02

Code Block
<general>
	<importTypeStandard>wml2_server</importTypeStandard>
    <serverUrl>https://dummy_hostname/KiWIS/KiWIS</serverUrl>
    <!-- <user>dummy_username</user> -->				<!-- normally not required for OAuth2 -->
    <!-- <password>dummy_password</password> -->	<!-- normally not required for OAuth2 -->    
	...
 </general>
<properties>
   <string key="authUrl" value="https://dummy_hostname/auth" />
   <string key="issuer" value="http://dummy_hostname_2:8080/KiWebPortal/auth" />
   <string key="clientId" value="id...." />
   <string key="clientSecret" value="*****" />
</properties>

WaterML2 IdMap configuration

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!--NFFS EA TimeSeriesDataExchangeFormat flag conversion file for Import-->
<flagConversions 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/flagConversions.xsd">
    <flagConversion>
        <inputFlag>
            <name>External01</name>
            <value>E01</value>
        </inputFlag>
        <outputFlag>
            <name>ORIGINAL_RELIABLE</name>
            <value>0</value>
            <description>Observed value retrieved from external data source. Value is valid, marked as original reliable as validation is yet to be done</description>
        </outputFlag>
    </flagConversion>
    <flagConversion>
        <inputFlag>
            <name>External02</name>
            <value>E02</value>
        </inputFlag>
        <outputFlag>
            <name>COMPLETED_RELIABLE</name>
            <value>2</value>
            <description>Original value was missing. Value has been filled in through byteerpolation, transformation (e.g. stage discharge) or a model</description>
        </outputFlag>
    </flagConversion>
    <defaultOuputFlag>
        <name>ORIGINAL_RELIABLE</name>
        <value>0</value>
        <description>The data value is the original value retrieved from an external source and it successfully passes all validation criteria set.</description>
    </defaultOuputFlag>
    <missingValueFlag>
        <name>ORIGINAL_MISSING</name>
        <value>9</value>
    </missingValueFlag>
</flagConversions>

 


Parsing of response HRef items

...

result: GageHeight (element after last ':')