Please note: this information provider has very strict security rules, and data can only be access from specific IP addresses that are given special permissions, and need to connect using VPN and google authenticate.  You also need a username and password which FEWS will use to access an authorization token to be able to download data.


This import can download data from two different REST endpoints: PrecipitacaoObservada and Grandezas Hidrologicas. Both the URL params and responses are very similar, but there are some differences, detailed bellow.

URL params for both:

DataInicialMedicao --> start date, filled in by FEWS based on the relative view period

DataFinalMedicao --> end date, filled in by FEWS based on the relative view period

QualidadeDado --> data quality flag, coming from general property "QD" of Delft-FEWS. Obligatory field with three options COO, CON or both (COO,CON) for Grandezas Hidrologicas and for PrecipitacaoObservada it should be CD or CT.

AgregacaoTemporal --> temporal aggregation. Obligatory field with two options possible, DI=daily data HO=hourly.  Fews fills this field in based on the timeseries time step. If the time step is hourly, it will be HO, any other timestep will be DI.

 PrecipitacaoObservada 

FuroTemporal --> information on getting Furo Temporal, coming from general property furoTemporal  of Delft-FEWS. This field can be skipped and has two option S (yes) N (no). If it is not configured it will not be added to the URL.

IDEstacaoMeteo --> station ID, filled in by Fews automatically, using the external location IDs of the configured time series.  Several locations can be added to a single request.

 Grandezas Hidrologicas

IDPostReservatorio--> station ID, filled in by Fews automatically, using the external location IDs of the configured time series.  Several locations can be added to a single request.

Grandeza --> timeseries parameter, filled in by FEWS automatically, using the external parameter ID from the configured time series.   The following parameters are supported: "VMD","AFL","DFL","TUR","VER","VTR","VOE","NIV","NJS","VNA","VNM","VNS","VIA".  In one request only one parameter can be used, but FEWS will loop through all parameters one by one automatically.


URL examples:

https://integrationnode.tstapi.ons.org.br/hidrologia/v1/GrandezasHidrologicas?DataInicialMedicao=21/04/2020&DataFinalMedicao=24/04/2020&QualidadeDado=COO&AgregacaoTemporal=DI&Grandeza=DFL&IDPostoReservatorio=RPTOCO

https://integrationnode.tstapi.ons.org.br/hidrologia/v1/PrecipitacaoObservada?DataInicialMedicao=22/04/2020&DataFinalMedicao=25/04/2020&QualidadeDado=CD&AgregacaoTemporal=DI&IDEstacaoMeteo=01944032,01944078,01942025




Config example:

Username and password are needed to be able to access the auth token.

The server url should end with the ?, all url parameters will be filled in by FEWS automatically, as described above.

Properties:

QD - compulsory field.

furoTemporal- optional field, only supported with PrecipitacaoObservada .

addParamToUrl - optional field. As you can see above, only the Grandezas Hidrologicas endpoint needs a parameter in the URL. If this field is set to true, the import will assume you wish to import data from Grandezas Hidrologicas, and will try to parse the result accordingly.
As  you will see bellow, the structure of the responses differ, so it is important the field is set correctly. Default value is true.

tokenUrl- There are 3 different environments one can import data from. You need a different url for accessing the authorization token for each environment. Compulsory field.



<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2006 rel. 3 sp1 (http://www.altova.com) by Computer Services (WL | Delft Hydraulics) -->
<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> ONSWebService</importType>
<!--         Url should end with the ?-->
         <serverUrl>https://integrationnode.tstapi.ons.org.br/hidrologia/v1/GrandezasHidrologicas?</serverUrl>
         <user>dummy_username</user>
         <password>dummy_password</password>
         <relativeViewPeriod unit="day" start="-3" end="0" startOverrulable="true" endOverrulable="true"/>
         <idMapId>ONSWebServiceMap</idMapId>
      </general>
      <properties>
         <string key="QD" value="CD,CT"></string>
<!--         Should only be configured if the field needs to be added to the URL-->
         <string key="furoTemporal" value="S"></string>
<!--         This determined if we are importing PrecipitacaoObservada (false), or Grandezas Hidrologicas(true). Default is true-->
         <bool key="addParamToUrl" value="false"></bool>
<!--         The url to get the auth token is different on the test and production environment, thus needs to be configured-->
         <string key="tokenUrl" value="https://poptst.ons.org.br/ons.pop.federation/oauth2/token"></string>
      </properties>
      <timeSeriesSet>
         <moduleInstanceId> ONSWebService</moduleInstanceId>
         <valueType>scalar</valueType>
         <parameterId>param</parameterId>
         <locationId>LocB</locationId>
         <timeSeriesType>external historical</timeSeriesType>
         <timeStep unit="hour" multiplier="1"/>
         <readWriteMode>add originals</readWriteMode>
      </timeSeriesSet>
      <timeSeriesSet>
         <moduleInstanceId> ONSWebService</moduleInstanceId>
         <valueType>scalar</valueType>
         <parameterId>param2</parameterId>
         <locationId>LocB</locationId>
         <timeSeriesType>external historical</timeSeriesType>
         <timeStep unit="hour" multiplier="1"/>
         <readWriteMode>add originals</readWriteMode>
      </timeSeriesSet>
   </import>
</timeSeriesImportRun> 


Example responses:

PrecipitacaoObservada

{
    "Pagina": 0,
    "Quantidade": 57,
    "Resultados": [
        {
            "IdentificadorEstacaoMeteo": "01942025            ",
            "DataHoraMedicao": "01/01/2020 10:00:00",
            "ValorMedicao": "2.5E+1",
            "StatusMedicao": "CD",
            "FuroTemporal": "N",
            "Estimado": "N"
        },
        {
            "IdentificadorEstacaoMeteo": "01942025            ",
            "DataHoraMedicao": "01/01/2020 10:00:00",
            "ValorMedicao": "0E+0",
            "StatusMedicao": "CD",
            "FuroTemporal": "N",
            "Estimado": "N"
        },
        {
            "IdentificadorEstacaoMeteo": "01942025            ",
            "DataHoraMedicao": "01/01/2020 10:00:00",
            "ValorMedicao": "4.58E+1",
            "StatusMedicao": "CD",
            "FuroTemporal": "N",
            "Estimado": "N"
        },
        {
            "IdentificadorEstacaoMeteo": "01942025            ",
            "DataHoraMedicao": "01/01/2020 10:00:00",
            "ValorMedicao": "9.4E+0",
            "StatusMedicao": "CD",
            "FuroTemporal": "N",
            "Estimado": "N"
        }
    ]
} 



Grandezas Hidrologicas

{
    "Pagina": 0,
    "Quantidade": 8,
    "Resultados": [
        {
            "Identificador": "PBANTA",
            "DataHoraMedicao": "01/01/2020",
            "ValorMedicao": "9E+1",
            "StatusMedicao": "COO"
        },
        {
            "Identificador": "PBANTA",
            "DataHoraMedicao": "01/01/2020",
            "ValorMedicao": "9E+1",
            "StatusMedicao": "CON"
        },
        {
            "Identificador": "PBANTA",
            "DataHoraMedicao": "02/01/2020",
            "ValorMedicao": "1.12E+2",
            "StatusMedicao": "COO"
       }
    ]
} 
  • No labels