Skip to main content

No project description provided

Project description


water fraction from Landsat and Sentinel-2 imagery

waffls is a collection of algorithms for estimating sub-pixel surface water fraction using medium resolution satellite data. Reader classes for Landsat data (Collection-1 and Pre-Collection), Sentinel-2 (10m or 20m resolution SAFE format) and Harmonized Landsat Sentinel-2 (HLS; 10m S10 or 30m S30/L30) data are included.


waffls is built on top of gdal and a number of python libraries. To install its dependencies using conda:

conda config --add channels conda-forge
conda create -n waffls gdal rasterio joblib cython scipy scikit-learn

You can then install waffls using pip in your new environment:

conda activate waffls
pip install waffls

Or to install from source:

conda activate waffls
git clone
cd waffls
python install

Check installation and version:

python -c "import waffls; print(waffls.__version__)"


Opening a Landsat image

Using a Collection-1 Landsat TM surface reflectance image:

import waffls
infile = "LT050300272011042501T1-SC20190710095708" # input directory
img = waffls.Landsat(infile)

Various attributes are stored as object attributes:

print(img.dataset) # Landsat
print( # Acquisition date
print(img.dtype) # data type
print(img.height, img.width) # dimensions

...and more. For convenience, a rasterio-style metadata dictionary is also included:


By default, the image data is not read into memory. Do do this, use the read() method:

print(img.bands) # should be `None` = True)
print(img.bands) # OrderedDict of Image bands as numpy as arrays

To set the QA mask use the set_mask() method. Several optional boolean arguments can be set to apply a saturation (False by default), cloud (True by default), cloud_shadow (True by default), snow (True by default) and cirrus (True by default). Additionally, you can also mask pixels within a specified pixel buffer around the mask by setting buffer to an integer value (None by default).

print(img.mask) # 1 indicates mask values, 0 unmasked


DeVries, B., Huang, C-Q., Lang, M.W., Jones, J.W., Huang, W., Creed, I.F. and Carroll, M.L. 2017. Automated quantification of surface water inundation in wetlands using optical satellite imagery. Remote Sensing, 9(8):807.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waffls-0.3.3.tar.gz (132.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page