<p>With a little bit of math:</p>
<p><span class="math-container">$$  A * \cos [ (2 \pi t/P + \phi] = a\sin(2\pi t/P)+b\cos(2\pi t/P)$$</span></p>
<p>Then, the amplitude is:</p>
<p><span class="math-container">$$A=\sqrt{a^2+b^2}$$</span>
and the phase is
<span class="math-container">$$\phi=\arctan{\frac{b}{a}}$$</span></p>
<p><a href="https://en.wikibooks.org/wiki/Trigonometry/Simplifying_a_sin(x)_%2B_b_cos(x)" rel="nofollow noreferrer">https://en.wikibooks.org/wiki/Trigonometry/Simplifying_a_sin(x)_%2B_b_cos(x)</a></p>

CC BY-SA 4.0
2021-11-05T18:11:03.367Z
yeah, thank you! My issue is applying this to the 4D data... and to what extent, like monthly means (January - December) or just the trended, monthly data itself
wabash
CC BY-SA 4.0
2021-11-05T18:49:23.680Z
I would recommend that you use the monthly data. There is also the possibility that the A(x,y,z) could have a change in time. You have to do it point by point of the grid. You could try to do a regional average and then get the seasonal cycle in each region, but that may alias the magnitude of the cycle
arkaia
CC BY-SA 4.0
2021-11-05T19:23:06.233Z
Oh ok, thank you! Sorry one last question... to get the amplitude of the annual harmonic, could I just get the amplitude from the FFT just at the period of 12 months (or frequency of 1/12)? Would that constitute as the annual harmonic?
wabash
CC BY-SA 4.0
2021-11-05T21:39:03.270Z
You don't even need to do the FFT, you could just do a fit to that function exclusively. The issue of the FFt is that you might get some of the energy of the annual cycle into other frequencies. You can difinitely try the 1/12 frequency and see if it makes sense
arkaia
CC BY-SA 4.0
2021-11-05T15:52:04.353Z
2021-11-05T15:52:04.353Z
arkaia
<p>This is a question on methodology. But I have 4d temperature and salinity gridded data (time, depth, lat and lon). The time is in monthly time steps.
How would I get the annual harmonics of temperature and salinity using a periodicity of 12 months:</p>
<p>The equation is:</p>
<p><span class="math-container">$$ Var(t,z,y,x) = A (z,y,x) * \cos [ (2 \pi t/P + \phi(z,y,x)] $$</span></p>
<p>Where <span class="math-container">$A$</span> is the amplitudes of the annual component, where <span class="math-container">$var$</span> is either temp or salinity. <span class="math-container">$\phi$</span> is the phase angle which determine the time when the maximum of the annual harmonic occurs. And <span class="math-container">$t$</span> varies from 0 - n months (however long the time series is).</p>
<p>We can isolate <span class="math-container">$A(z,y,x)$</span> just with algebra, but the issue is finding the phase angle where the maximum of the annual harmonic occurs.</p>
<p>Do you you need to take a fourier transform of monthly means (January - December), or do you take the FT of the entire time series but just look at the power spectrum at 12 months...
I am using Python, and taking the fourier transform is no problem. I just don't know how to treat the data to obtain the phase angle where the maximum of the annual harmonic occurs.
What might be the steps to find the annual harmonic amplitude given 4D temp and salinity (time in months, depth, lat and lon)?</p>

<oceanography><temperature><salinity>
How to determine the annual harmonics of temperature and salinity data?
wabash
# How to determine the annual harmonics of temperature and salinity data?

(Asked by: username_0 on 2021-11-05)

This is a question on methodology. But I have 4d temperature and salinity gridded data (time, depth, lat and lon). The time is in monthly time steps.
How would I get the annual harmonics of temperature and salinity using a periodicity of 12 months:

The equation is:

$$ Var(t,z,y,x) = A (z,y,x) \* \cos [ (2 \pi t/P + \phi(z,y,x)] $$

Where $A$ is the amplitudes of the annual component, where $var$ is either temp or salinity. $\phi$ is the phase angle which determine the time when the maximum of the annual harmonic occurs. And $t$ varies from 0 - n months (however long the time series is).

We can isolate $A(z,y,x)$ just with algebra, but the issue is finding the phase angle where the maximum of the annual harmonic occurs.

Do you you need to take a fourier transform of monthly means (January - December), or do you take the FT of the entire time series but just look at the power spectrum at 12 months...
I am using Python, and taking the fourier transform is no problem. I just don't know how to treat the data to obtain the phase angle where the maximum of the annual harmonic occurs.
What might be the steps to find the annual harmonic amplitude given 4D temp and salinity (time in months, depth, lat and lon)?

**Tags:** oceanography, temperature, salinity


---

## 1 answers

### Answer by username_1 on 2021-11-05. Score: 3 | Accepted answer

With a little bit of math:

$$ A \* \cos [ (2 \pi t/P + \phi] = a\sin(2\pi t/P)+b\cos(2\pi t/P)$$

Then, the amplitude is:

$$A=\sqrt{a^2+b^2}$$
and the phase is
$$\phi=\arctan{\frac{b}{a}}$$

<https://en.wikibooks.org/wiki/Trigonometry/Simplifying_a_sin(x)_%2B_b_cos(x)>

> **Comments:**
> **username_0**: yeah, thank you! My issue is applying this to the 4D data... and to what extent, like monthly means (January - December) or just the trended, monthly data itself  
> **username_1**: I would recommend that you use the monthly data. There is also the possibility that the A(x,y,z) could have a change in time. You have to do it point by point of the grid. You could try to do a regional average and then get the seasonal cycle in each region, but that may alias the magnitude of the cycle  
> **username_0**: Oh ok, thank you! Sorry one last question... to get the amplitude of the annual harmonic, could I just get the amplitude from the FFT just at the period of 12 months (or frequency of 1/12)? Would that constitute as the annual harmonic?  
> **username_1**: You don't even need to do the FFT, you could just do a fit to that function exclusively. The issue of the FFt is that you might get some of the energy of the annual cycle into other frequencies. You can difinitely try the 1/12 frequency and see if it makes sense  

---

