ajdawson / windspharm

A Python library for spherical harmonic computations on vector winds.
http://ajdawson.github.io/windspharm
MIT License
82 stars 36 forks source link

numpy.float64 object cannot be interpreted as an index #93

Closed Xunius closed 6 years ago

Xunius commented 6 years ago

Hi Andrew,

Thanks for the feedbacks. I found this error when issuing w=VectorWind(u,v) where u and v are global winds from ERA-I, both being 2D slabs (lat, lon). It seems that when inputs are both 2D, line 93 in cdms.py gives this error because np.prod(u.shape[2:]) gives 1.0, thus making an numpy.float64 in the reshape arg.

My numpy is 1.13.3, windspharm 1.5.1

I guess a possible fix is to use np.prod(u.shape[2:]).astype('int')

Guangzhi

ajdawson commented 6 years ago

Thanks. This is already fixed on the master branch but not included in a release yet.