Skip to content

Commit

Permalink
solve minor bug and add test for most_common_station=True
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencalje committed May 8, 2023
1 parent 07aa8f3 commit c09949e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nlmod/read/knmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_recharge(ds, method="linear", most_common_station=False):
# calculate recharge time series
index = oc_knmi_prec.index[oc_knmi_prec.station == stn_rd][0]
prec = oc_knmi_prec.loc[index, "obs"]["RD"].resample("D").nearest()
index = oc_knmi_evap.index[oc_knmi_evap.station == stn_rd][0]
index = oc_knmi_evap.index[oc_knmi_evap.station == stn_ev24][0]
evap = oc_knmi_evap.loc[index, "obs"]["EV24"].resample("D").nearest()
ts = (prec - evap).dropna()
ts.name = f"{prec.name}-{evap.name}"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_005_external_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ def test_get_recharge():
ds.update(nlmod.read.knmi.get_recharge(ds))


def test_get_reacharge_most_common():
# model with sea
ds = test_001_model.get_ds_from_cache("basic_sea_model")

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


def test_get_recharge_steady_state():
# model with sea
ds = test_001_model.get_ds_from_cache("basic_sea_model")
Expand Down

0 comments on commit c09949e

Please sign in to comment.