Tidal Aliasing
This notebook demonstrates calculating the aliasing periods of tidal constituents for a given observation frequency.
import ipywidgets
import numpy as np
import pandas as pd
import pyTMD.constituents
# repeat period in solar days and in seconds
repeat_period = 90.8193
sampling = repeat_period * 86400.0
# constituents to calculate aliasing periods
constituents = ["q1", "o1", "p1", "s1", "k1", "j1", "n2", "m2", "s2", "k2"]
# allocate for output values for the table
doodson_numbers = []
tidal_frequencies = np.zeros_like(constituents, dtype=np.float64)
aliasing_periods = np.zeros_like(constituents, dtype=np.float64)
for i, c in enumerate(constituents):
# get the Doodson number for the constituent
doodson_numbers.append(pyTMD.constituents.doodson_number(c))
# get the frequency of the constituent in radians per second
(omega,) = pyTMD.constituents.frequency(c, corrections="GOT")
# convert frequency to cycles per day
tidal_frequencies[i] = omega * 86400.0 / (2.0 * np.pi)
# get the aliasing period of the constituent in seconds
(aliasing,) = pyTMD.constituents.aliasing_period(
c, sampling, corrections="GOT"
)
# convert aliasing period to days and round to 1 decimal place
aliasing_periods[i] = np.round(aliasing / 86400.0, decimals=1)
# create a dataframe
df = pd.DataFrame(
{
"Constituent": constituents,
"Doodson Number": doodson_numbers,
"Frequency [cpd]": tidal_frequencies,
"Aliasing Period [days]": aliasing_periods,
}
)
# create a HTML table from the DataFrame
html = df.to_html(na_rep="", index=False, notebook=True)
# display the table with a caption
layout = ipywidgets.Layout(display="flex", align_items="center", width="100%")
caption = ipywidgets.Label(style={"font_weight": "bold", "font_size": "16px"})
caption.value = (
"Tidal Aliasing Periods: ICESat-2 Sampling (\u007e91-day repeat)"
)
table = ipywidgets.HTML(value=html)
ipywidgets.VBox([caption, table], layout=layout)