Large error in Vector Spherical Harmonic transform for Functions with longitudinal angle dependence.
Issue #33
resolved
The spectral components computed and reconverted into velocity are not giving me back the exact velocity whenever there is a functional dependence on 'phi' in the field.I attach the code here.It works whenever there is functional dependence on 'theta' .'Theta' and 'phi' are the grid coordinates on my sphere as defined in my code below.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import shtns
lmax = 26
mmax=lmax
sht = shtns.sht(lmax, mmax)
nlats, nlons = sht.set_grid()
theta_vals = np.arccos(sht.cos_theta)
phi_vals = (2.0*np.pi/nlons)*np.arange(nlons)
phi, theta = np.meshgrid(phi_vals, theta_vals)
vtheta = np.ones_like(phi)
vphi = np.ones_like(phi)
vpsi_lm, vphi_lm = sht.analys(vtheta,vphi)
utheta, uphi = sht.synth(vpsi_lm,vphi_lm)
print((utheta-vtheta).max())
print((uphi-vphi).max())
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- Log in to comment
This is not a bug, but a feature (tm) of Spherical Harmonics. A (vector) field on the sphere must have some regularity conditions near the poles. It is your responsibility to provide proper spatial data. See also other similar questions that come up frequently.