Overview
The IOCSeaLevelMonitoring import function (<importType>IOCSeaLevelMonitoring</importType>) imports sealevels from the Sea level station REST service. See: http://www.ioc-sealevelmonitoring.org/service.php?query=help
- All stations (location, latitude and longitude) are retrieved by the import function using the following REST call: http://www.ioc-sealevelmonitoring.org/service.php?query=stationlist
- For each code in the station list the sea level data (parameter name: slevel) is retrieved using the following REST call: http://www.ioc-sealevelmonitoring.org/service.php?query=data&code=STATIONCODE
- By default the following URL should be configured: http://www.ioc-sealevelmonitoring.org/service.php
- To tune the import, the data query can be tuned by adding one of the following parameters.
- "timestart=" + ISOdate (YYYY-MM-DDTHH:MM), default = now()-12 hours
- "timestop=" + ISOdate (YYYY-MM-DDTHH:MM), default = now"includesensors[]=" + sensor; i.e. &includesensors[]=rad&includesensors[]=prs, default is all
- "nofilter=true" will show all values, otherwise only values > -999 and values < 999 are used; note: -999 is used for missing values
- For example, to show all values, de following URL should be configured: http://www.ioc-sealevelmonitoring.org/service.php?nofilter=true.
- For example, to get all historical data from 2014-11-10 until now, add the following to the URL definition http://www.ioc-sealevelmonitoring.org/service.php?timestart=2014-11-10%2000:00
Configuring the Import
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:
<?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="ImportIOCSeaLevelMonitoring"> <moduleId>TimeSeriesImportRun</moduleId> </moduleInstanceDescriptor> ... </moduleInstanceDescriptors>
An example of the IOCSeaLevelMonitoring import configuration will be given here. The importType is named IOCSeaLevelMonitoring which should be configured in the general section of the import. De URL to the ioc rest service should be configured here as well. The actual data to be retrieved can be tuned by adding parameters to the URL.
To only import data of specific sensors for a location, properties can be used. See the following configuration example.
A relative view period can be specified in the general section of the import to configure the period for which data should be retrieved. By defaul only the last 12 hours until now will be imported. in the configuration example a RVP is specified for the last 5 days and the timeout is set to 20 seconds.
N.B.: specifying a large period might result in a time-out with the service if a large amount of data is retrieved. To increase the timeout period, the connectionTimeOutMillis can be configured in the general section of the import.
Time is assumed to be specified in GMT and data is assumed to be UTF-8 encoded.
<?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>IOCSeaLevelMonitoring</importType> <serverUrl>http://www.ioc-sealevelmonitoring.org/service.php</serverUrl> <connectionTimeOutMillis>20000</connectionTimeOutMillis> <relativeViewPeriod unit="day" start="-5" end="0" ></relativeViewPeriod> <idMapId>IdImportIoc</idMapId> </general> <properties> <!-- Properties are used to filter out specific sensors for a location. A list of key value pairs can be specified to import only data from a specific sensor for a location. In the following property only sensors of "bat" are impored for the acaj location. --> <string key="acaj" value="bat"/> </properties> <timeSeriesSet> <moduleInstanceId>ImportIOCSeaLevelMonitoring</moduleInstanceId> <valueType>scalar</valueType> <parameterId>H.observed</parameterId> <locationSetId>IOC</locationSetId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="nonequidistant" /> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> </import> </timeSeriesImportRun>
The IdMapping configuration idImportIoc.xml is very important because this maps the internal FEWS Id's to the IOCSeaLevelMonitoring Id's. An example IdMapping file for the IOCSeaLevelMonitoring importer is shown below. In this case the external slevel parameter is mapped on the internal H.observed parameter. In this case the external locations are assumed to be the same as the internal locations.
<?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="slevel"/> .... </idMap>
Example JSON file for station data
[ { Code: "abas", Location: "Abashiri", country: "JAP", type: "SL", DCP_ID: "ABASHIRI", WMO: "SWJP40", XMtInt: 10, Lat: 44.02, Lon: 144.29, Har: 0, ... countryname: "Japan" }, ... ]
Example JSON file for measured sea level data at a station
[ { slevel: 1.8837, stime: "2014-11-18 21:20:00 ", sensor: "enc" }, ... ]