I'm working on satellite image processing, I'm calculating NDVI for time series analysis and vegetation prediction. I'm having a tough time removing the noisy data like,

  1. Cloud coverage
  2. Haze
  3. Cloud shadow

on Landsat-8 satellite image bands.

Is there any way to do this in Python?

I came across fmask package in python to mask cloud coverage but wasn't clear how to use it.

Then used pymakser but was only able to create a separate cloud mask file using BQA band of Landsat-8 but couldn't apply the mask on the image bands.

Finally tried using rio-cloud mask package but wasn't able to create the pre-requisite top of atmosphere reflectance for landsat-8 bands.

Also it'll be great if there's a method to just use the BQA band of Landsat-8 to remove noisy data from the TIF files using python.

  • Welcome to GIS SE! As a new user, you might want to take the Tour to get accustomed with i.a. the requirements of a question that seeks help in producing code/scripts; most importantly, to aid you in coding people usually want to see at least a minimum of your work and/or research so far. Do you have any code snippets that don´t work, or can refer to some sources you tried to implement maybe? Also, be as specific as you can about the tools/software you intend to use. You can always edit your question to include more information.
    – geozelot
    Jun 15 '18 at 8:25

Hi for anyone landing here in 2021 or later. Handling the QA masks in Landsat and other remote sensing data is indeed a pain, so I made a small package just for that.

unpackqa: A python package for QA/QC bit unpacking and labeling in earth science data products

Full Documentation

Here is a short example, given a numpy array, img_qa_data which is the data from a Landsat 8 image QA band, you can create a cloud mask like so:

cloud_only_mask = unpackqa.unpack_to_array(img_qa_data, 

plt.imshow(cloud_only_mask, interpolation='none')

enter image description here

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.