class weatherbench2.derived_variables.ZonalEnergySpectrum(variable_name)

Energy spectrum along the zonal direction.

Given dataset with longitude dimension, this class computes spectral energy as a function of wavenumber (as a dim). wavelength and frequency are also present as coords with units “1 / m” and “m” respectively. Only non-negative frequencies are included.

Let f[l], l = 0,…, L - 1, be dataset values along a zonal circle of constant latitude, with circumference C (m). The DFT is

F[k] = (1 / L) Σₗ f[l] exp(-i2πkl/L)

The energy spectrum is then set to

S[0] = C |F[0]|², S[k] = 2 C |F[k]|², k > 0, to account for positive and negative frequencies.

With C₀ the equatorial circumference, the ith zonal circle has circumference

C(i) = C₀ Cos(π latitude[i] / 180).

Since data points occur at longitudes longitude[l], l = 0, …, L - 1, the DFT will measure spectra at zonal sampling frequencies

f(k, i) = longitude[k] / (C(i) 360), k = 0, …, L // 2,

and corresponding wavelengths

λ(k, i) = 1 / f(k, i).

This choice of normalization ensures Parseval’s relation for energy holds: Supposing f[l] are sampled values of f(ℓ), where 0 < ℓ < C (meters) is a coordinate on the circle. Then (C / L) is the spacing of longitudinal samples, whence

∫|f(ℓ)|² dℓ ≈ (C / L) Σₗ |f[l]|² = Σₖ S[k].

If f has units β, then S has units of m β². For example, if f is u_component_of_wind, with units (m / s), then S has units (m³ / s²). In air with mass density ρ (kg / m³), this gives energy density at wavenumber k

ρ S[k] ~ (kg / m³) (m³ / s²) = kg / s²,

which is energy density (per unit area).


variable_name (str) –


variable_name (str) –

Return type:





Computes zonal power at wavenumber and frequency.


Spacing (meters) between longitudinal values in dataset.



The set of all input core dimensions.


Return a list of base variables.


Return core dimensions needed for computing this variable.