0

I am calculating the NDVI for Landsat-8 using the formula as shown below:- enter image description here

But the pixel value rendered is as shown below: - enter image description here

But the NDVI values need to be between -1 and +1 however, the value rendered is between 114085 and 9822.95. These values when scaled to 100000 gives value between:- 1.1 and 0.09. How can these be solved?

1
  • You did your math incorrectly.
    – Vince
    Commented Sep 21, 2023 at 13:03

1 Answer 1

2

Order of operations means your division is occurring first. Put brackets around your addition and subtraction.

(Float(NIR) - Red) / (Float(NIR) + Red)

I dropped the 2nd and last Float calls as they're not required because the NIR values are already cast to floating point so the whole operation is promoted.

6
  • I used the formula as:- (Float("LC09_L1TP_140041_20220213_20230427_02_T1_B5.TIF")-("LC09_L1TP_140041_20220213_20230427_02_T1_B4.TIF"))/(Float("LC09_L1TP_140041_20220213_20230427_02_T1_B5.TIF")+ ("LC09_L1TP_140041_20220213_20230427_02_T1_B4.TIF")) and the NDVI value rendered is between : -0.42 to 0.54 . Is that Okay? Or it must rendered value between -1 and +1.
    – Pushkar
    Commented Sep 21, 2023 at 13:18
  • 1
    That is between -1 and +1, it might well be ok that your min and max values are not reaching the limits Commented Sep 21, 2023 at 13:41
  • @bugmenot123 What actually cause this???
    – Pushkar
    Commented Sep 21, 2023 at 13:58
  • 1
    Do you understand the formula you are using? Maybe pick the values of one pixel and calculate the index manually Commented Sep 21, 2023 at 15:36
  • 1
    @bugmenot123 NDVI values can be between -1 and 1 theoretically, it just happens that in my image min/max pixel values are -0.43 and 0.54. So, this should be right as per my understanding.
    – Pushkar
    Commented Sep 21, 2023 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.