I have 10 geotiffs Modis ndvi named 2005.tif ... 2014.tif I want to stack them all and create timeseries. i know how to do that, but the stacked images still need scaling by 0.0001. how can i bulk scale them using gdal -scale function before stacking them?

Tried the first line on OSGeo, but when openning the new tifs all I can see is 0s and 1s. any idea?


In Windows (run OSGeo4W shell):


for %i in (*.tif) DO gdal_translate -scale -2000 10000 -0.2 1 %i outputs\%i

You might find recalculating instead better:

for %i in (*.tif) DO gdal_calc.bat -A %i --outfile=outputs\%i --calc="A*0.0001" --NoDataValue=0

In Ubuntu looping through files is slightly different:

for i in *.tif; do
    gdal_calc -A $i ...
  • Tried the -scale -2000 10000 -0.2 1 but it gave me a tif with only 0 and 1 as output, nothing in between. – Theo Eurotrip Nov 3 '15 at 2:01
  • try setting -ot Float32 – Maxim Dubinin Nov 3 '15 at 6:00

Your Answer

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

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