Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix calc_HWLWnumbering() for IJMBTHVN #329

Open
veenstrajelmer opened this issue Aug 30, 2024 · 0 comments
Open

fix calc_HWLWnumbering() for IJMBTHVN #329

veenstrajelmer opened this issue Aug 30, 2024 · 0 comments

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Aug 30, 2024

Within the kenmerkendewaarden project, some extremes timeseries raised "Exception: tidal wave numbering: HW numbers not always increasing". This was often due to invalid additional extremes reported in Rijkswaterstaat/wm-ws-dl#43. However, at least for IJMBTHVN, there is a valid but strongly asymmetric extreme that causes this error.

It is only an issue after shifting the timezone (which is what happens in kw.calc_gemiddeldgetij()), but it comes from hatyan.calc_HWLWnumbering() already. So even if for kenmerkendewaarden we move to another way of matching culminations and extremes, we will probably want to solve this in hatyan.

import matplotlib.pyplot as plt
plt.close('all')
import hatyan
import kenmerkendewaarden as kw # pip install git+https://github.com/Deltares-research/kenmerkendewaarden
import ddlpy

locs_meas_ts, locs_meas_ext, locs_meas_exttype = kw.data_retrieve.retrieve_catalog()

tstart = "2018-01-17"
tstop = "2018-01-19"
station = "IJMDBTHVN"
df_meas_ddlpy = ddlpy.measurements(locs_meas_ts.loc[station], start_date=tstart, end_date=tstop)
df_ext_ddlpy = ddlpy.measurements(locs_meas_ext.loc[station], start_date=tstart, end_date=tstop)
df_exttyp_ddlpy = ddlpy.measurements(locs_meas_exttype.loc[station], start_date=tstart, end_date=tstop)
df_meas = hatyan.ddlpy_to_hatyan(df_meas_ddlpy)
df_ext = hatyan.ddlpy_to_hatyan(df_ext_ddlpy, df_exttyp_ddlpy)

df_ext = hatyan.calc_HWLWnumbering(df_ext)
fig,ax = plt.subplots()
df_meas['values'].loc[tstart:tstop].plot(ax=ax)
df_ext['values'].loc[tstart:tstop].plot(ax=ax, marker='x', linestyle='')
for irow, row in df_ext.loc[tstart:tstop].iterrows():
    ax.text(row.name, row['values'], row["HWLWno"])

Gives:
image

If we shift the timeseries with 1 hour (which is done in kw.calc_havengetallen()) it raises "Exception: tidal wave numbering: HW numbers not always increasing" because HW 12737 is interpreted as HW 12738:

if df_ext.index.tz is not None:
    df_ext = df_ext.tz_localize(None)
df_num = hatyan.calc_HWLWnumbering(df_ext)

Note: in #311, it was also noted that hatyan.calc_HWLWnumbering() fails for "long 1870-2024 timeseries for HOEKVHLD, even not when providing station argument".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant