# fluidsht.sht2d.operators¶

## Operators 2D (fluidfft.sht2d.operators)¶

class fluidsht.sht2d.operators.OperatorsSphereHarmo2D(nlat=None, nlon=None, lmax=15, norm='orthonormal', cs_phase=False, grid_type='gaussian', radius=1, sht=None)[source]

Bases: object

Perform 2D SHT and operations on data.

Parameters
nlatint

Global dimension over the theta-axis (?? dimension for the real arrays).

nlonint

Global dimension over the phi-axis (?? dimension for the real arrays).

lmaxint

Truncation degree.

normstr

Normalization for SHT transforms. See options_norm in the respective modules for available options.

cs_phasebool

Disable (default) or enables the Condon-Shortley phase factor to the associated Legendre functions;

sht: str or SHT classes

Name of module or string characterizing a method. It has to correspond to a module of fluidsht. The first part “fluidsht.” of the module “path” can be omitted.

Notes

Some of the class attributes and their equivalent mathematical definitions

$\begin{split}\texttt{l2_idx} &= l(l+1) \\ \texttt{K2} &= \frac{l(l+1)}{r^2} &= -\Delta \\ \texttt{K2_r} &= \texttt{K2} \times r &= \frac{l(l+1)}{r} \\ \texttt{inv_K2_r} &= \texttt{K2_r}^{-1} &= \frac{r}{l(l+1)}\end{split}$

where, $$\Delta = \nabla^2 :=$$ Laplacian operator.

nlm: int = None
K2: Af = None
inv_K2_not0
K2_r

Compute $$r \Delta = [l(l+1)] / r$$

inv_K2_r

Compute $$(r \Delta)^{-1} = r / [l(l+1)]$$

where_l2_idx_positive
copyattr(self, attr)[source]

Copies attributes / methods from opsht instance.

laplacian_sh(self, a_lm: 'complex128[:]', negative: bool = False)[source]

Compute the Laplacian, $$\nabla^{n} a^{lm}$$

Parameters
a_lmndarray
negative: bool, optional

Negative of the result.

invlaplacian_sh(self, a_lm: 'complex128[:]', negative: bool = False)[source]

Compute the Laplacian, $$\nabla^{n} a^{lm}$$

Parameters
a_lmndarray
negative: bool, optional

Negative of the result.

divrotsh_from_vsh(self, uD_lm: 'complex128[:]', uR_lm: 'complex128[:]', div_lm: 'complex128[:] or None' = None, rot_lm: 'complex128[:] or None' = None)[source]

Compute divergence and curl from vector spherical harmonics uD, uR (div_lm and rot_lm are overwritten).

vsh_from_divrotsh(self, div_lm: 'complex128[:]', rot_lm: 'complex128[:]', uD_lm: 'complex128[:] or None' = None, uR_lm: 'complex128[:] or None' = None)[source]

Compute VSH from divergence and curl spherical harmonics div_lm, rot_lm (uD_lm and uR_lm are overwritten).

vec_from_divrotsh(self, div_lm, rot_lm, u=None, v=None)[source]

Velocities u, v from horizontal divergence, and vertical vorticity (u and v are overwritten).

vec_from_rotsh(self, rot_sh, u=None, v=None)[source]

Velocities u, v from vertical vorticity alone (u and v are overwritten).

vec_from_divsh(self, div_sh, u=None, v=None)[source]

Velocities u, v from horizontal divergence alone (u and v are overwritten).

divrotsh_from_vec(self, u, v, div_lm=None, rot_lm=None)[source]

Compute horizontal divergence, and vertical vorticity from u, v (div_lm and rot_lm are overwritten).

Functions

 get_simple_2d_method() Easily select an available SHT library.

Classes

 OperatorsSphereHarmo2D([nlat, nlon, lmax, …]) Perform 2D SHT and operations on data.