0

I am using MODIS data and have around 350 rasters. I have made "virtual rasters" containing them and I am wondering is there any way to change value of pixels of every raster inside virtual raster. Because NDVI MODIS data are all multiplied by 10 000 I would have to multiply now rasters with 0.0001 to get real values.

So the question is:

How can I multiply all rasters inside Virtual raster that contains 150 rasters with 0,0001 to get new pixel values?

2 Answers 2

1

Assuming you created your virtual raster with the "Build Virtual Raster (Catalog) tool in QGIS (or gdalbuildvrt), you can use the "Translate (Convert Format)..." tool to multiply by 0.0001 and output to another virtual raster.

Open the tool, set up your input and output virtual rasters, then click the edit pencil symbol and add "-ot Float32 -scale 0 10000 0 1"

Alternatively you can use gdal_translate from the command line:

gdal_translate -of vrt -scale 0 10000 0 1 -ot Float32 test_mosaic.vrt test_scaled.vrt

enter image description here

0

In python..then try GDAL to convert raster via numpy:

import numpy as np
from osgeo import gdal
ds = gdal.Open("mypic.tif")
myarray = np.array(ds.GetRasterBand(1).ReadAsArray())

no myarray will have values...you can edit them ...and then store back.

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.