Generate a minimally realistic-looking fake tide.

• t is time in hours
• phases are in radians
``````

In [1]:

%matplotlib inline

import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt

style.use('ggplot')

``````
``````

In [2]:

def diurnal_tide(t, K1amp, K1phase, O1amp, O1phase, randamp):
out = K1amp * np.sin(2 * np.pi * t / 23.9344 - K1phase)
out += O1amp * np.sin(2 * np.pi * t / 25.8194 - O1phase)
out += randamp * np.random.randn(len(t))
return out

``````
``````

In [3]:

def semidiurnal_tide(t, M2amp, M2phase, S2amp, S2phase, randamp):
out = M2amp * np.sin(2 * np.pi * t / 12.42 - M2phase)
out += S2amp * np.sin(2 * np.pi * t / 12.0 - S2phase)
out += randamp * np.random.randn(len(t))
return out

``````
``````

In [4]:

t = np.arange(600)

u = semidiurnal_tide(t, 2, 0, 1, 0, 0.2)
v = semidiurnal_tide(t, 1.2, np.pi / 2, 0.6, np.pi / 2, 0.2)

``````

Semi-diurnal

``````

In [5]:

fig, ax = plt.subplots(figsize=(9, 3.75))

t = t/24

kw = dict(alpha=0.5, linewidth=2)
ax.plot(t, u, label='U', **kw)
ax.plot(t, v, label='V', **kw)

ax.legend(loc='lower right')
ax.set_xlabel('Dias')
ax.set_ylabel('m s\$^{-1}\$')
ax.set_title('Típico registro de velocidade de maré')

fig.savefig("fake_semi-diurnal_tides.svg", bbox_inches='tight')

``````
``````

``````

Diurnal

``````

In [6]:

t = np.arange(600)

u = diurnal_tide(t, 2, 0, 1, 0, 0.2)
v = diurnal_tide(t, 1.2, np.pi / 2, 0.6, np.pi / 2, 0.2)

``````
``````

In [7]:

fig, ax = plt.subplots(figsize=(9, 3.75))

t = t/24

kw = dict(alpha=0.5, linewidth=2)
ax.plot(t, u, label='U', **kw)
ax.plot(t, v, label='V', **kw)

ax.legend(loc='lower right')
ax.set_xlabel('Dias')
ax.set_ylabel('m s\$^{-1}\$')
ax.set_title('Típico registro de velocidade de maré')

fig.savefig("fake_diurnal_tides.svg", bbox_inches='tight')

``````
``````

``````