Skip to content

Error in 'get_recharge' #336

@OnnoEbbens

Description

@OnnoEbbens

I get an error when I try to get the recharge.

# model with sea
ds = nlmod.get_ds([100000, 110000, 420000, 430000])
ds = nlmod.time.set_ds_time(ds, start="2021", time=pd.date_range("2022", "2023"))

# add knmi recharge to the model dataset
ds.update(nlmod.read.knmi.get_recharge(ds, most_common_station=True))

The origin of this error is a change in behavior of hydropandas. If the given station number has no measurement in the given period and fill_missing_obs is True, all values are filled with values from a nearby station. Previously the station attribute would remain the given station. In the new behavior the station name refers to the station that is used to fill the first data. See for example this code:

oc_knmi_prec = hpd.ObsCollection.from_knmi(
    stns=[459],
    starts=[pd.Timestamp("2021-01-01 00:00:00")],
    ends=[pd.Timestamp("2023-01-01 00:00:00")],
    meteo_vars=["RD"],
    fill_missing_obs=True,
)
print(oc_knmi_prec.station)
>>> name
>>> RD_HENDRIK-IDO-AMBACHT    482
>>> Name: station, dtype: int64

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