diff --git a/HISTORY.rst b/HISTORY.rst index 1971486..d934575 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,7 +5,7 @@ History UNRELEASED ------------------ * added `catalog_filter` argument to `ddlpy.locations()` to enabling retrieving the extended catalog in https://github.com/Deltares/ddlpy/pull/87 - +* pass all Code parameters to measurements request instead of only four in https://github.com/Deltares/ddlpy/pull/88 0.3.0 (2023-03-13) ------------------ diff --git a/ddlpy/ddlpy.py b/ddlpy/ddlpy.py index 8aea98d..9429f06 100644 --- a/ddlpy/ddlpy.py +++ b/ddlpy/ddlpy.py @@ -96,13 +96,12 @@ def _check_convert_dates(start_date, end_date, return_str=True): def _get_request_dicts(location): - aquometadata_dict = { - "Eenheid": {"Code": location["Eenheid.Code"]}, - "Grootheid": {"Code": location["Grootheid.Code"]}, - "Hoedanigheid": {"Code": location["Hoedanigheid.Code"]}, - "Groepering": {"Code": location["Groepering.Code"]}, - } + # generate aquometadata dict from location "*.Code" values + key_list = [x.replace(".Code","") for x in location.index if x.endswith(".Code")] + aquometadata_dict = {key:{"Code":location[f"{key}.Code"]} for key in key_list} + + # generate location dict from relevant values locatie_dict = { "X": location["X"], "Y": location["Y"], @@ -217,7 +216,6 @@ def measurements_amount(location, start_date, end_date, period="Jaar"): def _combine_waarnemingenlijst(result, location): assert "WaarnemingenLijst" in result - # assert len(result['WaarnemingenLijst']) == 1 # flatten the datastructure rows = [] for waarneming in result["WaarnemingenLijst"]: