easyclimate.core.spec¶
Submodules¶
Functions¶
|
Calculate the gaussian latitudes (in degrees) and quadrature weights. |
Calculate the gaussian latitudes (in degrees) and quadrature weights by Rust backend. |
|
Calculate the lat/lon values of the points on the surface of the sphere |
|
Calculate the lat/lon values of the points on the surface of the sphere |
|
Calculate indices of zonal wavenumber (indxm) and degree (indxn) for complex spherical harmonic coefficients. |
|
Calculate indices of zonal wavenumber (indxm) and degree (indxn) for complex spherical harmonic coefficients by Rust backend. |
|
|
Calculate associated legendre functions for triangular truncation T(ntrunc), at a given latitude. |
|
Calculate associated legendre functions for triangular truncation T(ntrunc), at a given latitude by Rust backend. |
|
Transform grid data to spectral representation (spherical harmonic analysis). |
|
Transform grid data to spectral representation (spherical harmonic analysis) by Rust backend. |
|
Transform spectral data back to grid space representation (spherical harmonic synthesis) |
|
Transform spectral data back to grid space representation (spherical harmonic synthesis) by Rust backend. |
|
Calculate the wind speed (magnitude of vector wind). |
|
Calculate the wind speed (magnitude of vector wind) by Rust backend. |
Calculate relative vorticity and horizontal divergence. |
|
Calculate relative vorticity and horizontal divergence by Rust backend. |
|
|
Calculate relative vorticity. |
|
Calculate relative vorticity by Rust backend. |
|
Calculate horizontal divergence. |
|
Calculate horizontal divergence by Rust backend. |
|
Calculate planetary vorticity (Coriolis parameter). |
|
Calculate planetary vorticity (Coriolis parameter) by Rust backend. |
|
Calculate absolute vorticity (sum of relative and planetary vorticity). |
|
Calculate absolute vorticity (sum of relative and planetary vorticity) by Rust backend. |
Calculate stream function and velocity potential. |
|
Calculate stream function and velocity potential by Rust backend. |
|
|
Calculate stream function. |
|
Calculate stream function by Rust backend. |
|
Calculate velocity potential. |
|
Calculate velocity potential by Rust backend. |
|
Calculate irrotational and non-divergent components of the vector wind. |
|
Calculate irrotational and non-divergent components of the vector wind by Rust backend. |
|
Calculate irrotational (divergent) component of the vector wind. |
|
Calculate irrotational (divergent) component of the vector wind by Rust backend. |
|
Calculate non-divergent (rotational) component of the vector wind. |
|
Calculate non-divergent (rotational) component of the vector wind by Rust backend. |
|
Calculate Rossby wave sources (RWS). |
|
Calculate Rossby wave sources (RWS) by Rust backend. |
|
Computes the vector gradient of a scalar field on the sphere. |
|
Computes the vector gradient of a scalar field on the sphere by Rust backend. |
|
Convert packed triangular spectral coefficients to an |
|
Sum spectral power over zonal wavenumber for each total wavenumber. |
|
Plot spectral power as a function of total wavenumber. |
|
Plot a packed triangular spectral coefficient field as an m-n matrix. |
|
Plot real and imaginary parts of packed triangular spectral coefficients. |
Package Contents¶
- easyclimate.core.spec.calc_gaussian_latitudes(nlat: int)¶
Calculate the gaussian latitudes (in degrees) and quadrature weights.
Parameters¶
- nlat:
int. Number of gaussian latitudes desired.
Returns¶
The gaussian latitudes (in degrees north) and gaussian quadrature weights (
xarray.Dataset).- nlat:
- easyclimate.core.spec.calc_gaussian_latitudes_rs(nlat: int)¶
Calculate the gaussian latitudes (in degrees) and quadrature weights by Rust backend.
Parameters¶
- nlat:
int. Number of gaussian latitudes desired.
Returns¶
The gaussian latitudes (in degrees north) and gaussian quadrature weights (
xarray.Dataset).- nlat:
- easyclimate.core.spec.calc_geodesic_points(m: int)¶
Calculate the lat/lon values of the points on the surface of the sphere corresponding to a twenty-sided (icosahedral) geodesic.
Parameters¶
- m:
int. The number of points on the edge of a single geodesic triangle. There are \(10(m-1)^2+2\) total geodesic points, including the poles.
Returns¶
The latitudes and longitudes of the geodesic points (in degrees). These points are nearly evenly distributed on the surface of the sphere. (
xarray.Dataset).- m:
- easyclimate.core.spec.calc_geodesic_points_rs(m: int)¶
Calculate the lat/lon values of the points on the surface of the sphere corresponding to a twenty-sided (icosahedral) geodesic by Rust backend.
Parameters¶
- m:
int. The number of points on the edge of a single geodesic triangle. There are \(10(m-1)^2+2\) total geodesic points, including the poles.
Returns¶
The latitudes and longitudes of the geodesic points (in degrees). These points are nearly evenly distributed on the surface of the sphere. (
xarray.Dataset).- m:
- easyclimate.core.spec.calc_spherical_harmonic_coefficients(ntrunc: int)¶
Calculate indices of zonal wavenumber (indxm) and degree (indxn) for complex spherical harmonic coefficients.
Parameters¶
- ntrunc:
int. The spherical harmonic triangular truncation limit, i.e, truncation wavenumber (e.g.,
T42).
Returns¶
The latitudes and longitudes of the geodesic points (in degrees). These points are nearly evenly distributed on the surface of the sphere. (
xarray.Dataset).- ntrunc:
- easyclimate.core.spec.calc_spherical_harmonic_coefficients_rs(ntrunc: int)¶
Calculate indices of zonal wavenumber (indxm) and degree (indxn) for complex spherical harmonic coefficients by Rust backend.
Parameters¶
- ntrunc:
int. The spherical harmonic triangular truncation limit, i.e, truncation wavenumber (e.g.,
T42).
Returns¶
The latitudes and longitudes of the geodesic points (in degrees). These points are nearly evenly distributed on the surface of the sphere. (
xarray.Dataset).- ntrunc:
- easyclimate.core.spec.calc_legendre_functions(lat: float, ntrunc: int) xarray.DataArray¶
Calculate associated legendre functions for triangular truncation T(ntrunc), at a given latitude.
Parameters¶
Returns¶
\((\mathrm{ntrunc} + 1) (\mathrm{ntrunc} + 2) /2\) associated legendre functions at latitude
lat.
- easyclimate.core.spec.calc_legendre_functions_rs(lat: float, ntrunc: int) xarray.DataArray¶
Calculate associated legendre functions for triangular truncation T(ntrunc), at a given latitude by Rust backend.
Parameters¶
Returns¶
\((\mathrm{ntrunc} + 1) (\mathrm{ntrunc} + 2) /2\) associated legendre functions at latitude
lat.
- easyclimate.core.spec.transfer_grid2spectral_transform(grid_data: xarray.DataArray, grid_data_type: Literal['regular', 'gaussian'], lon_dim: str = 'lon', lat_dim: str = 'lat', ntrunc: int = None) xarray.DataArray¶
Transform grid data to spectral representation (spherical harmonic analysis).
Parameters¶
- grid_data:
xarray.DataArray. Input grid data, must contain longitude and latitude dimensions
- grid_data_type:
Type of grid (‘regular’ or ‘gaussian’)
- lon_dim:
str. Name of longitude dimension, default is
'lon'.- lat_dim:
str. Name of latitude dimension, default is
'lat'.- ntrunc:
int. Spectral truncation wavenumber, defaults to
nlat-1.
Returns¶
xarray.DataArraycontaining complex spherical harmonic coefficients with triangular spectral dimension- grid_data:
- easyclimate.core.spec.transfer_grid2spectral_transform_rs(grid_data: xarray.DataArray, grid_data_type: Literal['regular', 'gaussian'], lon_dim: str = 'lon', lat_dim: str = 'lat', ntrunc: int = None, transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Transform grid data to spectral representation (spherical harmonic analysis) by Rust backend.
Parameters¶
- grid_data:
xarray.DataArray. Input grid data, must contain longitude and latitude dimensions
- grid_data_type:
Type of grid (‘regular’ or ‘gaussian’)
- lon_dim:
str. Name of longitude dimension, default is
'lon'.- lat_dim:
str. Name of latitude dimension, default is
'lat'.- ntrunc:
int. Spectral truncation wavenumber, defaults to
nlat-1.
Returns¶
xarray.DataArraycontaining complex spherical harmonic coefficients with triangular spectral dimension- grid_data:
- easyclimate.core.spec.transfer_spectral_transform2grid(spec_data: xarray.DataArray, nlon: int, nlat: int, grid_data_type: Literal['regular', 'gaussian'], spec_dim: str = 'spec_dim', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Transform spectral data back to grid space representation (spherical harmonic synthesis)
Parameters¶
- spec_data:
xarray.DataArray. Input spectral coefficient data, must contain the spectral dimension.
- nlon:
int. Number of longitude points in output grid.
- nlat:
int. Number of latitude points in output grid.
- grid_data_type:
Type of output grid (
'regular'or'gaussian').- spec_dim:
Name of spectral dimension, default is
'spec_dim'.- lon_dim:
str. Name for output longitude dimension, default is
'lon'.- lat_dim:
str. Name for output latitude dimension, default is
'lat'.
Returns¶
xarray.DataArrayin grid space representation with(lat, lon)dimensions- spec_data:
- easyclimate.core.spec.transfer_spectral_transform2grid_rs(spec_data: xarray.DataArray, nlon: int, nlat: int, grid_data_type: Literal['regular', 'gaussian'], spec_dim: str = 'spec_dim', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Transform spectral data back to grid space representation (spherical harmonic synthesis) by Rust backend.
Parameters¶
- spec_data:
xarray.DataArray. Input spectral coefficient data, must contain the spectral dimension.
- nlon:
int. Number of longitude points in output grid.
- nlat:
int. Number of latitude points in output grid.
- grid_data_type:
Type of output grid (
'regular'or'gaussian').- spec_dim:
Name of spectral dimension, default is
'spec_dim'.- lon_dim:
str. Name for output longitude dimension, default is
'lon'.- lat_dim:
str. Name for output latitude dimension, default is
'lat'.
Returns¶
xarray.DataArrayin grid space representation with(lat, lon)dimensions- spec_data:
- easyclimate.core.spec.calc_wind_speed(u_data: xarray.DataArray, v_data: xarray.DataArray, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate the wind speed (magnitude of vector wind).
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
The wind speed (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_wind_speed_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate the wind speed (magnitude of vector wind) by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
The wind speed (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_relative_vorticity_and_horizontal_divergence(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Calculate relative vorticity and horizontal divergence.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Relative vorticity and horizontal divergence (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_relative_vorticity_and_horizontal_divergence_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Calculate relative vorticity and horizontal divergence by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Relative vorticity and horizontal divergence (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_relative_vorticity(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate relative vorticity.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Relative vorticity (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_relative_vorticity_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate relative vorticity by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Relative vorticity (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_divergence(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate horizontal divergence.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Horizontal divergence (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_divergence_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate horizontal divergence by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Horizontal divergence (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_planetary_vorticity(u_data: xarray.DataArray, v_data: xarray.DataArray, omega: float = 7.292e-05, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate planetary vorticity (Coriolis parameter).
Parameters¶
- u_data:
xarray.DataArray. The zonal component of the wind.
- v_data:
xarray.DataArray. The meridional component of vector wind.
- omega:
float. Earth’s angular velocity. The default value if not specified is \(7.292 \times 10^{-5} \mathrm{s^{-1}}\).
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Planetary vorticity (
xarray.DataArray).- u_data:
- easyclimate.core.spec.calc_planetary_vorticity_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, omega: float = 7.292e-05, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate planetary vorticity (Coriolis parameter) by Rust backend.
Parameters¶
- u_data:
xarray.DataArray. The zonal component of the wind.
- v_data:
xarray.DataArray. The meridional component of vector wind.
- omega:
float. Earth’s angular velocity. The default value if not specified is \(7.292 \times 10^{-5} \mathrm{s^{-1}}\).
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Planetary vorticity (
xarray.DataArray).- u_data:
- easyclimate.core.spec.calc_absolute_vorticity(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, omega: float = 7.292e-05, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate absolute vorticity (sum of relative and planetary vorticity).
Parameters¶
- u_data:
xarray.DataArray. The zonal component of the wind.
- v_data:
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- omega:
float. Earth’s angular velocity. The default value if not specified is \(7.292 \times 10^{-5} \mathrm{s^{-1}}\).
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Absolute vorticity (
xarray.DataArray).- u_data:
- easyclimate.core.spec.calc_absolute_vorticity_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, omega: float = 7.292e-05, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate absolute vorticity (sum of relative and planetary vorticity) by Rust backend.
Parameters¶
- u_data:
xarray.DataArray. The zonal component of the wind.
- v_data:
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- omega:
float. Earth’s angular velocity. The default value if not specified is \(7.292 \times 10^{-5} \mathrm{s^{-1}}\).
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Absolute vorticity (
xarray.DataArray).- u_data:
- easyclimate.core.spec.calc_streamfunction_and_velocity_potential(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Calculate stream function and velocity potential.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Stream function and velocity potential (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_streamfunction_and_velocity_potential_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Calculate stream function and velocity potential by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Stream function and velocity potential (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_streamfunction(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate stream function.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
stream function (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_streamfunction_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate stream function by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
stream function (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_velocity_potential(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate velocity potential.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Velocity potential (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_velocity_potential_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate velocity potential by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Velocity potential (
xarray.DataArray).- u_data
- easyclimate.core.spec.calc_helmholtz(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Calculate irrotational and non-divergent components of the vector wind.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Irrotational and non-divergent components of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_helmholtz_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Calculate irrotational and non-divergent components of the vector wind by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Irrotational and non-divergent components of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_irrotational_component(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Calculate irrotational (divergent) component of the vector wind.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Irrotational (divergent) component of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_irrotational_component_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Calculate irrotational (divergent) component of the vector wind by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Irrotational (divergent) component of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_nondivergent_component(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Calculate non-divergent (rotational) component of the vector wind.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Non-divergent (rotational) component of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_nondivergent_component_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Calculate non-divergent (rotational) component of the vector wind by Rust backend.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Non-divergent (rotational) component of the vector wind (
xarray.Dataset).- u_data
- easyclimate.core.spec.calc_rossby_wave_source(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate Rossby wave sources (RWS).
\[RWS=-\nabla \cdot \left({v}_{x}\zeta \right)=-\left(\zeta \nabla \cdot {v}_{x}+{v}_{x}\cdot \nabla \zeta \right)\]with \(\zeta\) being the absolute vorticity.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Rossby wave sources (
xarray.DataArray).Reference¶
Sardeshmukh, P. D., & Hoskins, B. J. (1988). The Generation of Global Rotational Flow by Steady Idealized Tropical Divergence. Journal of Atmospheric Sciences, 45(7), 1228-1251. https://doi.org/10.1175/1520-0469(1988)045<1228:TGOGRF>2.0.CO;2
James IN (1994) Low frequency variability of the circulation. Introduction to Circulating Atmospheres. Cambridge University Press, Cambridge, UK, pp 255–301
Trenberth, K. E., Branstator, G. W., Karoly, D., Kumar, A., Lau, N.-C., and Ropelewski, C. (1998), Progress during TOGA in understanding and modeling global teleconnections associated with tropical sea surface temperatures, J. Geophys. Res., 103(C7), 14291–14324, doi: https://doi.org/10.1029/97JC01444.
Nie, Y., Zhang, Y., Yang, X.-Q., & Ren, H.-L. (2019). Winter and summer Rossby wave sources in the CMIP5 models. Earth and Space Science, 6, 1831–1846. https://doi.org/10.1029/2019EA000674
Fuentes-Franco, R., Koenigk, T., Docquier, D. et al. Exploring the influence of the North Pacific Rossby wave sources on the variability of summer atmospheric circulation and precipitation over the Northern Hemisphere. Clim Dyn 59, 2025–2039 (2022). https://doi.org/10.1007/s00382-022-06194-4
- u_data
- easyclimate.core.spec.calc_rossby_wave_source_rs(u_data: xarray.DataArray, v_data: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.DataArray¶
Calculate Rossby wave sources (RWS) by Rust backend.
\[RWS=-\nabla \cdot \left({v}_{x}\zeta \right)=-\left(\zeta \nabla \cdot {v}_{x}+{v}_{x}\cdot \nabla \zeta \right)\]with \(\zeta\) being the absolute vorticity.
Parameters¶
- u_data
xarray.DataArray. The zonal component of the wind.
- v_data
xarray.DataArray. The meridional component of vector wind.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
Rossby wave sources (
xarray.DataArray).Reference¶
Sardeshmukh, P. D., & Hoskins, B. J. (1988). The Generation of Global Rotational Flow by Steady Idealized Tropical Divergence. Journal of Atmospheric Sciences, 45(7), 1228-1251. https://doi.org/10.1175/1520-0469(1988)045<1228:TGOGRF>2.0.CO;2
James IN (1994) Low frequency variability of the circulation. Introduction to Circulating Atmospheres. Cambridge University Press, Cambridge, UK, pp 255–301
Trenberth, K. E., Branstator, G. W., Karoly, D., Kumar, A., Lau, N.-C., and Ropelewski, C. (1998), Progress during TOGA in understanding and modeling global teleconnections associated with tropical sea surface temperatures, J. Geophys. Res., 103(C7), 14291–14324, doi: https://doi.org/10.1029/97JC01444.
Nie, Y., Zhang, Y., Yang, X.-Q., & Ren, H.-L. (2019). Winter and summer Rossby wave sources in the CMIP5 models. Earth and Space Science, 6, 1831–1846. https://doi.org/10.1029/2019EA000674
Fuentes-Franco, R., Koenigk, T., Docquier, D. et al. Exploring the influence of the North Pacific Rossby wave sources on the variability of summer atmospheric circulation and precipitation over the Northern Hemisphere. Clim Dyn 59, 2025–2039 (2022). https://doi.org/10.1007/s00382-022-06194-4
- u_data
- easyclimate.core.spec.calc_gradient(data_input: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.Dataset¶
Computes the vector gradient of a scalar field on the sphere.
Parameters¶
- data_input
xarray.DataArray The spatio-temporal data to be calculated.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
The zonal and meridional components of the vector gradient respectively (
xarray.Dataset).- data_input
- easyclimate.core.spec.calc_gradient_rs(data_input: xarray.DataArray, truncation: int = None, R: float = 6371200.0, legfunc: str = 'stored', lon_dim: str = 'lon', lat_dim: str = 'lat', transform_backend: Literal['standard', 'nogil', 'latpar'] = 'latpar') xarray.Dataset¶
Computes the vector gradient of a scalar field on the sphere by Rust backend.
Parameters¶
- data_input
xarray.DataArray The spatio-temporal data to be calculated.
- truncation:
int. Truncation limit (triangular truncation) for the spherical harmonic computation.
- R:
float. The radius in metres of the sphere used in the spherical harmonic computations. Default is 6371200 m, the approximate mean spherical Earth radius.
- legfunc:
str, ‘stored’ (default) or ‘computed’. If ‘stored’, associated legendre functions are precomputed and stored when the class instance is created. This uses \(O(\mathrm{nlat}^3)\) memory, but speeds up the spectral transforms. If ‘computed’, associated legendre functions are computed on the fly when transforms are requested. This uses \(O(\mathrm{nlat}^2)\) memory, but slows down the spectral transforms a bit.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
The zonal and meridional components of the vector gradient respectively (
xarray.Dataset).- data_input
- easyclimate.core.spec.spectral_coefficients_to_matrix(spec: xarray.DataArray, value: str = 'abs', eps: float = 1e-30, mode: str = 'spec_dim') xarray.DataArray¶
Convert packed triangular spectral coefficients to an
(m, n)matrix.The input coefficients are assumed to follow triangular spherical-harmonic ordering, where the packed dimension contains all pairs with
0 <= m <= n <= ntrunc. Cells outside the triangular domain (n < m) are filled with NaN in the returned matrix.Parameters¶
- specxr.DataArray
One-dimensional spectral coefficients. Select non-mode dimensions first, e.g.
spec_data.isel(time=0, level=0).- value{“abs”, “logabs”, “power”, “real”, “imag”}
Which quantity to place in the matrix.
- epsfloat
Small number used only for
logabs.- modestr, default: “spec_dim”
Name of the packed spectral coefficient dimension.
Returns¶
- xr.DataArray
Two-dimensional coefficient matrix with dimensions
("m", "n").
- easyclimate.core.spec.spectral_power_by_total_wavenumber(spec: xarray.DataArray, mode: str = 'spec_dim') xarray.DataArray¶
Sum spectral power over zonal wavenumber for each total wavenumber.
The returned one-dimensional spectrum is \(E(n) = \sum_m |\hat{a}_{n,m}|^2\) for packed triangular spherical-harmonic coefficients.
Parameters¶
- specxr.DataArray
One-dimensional spectral coefficients. Select non-mode dimensions first, e.g.
spec_data.isel(time=0, level=0).- modestr, default: “spec_dim”
Name of the packed spectral coefficient dimension.
Returns¶
- xr.DataArray
Spectral power indexed by total wavenumber
n.
- easyclimate.core.spec.plot_spectral_power(spec: xarray.DataArray, ax=None, logy: bool = True, grid: bool = True, **plot_kwargs)¶
Plot spectral power as a function of total wavenumber.
This function first sums the packed triangular spectral coefficients over zonal wavenumber
mwithspectral_power_by_total_wavenumber(), then draws \(E(n) = \sum_m |\hat{a}_{n,m}|^2\) against total wavenumbern.Parameters¶
- specxr.DataArray
One-dimensional packed triangular spectral coefficients. If the input data has time, level, or other non-spectral dimensions, select one slice before plotting, e.g.
spec.isel(time=0).- axmatplotlib.axes.Axes, optional
Axes used for drawing. If
None, a new figure and axes are created.- logybool, default: True
If
True, draw the spectrum with a logarithmic y-axis by callingmatplotlib.axes.Axes.semilogy(). IfFalse, callmatplotlib.axes.Axes.plot().- gridbool, default: True
Whether to add a light grid to the axes.
- **plot_kwargs
Additional keyword arguments passed to
ax.semilogyorax.plot.
Returns¶
- tuple
(fig, ax), wherefigis the Matplotlib figure andaxis the axes containing the spectrum.
- easyclimate.core.spec.plot_spectral_matrix(spec: xarray.DataArray, value: str = 'logabs', ax=None, cmap: str = 'viridis', add_colorbar: bool = True, **imshow_kwargs)¶
Plot a packed triangular spectral coefficient field as an m-n matrix.
The packed spectral dimension is reshaped to a triangular matrix whose rows are zonal wavenumber
mand columns are total wavenumbern. Matrix cells withn < mare outside the triangular spectral domain and are shown as NaN.Parameters¶
- specxr.DataArray
One-dimensional packed triangular spectral coefficients. Select any non-spectral dimensions before plotting.
- value{“abs”, “logabs”, “power”, “real”, “imag”}, default: “logabs”
Quantity to visualize:
"abs": coefficient magnitude."logabs": base-10 logarithm of coefficient magnitude."power": squared coefficient magnitude."real": real part of the coefficient."imag": imaginary part of the coefficient.
- axmatplotlib.axes.Axes, optional
Axes used for drawing. If
None, a new axes is created.- cmapstr, default: “viridis”
Matplotlib colormap used by
matplotlib.axes.Axes.imshow().- add_colorbarbool, default: True
Whether to add a colorbar for the plotted matrix.
- **imshow_kwargs
Additional keyword arguments passed to
ax.imshow. The defaults areorigin="lower"andaspect="auto"unless explicitly provided.
Returns¶
- matplotlib.axes.Axes
Axes containing the coefficient matrix image.
- easyclimate.core.spec.plot_spectral_real_imag(spec: xarray.DataArray, figsize: tuple[float, float] = (11, 4), cmap: str = 'viridis', **imshow_kwargs)¶
Plot real and imaginary parts of packed triangular spectral coefficients.
This is a convenience wrapper around
plot_spectral_matrix(). It creates a two-panel figure and drawsvalue="real"in the left panel andvalue="imag"in the right panel.Parameters¶
- specxr.DataArray
One-dimensional packed triangular spectral coefficients. Select any non-spectral dimensions before plotting.
- figsizetuple of float, default: (11, 4)
Matplotlib figure size passed to
matplotlib.pyplot.subplots().- cmapstr, default: “viridis”
Matplotlib colormap used for both matrix panels.
- **imshow_kwargs
Additional keyword arguments passed to
plot_spectral_matrix()and then toax.imshowfor both panels.
Returns¶
- tuple
(fig, ax), wherefigis the Matplotlib figure andaxis the two-element array of axes containing the real and imaginary matrices.