Skip to content

Raise informative error when get_recharge() yields an empty result #455

@dbrakenhoff

Description

@dbrakenhoff

Currently the code below raises a KeyError, I believe it would be more informative to catch this error and raise a more informative error on the NLmod side, e.g. warn about an empty ObsCollection ( maybe with the suggestion to check if recharge is available for this period)?

import nlmod
import pandas as pd

ds = nlmod.get_ds([100000, 110000, 420000, 430000])
time = [pd.Timestamp.now().normalize()]
ds = nlmod.time.set_ds_time(ds, start=time[0] - pd.Timedelta(days=21), time=time)
knmi = nlmod.read.knmi.get_recharge(ds)

The test tests/test_005_external_data.py::test_get_recharge_not_available will have to be modified to reflect that change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions