...
The REST Service URLs look as follows http://servername:portnumber/rest/read/data/parameter/startdate/enddate/location
To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:
Code Block |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors 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/moduleInstanceDescriptors.xsd" version="1.0">
...
<moduleInstanceDescriptor id="ImportDataWare">
<moduleId>TimeSeriesImportRun</moduleId>
</moduleInstanceDescriptor>
...
</moduleInstanceDescriptors>
|
An example of the DataWare import configuration will be given here. The importType is named DataWare which should be configured in the general section of the import. De URL to the rest service should be configured here as well. The actual data to be retrieved can be tuned by adding setting the relativeViewPeriod and the timeSeries to specify the locations and parameters. N.B.: the used parameters and locations have to be mapped with an idMap (IdImportDataWare in this example). Since the DataWare parser specifies some custom quality flags, a flag conversion map can be specified in the flagConversionId to map flags to FEWS flags.
TimeZone is assumed to be configured in the general section, otherwise GMT is assumed.
If no relativeViewPeriod is configured, all data is requested for a parameter and location.
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">
<import>
<general>
<importType>DataWare</importType>
<serverUrl>http://hostnameserver:port/rest/read/data/</serverUrl>
<connectionTimeOutMillis>20000</connectionTimeOutMillis>
<relativeViewPeriod unit="hourday" start="-61" end="30" startOverrulable="true" endOverrulable="true"/>
<idMapId>IdImportDataWare</idMapId>
<flagConversionsId>ImportFlagConversions</flagConversionsId>
<importTimeZone>
<timeZoneName>GMT-5</timeZoneName>
</importTimeZone>
</general>
<timeSeriesSet>
<moduleInstanceId>ImportDataWare</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.obs</parameterId>
<locationId>Amsterdam</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="nonequidistant" />
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
<timeSeriesSet>
<moduleInstanceId>ImportDataWare</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.obs</parameterId>
<locationId>Delft</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="nonequidistant" />
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
<timeSeriesSet>
<moduleInstanceId>ImportDataWare</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>19839<<parameterId>Q.obs</parameterId>
<locationId>Amsterdam</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="nonequidistant" />
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
<timeSeriesSet>
<moduleInstanceId>ImportDataWare</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>Q.obs</parameterId>
<locationId>1ha<<locationId>Delft</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="nonequidistant" />
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
</import>
</timeSeriesImportRun>
|
The IdMapping configuration idImportDataWare.xml is very important because this maps the internal FEWS Id's to the DataWare Id's. An example IdMapping file for the DataWare importer is shown below. In this case the external 19839 parameter is mapped on the internal H.observed parameter. locations should be mapped as well.previous timeseries will be mapped using theIdImportDataWare id mapping:
Code Block |
---|
|
<parameter external="19839" internal="H.obs" />
<parameter external="19840" internal="Q.obs" />
<location external="1ha" internal="Amsterdam" />
<location external="2ha" internal="Delft" />
|
The previous configuration will result in the following 4 REST urls being used:
Code Block |
---|
|
http://server:port/rest/read/data/19839/2015-01-04/2015-01-05/1ha
http://server:port/rest/read/data/19839/2015-01-04/2015-01-05/1ha
http://server:port/rest/read/data/19840/2015-01-04/2015-01-05/2ha
http://server:port/rest/read/data/19840/2015-01-04/2015-01-05/2ha
|
In case no relative view period was configured, a typical URL will look as follows:
Code Block |
---|
|
http://server:port/rest/read/data/19839/*/*/1ha
<?xml version="1.0" encoding="UTF-8"?>
<idMap version="1.1" 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">
....
<parameter internal="H.observed" external="19839"/>
....
</idMap>
|
Code Block |
---|
|
<ArrayOfData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Data><Key>19839</Key><Time>2014-11-01 00:00:00.000</Time><Value>58.2457</Value><Quality>29</Quality></Data>
... |
DataWareTimeSeriesParser.java