Correction needed in snappy_ndvi.py example file


#1

Hello!

I stumbled on bug in snappy_ndvi.py file that is shown in "How to use the SNAP API from Python " step “Using the SNAP Java API from Python”. Original file gave me overflow error. It seems that in some point default Numpy int type changed from int32 to int64.

The solution is to edit line 67. Originally it is like this:

ndviFlagsBand.writePixels(0, y, width, 1, ndviFlags)

to this

ndviFlagsBand.writePixels(0, y, width, 1, ndviFlags.astype(numpy.int32))

My system is Ubuntu 16.04.3 LTS, Python 3.5.2, numpy 1.13.1, SNAP 5.


#2

I was not able to reproduce your error, but I can’t see anything wrong in explicitly stating the data type - especially since int64 seems to give wrong results. Thanks for pointing out!