8

I have an NDVI-Time series (24 tiffs from one year). What I would like to calculate is one single Raster with the Maximum NDVI-value for each pixel from all 24 images. I thought about using gdalcalc but I cannot find the right syntax to calculate the maximum of a my inputfiles:

Example for 2 Layers:

shell("E:/Programme/OSGeo4W.bat; gdal_calc -A E:/IVFL/Somalia/NDVI/201401_001_NDVI_NAfill.tif -B E:/IVFL/Somalia/NDVI/201409_121_NDVI_NAfill.tif --outfile E:/IVFL/Somalia/NDVI_maximum.tif --calc=(max(A,B))")

calc=max(A,B) always gives me an error.

And in the end I even have 24 input files and not only 2. Does anyone know the syntax (numpy) to calculate the maximum?

Kersten
10k3 gold badges39 silver badges59 bronze badges
asked Dec 19, 2016 at 11:34
1

2 Answers 2

7

you must use maximum instead of max

--calc="maximum(A,B)"
Kersten
10k3 gold badges39 silver badges59 bronze badges
answered Dec 19, 2016 at 11:56
2
  • Thank you so much. It's working now for 3 layers! May you also now how to do it for all 24. When I add --calc=maximum(A,B,C,D,E,F...) there are to many variables. For now I already runned a loop to to stepwise always 3 layers, but it would be interessting if there is a more straightforward approach? Commented Dec 19, 2016 at 15:29
  • for large images, I use the OTB library. You also need to write your expression with all bands, but I've done min max with 12 bands over large areas, and it should work with more because it works in streaming. Commented Dec 19, 2016 at 19:41
2

You can combine multiple pairwise maximum(A,B) function into one long function.

--calc="maximum(maximum(maximum(A,B),maximum(C,D)),maximum(maximum(E,F),maximum(G,H)))"
answered Nov 10, 2020 at 11:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.