A Fortran example program that performs backward and forward Spherical Harmonic Transforms using SHTns. Compile using :
- See Also
- Fortran API.
-
Using SHTns with Fortran 77
25 integer*4 lmax, mmax, mres
31 complex*16,
allocatable :: slm(:), tlm(:)
32 real*8,
allocatable :: sh(:,:), th(:,:)
44 call shtns_calc_nlm(nlm, lmax, mmax, mres)
54 layout = sht_phi_contiguous
55 call shtns_init_sh_gauss(layout, lmax, mmax, mres, nlat, nphi)
66 call shtns_print_cfg()
69 allocate ( slm(1:nlm), tlm(1:nlm) )
70 allocate ( sh(1:nphi,1:nlat), th(1:nphi,1:nlat) )
74 call shtns_lmidx(lm, 1, 0)
79 call shtns_sh_to_spat(slm, sh)
88 call shtns_spat_to_sh(sh, slm)
95 do m=0, mres*mmax, mres
97 call shtns_lmidx(lm,m,m)
98 print*,slm(lm : lm+(lmax-m))
103 call shtns_lmidx(lm, m, m)
105 call shtns_sh_to_spat_ml(m/mres, slm(lm), tlm, lmax)
107 print*,
'spectral m=', m
108 print*,slm(lm : lm+lmax-m+1)
109 print*,
'spatial m=', m