Overview
The Brazil Ana import function (<importType>BrazilAna</importType>) imports telemetry data from a custom XML format.
From the BrazilAna data format the following is imported:
- Observation time in the format yyyy-MM-dd HH:mm:ss (DataHora)
- Station code (CodEstacao)
- Discharge (Vazao)
- Level (Nivel)
- Rainfall (Chuva)
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="ImportBrazilAna"> <moduleId>TimeSeriesImportRun</moduleId> </moduleInstanceDescriptor> ... </moduleInstanceDescriptors>
An example of the BrazilAna import configuration is given here. The importType is named BrazilAna which should be configured in the general section of the import.
<?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>BrazilAna</importType> <folder>$IMPORT_FOLDER$/brazilana</folder> <idMapId>ImportBrazilAnaMapId</idMapId> </general> <timeSeriesSet> <moduleInstanceId>ImportBrazilAna</moduleInstanceId> <valueType>scalar</valueType> <parameterId>H.observed</parameterId> <locationId>Brasilia</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="hour" multiplier="1"/> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> <timeSeriesSet> <moduleInstanceId>ImportBrazilAna</moduleInstanceId> <valueType>scalar</valueType> <parameterId>Q.observed</parameterId> <locationId>Brasilia</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="hour" multiplier="1"/> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> <timeSeriesSet> <moduleInstanceId>ImportBrazilAna</moduleInstanceId> <valueType>scalar</valueType> <parameterId>H.simulated</parameterId> <locationId>Brasilia</locationId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="hour" multiplier="1"/> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> </import> </timeSeriesImportRun>
The IdMapping configuration ImportBrazilAnaMapId is important because this maps the internal FEWS Id's to the BrazilAna Id's. An example IdMapping file for the BrazilAna importer is shown below.:
<?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="Nivel"/> <parameter internal="Q.observed" external="Vazao"/> <parameter internal="H.simulated" external="Chuva"/> <location external="40450001" internal="Brasilia" /> .... </idMap>
Example BrazilAna import file
<?xml version="1.0" encoding="utf-8"?> <DataTable xmlns="http://MRCS/"> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="DadosHidrometereologicos" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="DadosHidrometereologicos"> <xs:complexType> <xs:sequence> <xs:element name="CodEstacao" type="xs:string" minOccurs="0" /> <xs:element name="DataHora" type="xs:string" minOccurs="0" /> <xs:element name="Vazao" type="xs:string" minOccurs="0" /> <xs:element name="Nivel" type="xs:string" minOccurs="0" /> <xs:element name="Chuva" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <DocumentElement xmlns=""> <DadosHidrometereologicos diffgr:id="DadosHidrometereologicos1" msdata:rowOrder="0"> <CodEstacao>40450001</CodEstacao> <DataHora>2015-03-02 17:00:00 </DataHora> <Vazao>64.10</Vazao> <Nivel>113.00</Nivel> <Chuva /> </DadosHidrometereologicos>