Utforskning: tidevann


Background

Tidal oscillations originate from the gravitational interactions between the Earth and other celestial bodies, especially the Sun and the Moon. variations in the sun and the moon position relative to the Earth, give rise to periodic motions with different frequencies. You can think of the total tides as the sum of many waves with slightly different frequencies (\(\omega\)), amplitudes (\(A\)) and phases (\(\phi\)). Consider the following sine wave equation and Figure 1 below:

$$y_1 = A_1 \cdot \sin(\omega_1 \cdot x - \phi_1) \text{ (blue)}$$ $$y_2 = A_2 \cdot \sin(\omega_2 \cdot x - \phi_2) \text{ (green)}$$

Figure 1: Comparison of different sine waves. Figure 1: Comparison of different sine waves. Source: pngkey.com.

These single waves are often referred to as tidal constituents, and their frequencies/periods are known accurately from astronomical calculations. Although we are aware of hundreds of constituents, we usually only need about ten of them to describe more than 90% of the observed tidal variation.

The tides are visible through changes in the sea surface height SSH. When we make observations of SSH as a function of time (\(t\)), we measure a combination of the local mean sea level (\(H\)) and the influence of tides \(\text{Ti}(t)\). In addition, there could be influence from meteorological forcing \(\text{M}(t)\), such as wind/storms.

In this example, we will investigate some properties of tides and compare a pure tidal signal to observed sea level measurements.

Data

The amplitudes and phases of tidal constituents vary from place to place, due to interference with land masses (the waves will have to travel around the land masses). Table 1 provides amplitudes, periods and phases for 6 components (M2, S2, N2,K2, O1 and K1) obtained at Kartverket from sea level observations in Stavanger.

ComponentAmplitude[cm]Period[hours]Phase[deg]
M215.8512.420.33
S26.6812.006.18
N22.5912.661.00
K21.1911.970.33
O11.5025.825.85
K15.4423.935.44

Table 1: data for 6 tidal constituents.

For more information about tides, check the compendium developed by Prof. Helge Drange here.

Task 1

Given the values in Table 1, we create the dictionary comps containing the tidal components as keys and amplitude, period and phase as their corresponding values. (It is important to remember to keep the same order in every entry.)

# comps = {'m2':[A, Pd, Ph], 's2':[], ... }
comps = {
    'm2':[15.85, 12.42, 0.33],
    's2':[6.68, 12.00, 6.18],
    'n2':[2.59, 12.66, 1.00],
    'k2':[1.19, 11.97, 0.33],
    'o1':[1.50, 25.82, 5.85],
    'k1':[5.44, 23.93, 5.44],
}

Task 2

Create the dictionary tides, with the same keys as comps but with empty lists as entries.

# tides = {'m2':[], 's2':[]...}
tides = {'m2':[], 's2':[], 'n2':[], 'k2':[], 'o1':[], 'k1':[]}

Task 3

Create the function elev that takes as arguments the name of the tidal component and its wave parameters. By using a cosine function, we calculate the SSH associated to each of the components for 45 days. Then we save the calculated tidal elevation in the corresponding key within the tides dictionary.

Tip 1: Period must be converted to radians. The period in radians, \(\text{T}_{\text{rad}}\), is given by

$$\text{T}_{\text{rad}} = \frac{2\pi}{\text{T}_d}$$

where \(\text{T}_d\) is the period in degrees.

Tip 2: Import the math module and use the cosine function.

from math import cos, pi

comps = {
    'm2':[15.85, 12.42, 0.33],
    's2':[6.68, 12.00, 6.18],
    'n2':[2.59, 12.66, 1.00],
    'k2':[1.19, 11.97, 0.33],
    'o1':[1.50, 25.82, 5.85],
    'k1':[5.44, 23.93, 5.44],
}
tides = {'m2':[], 's2':[], 'n2':[], 'k2':[], 'o1':[], 'k1':[]}

def elev(td, period, amplitude, phase, time):
    omega = (2*pi/period) # convert period to rad

    # calculate sea level elevation with a cosine wave equation
    ssh = [amplitude * cos(omega * t - phase) for t in time]
    return ssh

times = range(45*24+1) # 45 days, 24 h/day (+1 hour to end at day 45)
for td in tides.keys():
    ssh = elev(td, comps[td][1], comps[td][0], comps[td][2], times)
    tides[td].extend(ssh)

print(tides)

The dictionary tides now looks like this:

{'m2': [14.99477114, 15.60544637, ..., 13.05302602],
 's2': [6.64446987, 5.41025202, ..., 6.64446987],
 'n2': [1.39938297, 2.26833165, ..., 1.53678411],
 'k2': [1.12579039, 1.16746723, ..., 0.55324662],
 'o1': [1.36144992, 1.169624, ..., 1.19659995],
 'k1': [ 3.61807615,  2.43964282,  ..., -0.5402215 ]}

Plotting

Let’s sum up all of the components and make a plot:

import matplotlib.pyplot as plt

... 

ssh = []
for i in range(len(tides['m2'])):
    s = sum([tides[td][i] for td in tides.keys()])
    ssh.append(s)

plt.plot(ssh);
labels = [round(i * 45 / (24*45+1)) for i in range(24*45+1)]

# change xticks to days
plt.xticks(times[0:-1:24*7], labels[0:-1:24*7], rotation=45); 

plt.xlabel('Days')
plt.ylabel('SSH (cm)')
plt.show()

We get the following plot:

Plot generated by the code above

PS: The signal presents a clear 14 days period modulation. Why does this happen?

Lastly, let’s plot two components (M2 and S2) for 15 days and check how they look like when they are superimposed. To do this, we sum the two components of interest using the variable sum_tides.

...

#sum_tides = tide1 + tide2
sum_tides = [tides['m2'][i] + tides['s2'][i] for i in range(len(tides['m2']))]

fig, (ax0, ax1, ax2) = plt.subplots(nrows=3, ncols=1,
                                    sharex=True, sharey=True)

ax0.plot(tides['m2'][0:15*24+1]) #m2 component
ax0.set_title('m2')

ax1.plot(tides['s2'][0:15*24+1], 'k-') #o1 component
ax1.set_title('s2')

ax2.plot(sum_tides[0:15*24+1], 'r') #superimposed component
ax2.set_title('m2+s2')

# change xticks to days
plt.xticks(times[0:15*24+1:24], labels[0:15*24+1:24], rotation=45); 

plt.xlabel('Days')
ax1.set_ylabel('SSH (cm)')
plt.show()

This gives us the following plot:

Plot generated by the code above