easyclimate.filter.spectrum#

Spatio-temporal Spectrum Analysis

Functions#

calc_time_spectrum(→ tuple[xarray.DataArray, ...)

Calculate the time spectrum of a multi-dimensional xarray.DataArray along the time dimension.

calc_mean_fourier_amplitude(→ xarray.DataArray)

Calculate mean Fourier amplitude between specified period bounds.

Module Contents#

easyclimate.filter.spectrum.calc_time_spectrum(data: xarray.DataArray, time_dim: str = 'time', inv: bool = False) tuple[xarray.DataArray, xarray.DataArray]#

Calculate the time spectrum of a multi-dimensional xarray.DataArray along the time dimension.

Parameters#

dataxarray.DataArray

Input data with at least a time dimension.

time_dimstr, optional

Name of the time dimension in the DataArray, by default 'time'

invbool, optional

If True, use forward FFT instead of inverse, by default False

Returns#

easyclimate.DataNode, containing:

  • Amplitude spectrum (same dimensions as input but with freq and period dimension)

  • Frequency or period values

Tip

The function automatically handles even/odd length time series and removes the zero-frequency component. The amplitude is calculated as the power spectrum (\(|\mathrm{fft}|^2\)).

easyclimate.filter.spectrum.calc_mean_fourier_amplitude(data: xarray.DataArray, time_dim: str = 'time', lower: float = None, upper: float = None) xarray.DataArray#

Calculate mean Fourier amplitude between specified period bounds.

Parameters#

dataxarray.DataArray

Input data with at least a time dimension. Can have additional dimensions.

time_dimstr, optional

Name of the time coordinate in the DataArray, by default 'time'

lowerfloat

Lower bound of period range

upperfloat

Upper bound of period range

Returns#

xarray.DataArray

Mean amplitude within specified period range, with same dimensions as input but without time dimension.

Tip