The timezone utc+1 is dropped from the data_pd_meas_all dataframe, due to the slotgemiddelden part, in kw.calc_wltidalindicators() specifically.
Todo:
[x] consider not localizing the dataframe at all, or make a copy of it before doing so.
[x] if doing so, consider also doing it for HWLW.
[x] commenting the localization makes the process way slower, why? The statistics/figure seem to be exactly equal. See example code below. This issue was reported to pandas: https://github.com/pandas-dev/pandas/issues/58956
[x] after fixing this, check if the timezone is indeed not dropped anymore when executing the entire KWK_process.py script
[x] add testcase for tidalindicators
[x] update whatsnew.md
Reproducible code shows 0.38 sec vs 28 sec for kw.calc_wltidalindicators(), why?:
import os
import kenmerkendewaarden as kw # pip install git+https://github.com/Deltares-research/kenmerkendewaarden
import datetime as dt
dir_base = r'p:\11210325-005-kenmerkende-waarden\work'
dir_meas = os.path.join(dir_base,'measurements_wl_18700101_20240101')
current_station = 'HOEKVHLD'
print(f'loading data for {current_station}')
# timeseries are used for slotgemiddelden, gemgetijkrommen (needs slotgem+havget)
data_pd_meas_all = kw.read_measurements(dir_output=dir_meas, station=current_station, extremes=False)
print('deriving stats')
dtstart = dt.datetime.now()
dict_wltidalindicators = kw.calc_wltidalindicators(data_pd_meas_all)
print(f'{(dt.datetime.now()-dtstart).total_seconds():.2f} sec')
#calc_wltidalindicators takes 0.36 sec when dropping timezone (tz_localize), 28 sec when not dropping timezone
The timezone utc+1 is dropped from the
data_pd_meas_all
dataframe, due to the slotgemiddelden part, inkw.calc_wltidalindicators()
specifically.Todo:
KWK_process.py
scriptReproducible code shows 0.38 sec vs 28 sec for
kw.calc_wltidalindicators()
, why?: