core.forcing.Harmonic
core.forcing.Harmonic(
duration,
period,
A,
center=None,
y0=None,
plot_kwargs=None,
)Sinusoidal segment with automatic phase continuity.
The phase at the start of the segment is computed so that the sinusoid passes through y0 (or the previous segment’s endpoint), ensuring a smooth join when embedded in a ForcingSequence.
Parameters
duration : float-
Length of the segment. Must be > 0.
period : float-
Period of the sinusoid in model time units. Must be > 0.
A : float-
Amplitude. Must be non-zero.
center : float = None-
Mean value (vertical offset) of the sinusoid. If omitted, the mean is inferred from
y0such that the sinusoid oscillates symmetrically about the starting value. y0 : float = None-
Starting value. If omitted, inherits from the previous segment’s endpoint. At least one of
y0orcentermust be provided (or a previous segment must exist).
Examples
import matplotlib.pyplot as plt
import climatecritters as cc
h = cc.forcing.Harmonic(duration=20, period=4.0, A=0.5, center=0.0)
fig, ax = h.plot()
plt.savefig('docs/reference/figures/Harmonic_example.png',
dpi=150, bbox_inches='tight')