Versions Compared

Key

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

...

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>
            <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/wml2/uv/sos</serverUrl>
			<relativeViewPeriod unit="hour" end="0" start="-3"/>                
			<idMapId>IdImportWaterML2_usgs</idMapId>
            <importTimeZone>
                <timeZoneOffset>-06:00</timeZoneOffset>
            </importTimeZone>
        </general>
        <properties>
            <!-- Optional: Use this option to write request and response messages to file. -->
            <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>

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 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>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>

...

Code Block
<general>
	<importTypeStandard>wml2_server</importTypeStandard>
    <serverUrl>https://hicws2.vlaanderen.bedummy_hostname/KiWIS/KiWIS</serverUrl>
    <user>username<<user>dummy_username</user>
    <password>userpassword<<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.

...

Code Block
<general>
	<importTypeStandard>wml2_server</importTypeStandard>
    <serverUrl>https://hicws2.vlaanderen.bedummy_hostname/KiWIS/KiWIS</serverUrl>
    <!-- <user>username<<user>dummy_username</user> -->				<!-- normally not required for OAuth2 -->
    <!-- <password>userpassword<<password>dummy_password</password> -->	<!-- normally not required for OAuth2 -->
    <oauth2Config>
		<!-- Required: URL from which to receive the access token -->
    	<authUrl>https://hicwsauth.vlaanderen.bedummy_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>

...

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

...

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 ':')