1

I work with Sentinel-2 images. I wanted to plot a histogram of a cloudmask, but it showed non-existent values.

I used the MSK_CLDPRB_20m.jp2 layer, which is a raster that shows the probability of there being a cloud on that pixel. This is a value between 0 (no clouds) and 100 (clouds). When classifying the symbology (unique values), Qgis says there are only values between 0 and 100. When manually inspecting I also wasn't able to find any values higher than 100.

But when I plot the histogram of the layer, it shows the following. enter image description here 'Frequentie' = Frequency, 'Pixelwaarde' = Pixelvalue

This specific image doesn't contains that much clouds, so the value 0 is present a lot (which is expected). The problem is that it also shows there are values above 100?

What's the reason for this?

I use QGIS 3.22.5

5
  • Have you tried using the Raster Calculator to remove any value superior to 100 and then plot the histogram again? (with an expression such as IF(raster_name > 100, raster_name*0, raster_name), to set all values superior to 100 to 0 for instance)
    – Sken2107
    Commented Jun 15, 2022 at 7:59
  • Same observation here forum.step.esa.int/t/what-exactly-is-in-msk-cldprb/23908/2. Could there be calibration involved somewhere, telling that min raw value means 0 and max raw value means 100? Does gdalinfo show anything about scale and offset?
    – user30184
    Commented Jun 15, 2022 at 8:39
  • By developers.google.com/earth-engine/datasets/catalog/… value 100 should be the maximum. Compare QGIS with gdalinfo -stats. I wonder if QGIS is using some overview level of the image for making the computation of the histogram faster.
    – user30184
    Commented Jun 15, 2022 at 8:53
  • 1
    I used the Raster Calculator to remove values higher than 100. After this the histogram did show up correctly without any values higher than 100.
    – Niek
    Commented Jun 15, 2022 at 10:35
  • I used gdalinfo - stats to look at the file. GDAL doesn't show anything about scale or offset. It does specify a min and max of 0.000 and 100.000 which is correct...
    – Niek
    Commented Jun 15, 2022 at 10:52

1 Answer 1

0

I found that using the raster calculator option to set all the values below/above one specific value to 0 produces a nice histogram

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jul 28, 2023 at 5:31

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.