Deltares-research / kenmerkendewaarden

Derive indicators from waterlevel measurements
https://deltares-research.github.io/kenmerkendewaarden/
GNU General Public License v3.0
1 stars 0 forks source link

add indicators for month/year mean/min/max of wl/HW/LW #31

Closed veenstrajelmer closed 3 months ago

veenstrajelmer commented 3 months ago

currently, there is kw.tidalindicators.calc_HWLWtidalindicators() with which we can compute several of these indicators but not all:

import kenmerkendewaarden as kw
import hatyan
file_dia = r"c:\DATA\hatyan\tests\data_unitsystemtests\HOEKVHLD_obs19.txt"
ts = hatyan.read_dia(file_dia)
ts_ext = hatyan.calc_HWLW(ts)
indicators = kw.calc_HWLWtidalindicators(ts_ext)

This gives: ['HW_mean', 'LW_mean', 'HW_mean_peryear', 'LW_mean_peryear', 'HW_monthmax_permonth', 'LW_monthmin_permonth', 'HW_monthmax_mean_peryear', 'LW_monthmin_mean_peryear']

Todo:

veenstrajelmer commented 3 months ago

After merging https://github.com/Deltares-research/kenmerkendewaarden/tree/31-add-indicators-for-monthyear-meanminmax-of-wlhwlw, the yearly means of extremes during spring and neaptide are now all computed in kw.calc_HWLWtidalindicators(). This is an example code for the computation and plot:

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

file_dia = r"c:\DATA\hatyan\tests\data_unitsystemtests\HOEKVHLD_obs19.txt"
ts = hatyan.read_dia(file_dia)
ts_ext = hatyan.calc_HWLW(ts)
indicators_wl = kw.calc_wltidalindicators(ts, min_count=0)
indicators_ext = kw.calc_HWLWtidalindicators(ts_ext, min_count=0)
print("available indicators wl: ", indicators_wl.keys())
print("available indicators ext: ", indicators_ext.keys())

yearly_mean = indicators_wl["wl_mean_peryear"]
monthly_mean = indicators_wl["wl_mean_permonth"]

ghws = indicators_ext["HW_monthmax_mean_peryear"]
ghwn = indicators_ext["HW_monthmin_mean_peryear"]
glwn = indicators_ext["LW_monthmax_mean_peryear"]
glws = indicators_ext["LW_monthmin_mean_peryear"]

fig, ax = plt.subplots(figsize=(10,6))
ax.plot(ghws, label="ghws", color='r')
ax.plot(ghwn, label="ghwn", color='orange')
ax.plot(yearly_mean, label="yearly_mean", color='c')
ax.plot(monthly_mean, label="monthly_mean", color='m')
ax.plot(glwn, label="glwn", color='lime')
ax.plot(glws, label="glws", color='g')
ax.legend(loc=1)
ax.grid()
fig.tight_layout()

Which gives: image