UsgsWSIVJson Server Parser
This is a parser that can take JSON data supplied by a USGS Water Services Instantaneous Values webserver and load it into FEWS via a TimeSeriesImportRun. It was created to replace the WaterML2Import where the USGS supplies data in JSON format in place of a WaterML2 format .
FEWS configuration
In order to activate the USGS Water Services Instantaneous Values import as a FEWS import, it is required to setup a TimeSeriesImportRun module configuration file and an accompanying IdMap file.
Here is a example import module configuration file that imports data from a USGS Water Services Instantaneous Values webserver:
<?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 Water Services IV JSON data from a Water Services IV server --> <import> <general> <importTypeStandard>UsgsWSIVJson_server</importTypeStandard> <serverUrl>http://nwisvaws02.er.usgs.gov/ogc-swie/wsiv/uv/sos</serverUrl> <relativeViewPeriod unit="hour" end="0" start="-3"/> <idMapId>IdImportWaterServicesJson_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=json&from=@starttime@&to=@endtime@&loc_id=@locationid@@&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>ImportWaterServicesJson_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"/>