I'm attempting to reduce a raster layer, wherein each point represents night-time luminosity/intensity of city lights, to include only those pixels with values in the top 10% of values. Effectively, I'm hoping to generate a new raster layer that only includes the brightest points. I'd imagine I could do so via some sort of 90% quintile masking specification but am at a loss as to how this might be accomplished in QGIS. Doing so via the expression table for a vector layer makes sense to me, but how might this be done in the case of a raster?
It's easy to mask specific raster values in the Layer Styling panel.
Option one: when the raster has a wide range of values
- Choose "Singleband Gray" or Singleband Pseudocolor"
- Expand the Min / Max Value Settings section, choose "Cumulative count cut" and enter 90% for the min value, and 100% for the max value
- Choose the Contrast Enhancement setting that works best for you (I think you'll want "stretch and clip to min/max" but try them all and see what you like).
Option two: when the raster has only a few values
- Choose "Paletted / Unique Values"
- Click "Classify"
- Select and remove the values that you don't want to see
Note: It's also possible to create a new raster layer without the masked values using the Raster Calculator.