In this recipe, we will show how to use a Fast Fourier Transform (FFT) to compute the spectral density of a signal. The spectrum represents the energy associated to frequencies (encoding periodic fluctuations in a signal). It is obtained with a Fourier transform, which is a frequency representation of a time-dependent signal. A signal can be transformed back and forth from one representation to the other with no information loss.
In this recipe, we will illustrate several aspects of the Fourier transform. We will apply this tool to weather data spanning 20 years in France obtained from the US National Climatic Data Center.