How to mask Landsat 8 images cloud cover using python

January 11, 20241 min read

Remote sensing provides a cost-free and less resource-intensive method to acquire spatial data for various purposes. However, it’s not without its challenges. One major challenge of using satellite imagery is cloud cover. Cloud cover has the potential to drastically reduce the quality of spatial data analysis in turn giving inaccurate information. One way to address cloud cover is to filter it out. This means that a certain threshold for percentage cloud cover is set and if an image does not meet the threshold, the satellite image is not used for analysis. Alternatively, cloud cover can also be removed through cloud masking. Cloud masking is the process by which individual pixels considered to be clouds are removed from the image by equalizing the pixel value of cloud to zero. This allows you to retain the entire image while eliminating cloud interference.

This tutorial demonstrates how to perform cloud masking on Landsat 8 images using the Python programming language.

  • Defining a function to mask clouds as well as applying scaling factors.                    

  • Acquiring Landsat images from Google Earth Engine and applying the function

Bonus tip : 

As a result of applying the scaling factor on the thermal bands (as shown in step 1), the temperature values have now been converted to Kelvin. From there, you only need to subtract 273.15 from the values to get the temperatures in degrees Celsius. This is particularly useful when you need surface temperature in Kelvin or degrees Celsius.


Landsat 8Pythonsatellite imagery

Join the community!

We're a place where geospatial professionals showcase their works and discover opportunities.

Explore More Articles