jswhit / pyspharm

Automatically exported from code.google.com/p/pyspharm
Other
33 stars 18 forks source link

Nans after call to grdtospec #10

Open leohaim opened 1 year ago

leohaim commented 1 year ago

Hi, When I use pyspharm with a Gaussian grid of 960x1920, the resulting field (sh in the example below) contains some NaNs. I believe this is a limitation because pyspharm is implemented with float32. If it were implemented with float64 higher truncations would be possible.

If you could compile it with float64 to allow both precisions that would be very much appreciated.

Below is the example code:

erad=6370470. lmax=959 lnsp=np.zeros((lmax+1,2(lmax+1))) x = spharm.Spharmt(2(lmax+1),(lmax+1),rsphere= erad,gridtype='gaussian', legfunc='stored') sh = x.grdtospec(lnsp)#, ntrunc=lmax) print(sh[-1])

result: nan+nanj

With lmax=639 I get 0, as expected