Expand a set of irregularly sampled data points into spherical harmonics using a least squares inversion.
chi2 = SHExpandLSQ (
cilm: float, dimension (2,
- The real spherical harmonic coefficients of the function. The coefficients
C1lmrefer to the cosine (
Clm) and sine (
Slm) coefficients, respectively, with
- The residual sum of squares misfit for an overdetermined inversion.
d: float, dimension (
- The value of the function at the coordinates (
lat: float, dimension (
- The latitude in DEGREES corresponding to the value in
lon: float, dimension (
- The longitude in DEGREES corresponding to the value in
- The maximum spherical harmonic degree of the output coefficients
norm: optional, integer, default = 1
- 1 (default) = Geodesy 4-pi normalized harmonics; 2 = Schmidt semi-normalized harmonics; 3 = unnormalized harmonics; 4 = orthonormal harmonics.
csphase: optional, integer, default = 1
- 1 (default) = do not apply the Condon-Shortley phase factor to the associated Legendre functions; -1 = append the Condon-Shortley phase factor of (-1)^m to the associated Legendre functions.
SHExpandLSQ will expand a set of irregularly sampled data points into spherical harmonics by a least squares inversion. When there are more data points than spherical harmonic coefficients (i.e.,
nmax>(lmax+1)**2), the solution of the overdetermined system will be determined. If there are more coefficients than data points, then the solution of the underdetermined system that minimizes the solution norm will be determined. See the LAPACK documentation concerning DGELS for further information.
The employed spherical harmonic normalization and Condon-Shortley phase convention can be set by the optional arguments
csphase; if not set, the default is to use geodesy 4-pi normalized harmonics that exclude the Condon-Shortley phase of (-1)^m.