gen_harmonics

  • Converts data from the spatial domain to spherical harmonic coefficients

  • Does not compute the solid Earth elastic response or convert units

Calling Sequence

from gravity_toolkit.gen_harmonics import gen_harmonics
from gravity_toolkit.associated_legendre import plm_holmes
PLM, dPLM = plm_holmes(LMAX, np.cos(th))
Ylms = gen_harmonics(data, lon, lat, LMAX=LMAX, PLM=PLM)

Source code

gravity_toolkit.gen_harmonics(data, lon, lat, **kwargs)[source]

Converts data from the spatial domain to spherical harmonic coefficients

Parameters:
data: np.ndarray

data magnitude

lon: np.ndarray

longitude array

lat: np.ndarray

latitude array

LMAX: int, default 60

Upper bound of Spherical Harmonic Degrees

MMAX: int or NoneType, default None

Upper bound of Spherical Harmonic Orders

PLM: np.ndarray, default 0

Fully normalized associated Legendre polynomials or Fourier coefficients of Legendre polynomials

METHOD: str, default ‘integration’

Conversion method for calculating harmonics

  • 'integration': for global grids

  • 'fourier': for regional or global grids

Returns:
clm: np.ndarray

cosine spherical harmonic coefficients (4-pi normalized)

slm: np.ndarray

sine spherical harmonic coefficients (4-pi normalized)

l: np.ndarray

spherical harmonic degree to LMAX

m: np.ndarray

spherical harmonic order to MMAX

gravity_toolkit.gen_harmonics.integration(data, lon, lat, LMAX=60, MMAX=None, PLM=0, **kwargs)[source]

Converts data from the spatial domain to spherical harmonic coefficients

Parameters:
data: float

data magnitude

lon: float

longitude array

lat: float

latitude array

LMAX: int, default 60

Upper bound of Spherical Harmonic Degrees

MMAX: int or NoneType, default None

Upper bound of Spherical Harmonic Orders

PLM: float, default 0

input Legendre polynomials

Returns:
clm: float

cosine spherical harmonic coefficients

slm: float

sine spherical harmonic coefficients

l: int

spherical harmonic degree to LMAX

m: int

spherical harmonic order to MMAX

gravity_toolkit.gen_harmonics.fourier(data, lon, lat, LMAX=60, MMAX=None, PLM=0, **kwargs)[source]

Computes the spherical harmonic coefficients of a spatial field

Parameters:
data: float

data magnitude

lon: float

longitude array

lat: float

latitude array

LMAX: int, default 60

Upper bound of Spherical Harmonic Degrees

MMAX: int or NoneType, default None

Upper bound of Spherical Harmonic Orders

PLM: float, default 0

input Fourier coefficients of Legendre polynomials

Returns:
clm: float

cosine spherical harmonic coefficients

slm: float

sine spherical harmonic coefficients

l: int

spherical harmonic degree to LMAX

m: int

spherical harmonic order to MMAX