I have downloaded a Bunch of MODIS MOD13Q1.006 Images for my Study Area, covering a period of 4 years (same scene across time).
Now I want to calculate the Min & Max NDVI value for each Pixel, so that I can then calculate the VCI Value with future data.
Using GDAL, how do I calculate the Min & Max Value for each Pixel?
Best Answer
Using gdal in python, you could open the first file and use those values as your "base-values". Then looping over the rest of your files, comparing the base-values with the just opened values and each time selecting the maxes (or minuses). Something like this:
Using these function:
Note that:
This script would only work with the images from the same scene.
The second input in the functions get_geoinfo and open_hdf_file (all zero in the example) is used to choose which subdataset to use from the hdf-files. Have a look at the code below to make sure you select the right subdataset:
hdf_file = gdal.Open(filepath)
hdf_file.GetSubDatasets()