1

I'm trying to use the modeler in QGIS to calculate the NDVI on a raster image. The model is the one below:

enter image description here

In the "NDVI Calculator" algorithm I have set the parameters like this.

enter image description here

The model is working and I get a raster, but NDVI values are completely different from the result obtained with the standard raster calculator (the one that opens from the QGIS toolbar).

Could anyone help me to set it up properly?

Here is a screenshot showing differences between the result with the raster calculator and the modeler. Differences are relevant for the soil pixels, which are mostly negative or 0 for the output of the raster calculator (correct!) and positive (more than 1) for the modeler (wrong!)

enter image description here.

1
  • Does the expression "(E.astype(numpy.float64) - C) / (E + C)" solve the issue? Commented Dec 18, 2022 at 12:19

1 Answer 1

1

You are using the same raster as all of your inputs, and your raster has 5 bands. Is that right?

Then your formula is (E - C) / (E + C). If so, why are you disregarding inputs A, B and D, which correspond to bands 1, 2 and 4?

If they're not used, you should not use them as inputs.

With that said, could you post the input raster and the expected output raster?

2
  • 1
    Thank you for your reply! Yes, I'm using one raster with 5 bands. I tried to use only bands 3 and 5, without rearranging the others, but nothing changed. I'll post a screenshot with the differences between the two rasters (input and output). The most relevant ones are for pixels corresponding to the soil, which are negative or just above 0 when using the normal raster calculator, and positive (more than 1) with the modeler. The first one is obviously the correct one.
    – Enrico
    Commented Dec 17, 2022 at 17:20
  • @Enrico, could you send us the values of Band 3 and Band 5 for a set of coordinates? Let's say, 5 different coordinates. Or you can upload the raster with the 5 bands as well, so we can try to reproduce your steps. Commented Dec 17, 2022 at 21:07

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.