Home

Awesome

PyFmask

The code in this repository is very much work-in-progress, very experimental. That doesn't mean you shouldn't use it, though! We encourage you to give it a try. If you have a use for FMask, we want to hear from you. Any problems, stumbling blocks, or questions can be brought up as a Github Issue that may well focus our efforts and lead to improvement of the library.

Quick Start

You will need the following installed:

We do not yet have a proper Python package. You will need to download the repository and localize it to your current working directory. I.e:

git clone https://github.com/akalenda/PyFmask.git
cd PyFmask
python3

Its use is flexible, but to get started quickly use Landsat8Scene.py's convenience methods:

from Landsat8Scene import Landsat8Scene
from Landsat8Scene import EXAMPLE_SCENE_IDS 
for scene in EXAMPLE_SCENE_IDS:
    (LandsatScene(scene)
     .download_scene_from_aws(will_overwrite=False)
     .dataframe_generate()
     .dataframe_drop_dead_pixels()
     .calculate_fmask_inputs()
     .calculate_fmask_outputs()
     .dataframe_write_series_to_geotiff('ndvi')
     .dataframe_write_series_to_geotiff('water'))

Background

Landsat8 is a remote sensing platform that orbits the Earth. It scans images of the surface in twelve spectral bands. These images are made available through the U.S. Geological Survey, as well as through a public S3 bucket on Amazon Web Services: Landsat on AWS.

Remote sensing data is useful for many applications. Google Earth, MapBox, and Libra are a few interesting examples. Other applications may be to use artificial intelligence, machine learning, and other tools to search for interesting developments such as construction, deforestation, erosion, landfills, and so on.

What is FMask? How does it fit in?

Clouds often obscure the surface phenomenae scientists are interested in. They can also introduce errors into machine learning algorithms if not accounted for. Therefore, it is desirable to remove clouds from the picture -- or at the very least ignore them.

FMask can be thought of as an expert system used to identify where clouds are in a Landsat picture. It was developed using empirical observations of clouds in remote sensing. Its creation is described in two papers:

Implementations of FMask already exist. Its authors provide a MatLab implementation and standalone binaries. There is also a python-fmask, and a C implementation.

However, for various reasons these implementations do not fulfill our needs, as will be explained in a future update to this readme.