I have to work with numerous Landsat surface reflectance product that I downloaded from http://landsat.usgs.gov/CDR_LSR.php. The product comes with a QA data with information on clouds and shadows that can be used to mask the data. Has anyone here used python to apply these mask or know of any working libraries.
you can embed Orfeo Toolbox in Python in order to process your remote sensing data, including applying masks. There is a Python interface for OTB and the Bandmath can be used to apply a mask.