<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Generate a minimally realistic-looking fake tide.
t is time in hours
phases are in radians
See
Step1:  Semi-diurnal
Step2:  Diurnal
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt
style.use('ggplot')
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
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
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)
Explanation: Generate a minimally realistic-looking fake tide.
t is time in hours
phases are in radians
See: http://currents.soest.hawaii.edu/ocn_data_analysis/_static/plotting.html
End of explanation
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')
Explanation: Semi-diurnal
End of explanation
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)
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')
Explanation: Diurnal
End of explanation
<END_TASK>