Since QGIS multiplies the image with the scale factor when reading, it messes up the image if the scale factor is not properly defined to the data as QGIS expected. For example, I am reading MODIS NDVI into QGIS and array is int16. Int16 range is between (-32768, 32767). Range of input data values are between -2000 and 10000 and the scale factor is 10000. QGIS multiplies the array with 10000 and values go beyond the acceptable range of int16 and QGIS rescales the pixel values and make them between (-32768, 32767). In the end, you can not fix the problem by dividing it by the scale factor because values are rescaled once they go beyond int16 range. Is there any possibility make QGIS not apply the scale factor to the data?

download the data and extract NDVI sublayer http://e4ftl01.cr.usgs.gov/MOLT/MOD13A2.005/2009.07.28/MOD13A2.A2009209.h10v06.005.2009228232821.hdf

My recommendation to QGIS guys. You shouldn't worry about scale factor because you don't know how it is defined (either multiplication or division).

  • If you use the raster calculator to divide by 10000, you get a correct output layer. I'm not sure if this is a QGIS or GDAL error. Anyway, we discussed it already at gis.stackexchange.com/questions/158949/…
    – AndreJ
    Sep 29, 2015 at 5:44
  • @AndreJ, the problem is that int16 can take no values beyond this range, (-32768, 32767). However, when you multiply input array with 10000, pixels values goes beyond the int16 range and in the end, QGIS rescales the pixel values and make them in the range.Eventually, you can not get real values by dividing them 10000.
    – aly
    Sep 29, 2015 at 16:27
  • This seems to work differently in QIS 2.8.3 and 2.10. In the first one, multiplying by 1 removes the scaling, and the range is between -703 and 8601. Divinding by 10000 and saving to a tif gives correct values between -0.07324 and 0.860118. With QGIS 2.10, you need 100000000 to get the right range.
    – AndreJ
    Sep 29, 2015 at 19:32
  • @AndreJ, For example, if the value is originally 1000 in the input, QGIS multiplies it by the scale factor, 10000, the results should be 10000000. However, data type is integer16, the array cannot have that value, QGIS rescales that value to make it between int16 range, (-32768, 32767). Therefore, you can not get the correct values by dividing it by the scalefactor. that is the problem and solution is not easy.
    – aly
    Sep 29, 2015 at 19:57


Your Answer

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

Browse other questions tagged or ask your own question.