Open winash12 opened 3 years ago
Any update on this ? I tried changing to SHTns but that has this issue - https://bitbucket.org/nschaeff/shtns/issues/38/valueerror-nlat-must-be-even
The issue would be with this line here:
numpy.reshape(chispec, ((ntrunc+1)*(ntrunc+2)/2,1))
In python 3, the normal /
division returns a float, even when used with two integers. To have an integer result, one must use the floor division operator //
. That is, the following should work:
numpy.reshape(chispec, ((ntrunc+1)*(ntrunc+2)//2,1))
That error in particular looks like issues I found when running the example code recently.
@DWesl Great work !!!
@DWesl Would you be interested in collaborating with me on a rewrite of this package ?
I have this sample code that I am running using pyspharm and I am getting this error -
` file1 = 'uwnd_200_2020_3_10_00Z.nc' file2 = 'vwnd_200_2020_3_10_00Z.nc'
` amd I am getting this error -
Where am I going wrong ?
File "testspharm.py", line 29, in main dudx,dudy = s.getgrad(uspectral) File "/usr/local/lib/python3.8/dist-packages/spharm/spharm.py", line 878, in getgrad chispec = numpy.reshape(chispec, ((ntrunc+1)*(ntrunc+2)/2,1)) File "<__array_function__ internals>", line 5, in reshape File "/usr/local/lib/python3.8/dist-packages/numpy-1.19.1-py3.8-linux-x86_64.egg/numpy/core/fromnumeric.py", line 299, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/usr/local/lib/python3.8/dist-packages/numpy-1.19.1-py3.8-linux-x86_64.egg/numpy/core/fromnumeric.py", line 67, in _wrapfunc return _wrapit(obj, method, *args, **kwds) File "/usr/local/lib/python3.8/dist-packages/numpy-1.19.1-py3.8-linux-x86_64.egg/numpy/core/fromnumeric.py", line 44, in _wrapit result = getattr(asarray(obj), method)(*args, **kwds) TypeError: 'float' object cannot be interpreted as an integer