Skip to content

Commit

Permalink
fixed testcases (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer authored Oct 11, 2024
1 parent 9611069 commit 87b8820
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kenmerkendewaarden/data_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def clip_timeseries_physical_break(df_meas):
"DENOVBTN": "1933",
"HARLGN": "1933",
"VLIELHVN": "1941",
}
}

station = df_meas.attrs["station"]
if station not in physical_break_dict.keys():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_overschrijding.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_calc_overschrijding_rule_type_break(df_ext_12_2010_2014):

@pytest.mark.unittest
def test_calc_overschrijding_clip_physical_break(df_ext_12_2010_2014):
# construct fake timeseries for VLIELHVN around physical break
# construct fake timeseries for HARLGN around physical break 1933
tstart_2010 = df_ext_12_2010_2014.index[0]
tstart_1931 = pd.Timestamp(
1931,
Expand All @@ -212,7 +212,7 @@ def test_calc_overschrijding_clip_physical_break(df_ext_12_2010_2014):

df_ext_12_1931_1935 = df_ext_12_2010_2014.copy()
df_ext_12_1931_1935.index = df_ext_12_1931_1935.index - tdiff
df_ext_12_1931_1935.attrs["station"] = "VLIELHVN"
df_ext_12_1931_1935.attrs["station"] = "HARLGN"

Tfreqs_interested = [
5,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_slotgemiddelden.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ def test_calc_slotgemiddelden_correct_tstop(df_meas_2010_2014):

@pytest.mark.unittest
def test_calc_slotgemiddelden_physical_break(df_meas_2010_2014, df_ext_12_2010_2014):
# construct fake timeseries for VLIELHVN around physical break
# construct fake timeseries for VLIELHVN around physical break 1933
tstart_2010 = df_meas_2010_2014.index[0]
tstart_1931 = pd.Timestamp(1931, 1, 1, tz=tstart_2010.tz)
tdiff = tstart_2010 - tstart_1931

df_meas_1931_1935 = df_meas_2010_2014.copy()
df_meas_1931_1935.index = df_meas_1931_1935.index - tdiff
df_meas_1931_1935.attrs["station"] = "VLIELHVN"
df_meas_1931_1935.attrs["station"] = "HARLGN"

df_ext_12_1931_1935 = df_ext_12_2010_2014.copy()
df_ext_12_1931_1935.index = df_ext_12_1931_1935.index - tdiff
df_ext_12_1931_1935.attrs["station"] = "VLIELHVN"
df_ext_12_1931_1935.attrs["station"] = "HARLGN"

# check if the timeseries do not extend over the expected slotgemiddelden value
assert df_meas_1931_1935.index[-1] <= pd.Timestamp("1936-01-01 00:00:00 +01:00")
Expand Down

0 comments on commit 87b8820

Please sign in to comment.