I am resampling Modis and Sentinel 2 rasters in QGIS. I am working with surface reflectance values and I am having trouble obtaining the results that I am looking for. I have isolated my rasters down to their red band surface reflectance values. I am trying to threshold these reflectance values to >0.45, while at the same time retaining the pixel value. Every method of thresholding I have attempted results in all pixels having a value of either 0.0 or 1.0. How do I retain my original reflectance values while still thresholding?

  • 1
    Welcome to GIS SE. * the results that I am looking for*... Be more specific, please. Every method of thresholding I have attempted results in all pixels having a value of either 0.0 or 1.0... Add what have you tried as an edit. Are you using raster calculator? Could be the algorithm used – aldo_tapia Feb 14 '18 at 11:52
  • I have used the raster calculator for all processing and thresholding. Basically, my final calculation is the band isolated .tif file> 0.45, but this results in the loss of all pixel reflectance values. I am looking for my pixels to be either black or white, no grey-scale, but to have values with a range of 0.0-1.0, not 0.0 or 1.0. I want the pixels to have a binary type value, either yes or no in the form of black or white, but to retain their surface reflectance value. – SnowMotivation Feb 14 '18 at 12:28
  • Welcome to gis.stackexchange! Please edit the title of your question to include enough information for future visitors to be able to find this thread when looking for the same problem. – underdark Feb 15 '18 at 17:52

If you use:

"raster@1" > 0.45

The output will be 0 or 1. 0 for a false result in condition evaluation and 1 for true.

If you want to keep values for true evaluation, use:

("raster@1" > 0.45)*"raster@1"

If you have a pixel value of 0.56, the evaluation will be:

("raster@1" > 0.45)*"raster@1"
     0.55   > 0.45)* 0.55
            1      * 0.55

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.