I am stuck with my Python Script. The case is, I have an array of floating numbers from 0 to 1 (NDVI values). I want to loop over my array with an interval/step of every 0.025. Every interval/step I have to calculate something a+(b*element in the loop).

vNdvi = one dimensional array of NDVI values coming from a MODIS image

rNdvi = vNdvi[np.logical_and(vNdvi>=0.3, vNdvi<0.8)]

  • if your values are 0 to 1 by 0.025 that's 40 increments.. create a range of 40 for your steps then search through until you find the value you want, add 0.025 to the expected value and search again. – Michael Stimson May 6 '15 at 2:45
  • Hi Michael, thanks for the good suggestion. Will definitely try it. Never thought of it, my mind was locked up in range function. – user32145 May 7 '15 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.