fluves / pywaterinfo

Python package to download time series data from waterinfo.be
https://fluves.github.io/pywaterinfo/
MIT License
17 stars 9 forks source link

Add support for the raster data products using the KiWIS grid api to pywaterinfo #66

Open MaritH9 opened 11 months ago

MaritH9 commented 11 months ago

Description

I was already using Waterinfo("vmm") to gather precipitation data (accum. 24h) (ts_id = '6604010') from the raster data with request=getRasterToPointValues, which works fine. Now, I also wanted to get data on the confidence/uncertainty of this raster data, i.e. RMSE and NSE, as described in the manual with request = getTimeseriesValues. The problem is that I get an empty dataset or an error, depending on the request method.

So my question is, is this data no longer provided, or is there a problem with the accessibility via the API? Or should I use another request method or ts_id?

What I Did

The example that is given in the manual does not contain any data: https://hydro.vmm.be/grid/kiwis/KiWIS?datasource=10&service=kisters&type=queryServices&request=gettimeseriesvalues&ts_id=6793010&period=P1D&metadata=true .

If I try any other method using the API, I also end up with empty datasets:

ts_id = '6793010' # 6792010 = NSE & 6793010 = RMSE
start_date = date(2023, 8, 1)
end_date = date(2023, 9, 21)
for dag in daterange(start_date, end_date):
    dag = dag.strftime("%Y-%m-%d")
    data =  pd.read_csv('https://hydro.vmm.be/grid/kiwis/KiWIS?datasource=10&service=kisters&type=queryServices'+
        '&request=GetTimeseriesValues&format=csv&ts_id='+ts_id+'&from='+dag+'T00:00:00.000+01:00&'+
        '&period=P1D&metadata=True&format=csv', sep=';',header=11)
    print(data)

Or when trying vmm.get_timeseries_values("6793010", start="2023-04-01", end="2023-08-01"), I get an error: KiwisException: Waterinfo call returned 500 error with the message b'{"type": "error", "code": "InvalidParameterValue", "message": "One or more of the entered timseries ids could not be found."}'

Thanks!

binomaiheu commented 11 months ago

I don't think pywaterinfo currently supports the KiWIS grid api, which is at a different base url (https://hydro.vmm.be/grid/kiwis/KiWIS) then the timeseries url (https://download.waterinfo.be/tsmdownload/KiWIS/KiWIS).

The ts_id's don't exist in the timeseries database, but in the grid system, which is why pywaterinfo is not able to find them. I checked the queries for NSE and RMSE from the waterinfo open data document and they do seem to work, but indeed returning emtpy datasets.

I will have a closer look tomorrow in the grid system to see whether they are still calculated, but best forward the question to hydrometrie@waterinfo.be as well as indicated in the document so it's formally logged...

binomaiheu commented 11 months ago

The NSE and RMSE on the raster data are indeed not calculated anymore in the grid system (since 2019 even), so best consider these series as obsolete. Will have them removed from the open data document.

stijnvanhoey commented 2 months ago

I'll rename this issue to mark the task to be done is to add support for the KiWIS grid api.