range_driver.data_prep.tidal module¶
tidal table processing
- range_driver.data_prep.tidal.flatten_tidal_table(df, year, format_str='%d %B %Y %H%M', display=False)[source]¶
Convert a multi-column tidal table (up to 4 extrema per day) into a flat datetime indexed DataFrame. df is expected to have time1, height1, time2, height2, …, height4 columns
- range_driver.data_prep.tidal.ipf_cos(t)[source]¶
Interpolation function based on cosine smoothly progressing in t = [0,1] First derivative at interval end points is 0 (flat).
- Returns:
0 - if t=0 1 - if t=1
- range_driver.data_prep.tidal.tidal_phase(dflat, new_times=None, interpolation_func=<function ipf_cos>)[source]¶
- Calcualte tidal phase and tidal height changes
dflat DataFrame is expected to have datetime index and columns ‘height’, ‘highlow’ where dflat[‘highlow’] == ‘h’ indicates high tide
- Returns:
DataFrame based on dflat with additional columns ‘time_start’, ‘duration’, ‘height_start’, ‘height_change’, and ‘dheight_cm_per_hr’