Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch switched start/end dates #44

Closed
veenstrajelmer opened this issue Mar 4, 2024 · 0 comments · Fixed by #65
Closed

catch switched start/end dates #44

veenstrajelmer opened this issue Mar 4, 2024 · 0 comments · Fixed by #65

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Mar 4, 2024

  • ddlpy version: main
  • Python version: 3.11
  • Operating System: Windows

Description

When accidentally requesting data with start/end date switched, DDL gives "NoDataException: Check meetwaarden aanwezig mislukt". ddlpy.measurements() gives no error at all because the month loop is empty, although ddl does give a decent error. Consider catching this with ddlpy or let ddl provide better feedback.

What I Did

import ddlpy

locations = ddlpy.locations()
bool_hoedanigheid = locations['Hoedanigheid.Code'].isin(['NAP'])
bool_stations = locations.index.isin(['HOEKVHLD'])
bool_grootheid = locations['Grootheid.Code'].isin(['WATHTE'])
# bool_groepering = locations['Groepering.Code'].isin(['NVT'])
selected = locations.loc[bool_grootheid & bool_hoedanigheid & bool_stations]

start_date = "2019-02-01"
end_date = "2019-01-01"

# if we pass one row to the measurements function you can get all the measurements
avail = ddlpy.measurements_available(selected.iloc[0], start_date, end_date)
measurements = ddlpy.measurements(selected.iloc[0], start_date, end_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant