ceholden / yatsm

Yet Another Time Series Model
https://yatsm.readthedocs.org/en/latest/
MIT License
63 stars 30 forks source link

changes.py: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0 #83

Closed valpasq closed 8 years ago

valpasq commented 8 years ago

Was trying to create change map products using yatsm changemap, encountered a VisibleDepreciationWarning.

Quick search revealed this could be due to updating numpy: http://stackoverflow.com/questions/33098765/visibledeprecationwarning-boolean-index-did-not-match-indexed-array-along-dimen

Updated changes.py, line 169 from py = rec['py'][np.in1d(px, rec['px'])]

to py = rec['py'][np.where(np.in1d(px, rec['px']))]

Seems to have fixed the problem. Code is running, and maps look good.

Pulled the most updated version of yatsm, then fixed in my fork with commit dff0052

If this is a good fix, I can submit a pull request.

ceholden commented 8 years ago

Should be fixed in v0.6.0 release. Your solution was a good bandaid, but the problem was much more serious than could be addressed without some major surgery. The new algorithm for calculating the number of changes per pixel should be more straightforward to understand, faster, and more reliable, but it requires us to bump to NumPy>=1.9.0 to get the new np.unique features utilized.