Deltares / ddlpy

API to Dutch Rijkswaterstaat archive (DDL, waterinfo.rws.nl) of monitoring water data
https://deltares.github.io/ddlpy/
GNU General Public License v3.0
20 stars 6 forks source link

Add distinction between waterlevels and extremes with "Groepering.Code" #21

Closed veenstrajelmer closed 8 months ago

veenstrajelmer commented 8 months ago

Description

When retrieving WATHTE data for HOEKVHLD, I get extremes instead of plain measurements. This happens partly because there is no distinction between extremes (Groepering.Code=GETETM2) and normal measurements (Groepering.Code=NVT)

What I Did

import datetime as dt
import ddlpy

locations = ddlpy.locations()
codes = ['HOEKVHLD', 'IJMDBTHVN','SCHEVNGN']
parameters = ['WATHTE']
selected = locations[locations.index.isin(codes)]
selected = selected[selected['Grootheid.Code'].isin(parameters)]
records = selected.loc['HOEKVHLD']

# if we pass one row to the measurements function you can get all the measurements
measurements = ddlpy.measurements(records, dt.datetime(1980,1,1), dt.datetime(1980,1,5))
measurements.plot(y='Meetwaarde.Waarde_Numeriek', linewidth=0.5, figsize=(13, 8))

Gives: image

When we do this for 1990, we do get WATHTE: image

So this behaviour is not consistent. The 1990 timeseries is probably a combination of waterlevels and extremes, since we have 8 duplicated time values (measurements["Tijdstip"].duplicated().sum() gives 8)

Solution

We need to:

Currently included in OphalenCatalogus query:

Consider adding:

Probably no added value:

WaardeBepalingsmethoden Code+Omschrijving: 1463 other:F007 Rekenkundig gemiddelde waarde over vorige 5 en volgende 5 minuten 1464 other:F009 Visuele aflezing van blad 1465 other:F010 HW en LW uit 1 min. waterhoogten gefilterd uit 10 min. gem. 1466 other:F001 Rekenkundig gemiddelde waarde over vorige 10 minuten

Additional info This might be a breaking change, since all WATHTE queries should now also contain Groepering, since otherwise multiple rows in dataframe which is not accepted by ddlpy.measurements()