Skip to main content

No project description provided

Project description

waffls


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.

Installation

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 https://github.com/bendv/waffls
cd waffls
python setup.py install

Check installation and version:

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

Examples

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.filepath)
print(img.dataset) # Landsat
print(img.date) # 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:

print(img.profile)

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

print(img.bands) # should be `None`
img.read(verbose = 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).

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

Reference

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 details)

Uploaded Source

File details

Details for the file waffls-0.3.3.tar.gz.

File metadata

  • Download URL: waffls-0.3.3.tar.gz
  • Upload date:
  • Size: 132.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for waffls-0.3.3.tar.gz
Algorithm Hash digest
SHA256 f528fee3ccfff4af60ba9428ee6dd4e92df3b1f16bb525eeaa50bb25c342b238
MD5 a97b137008bd6cac83262b79f1dd8d43
BLAKE2b-256 1386e7cbae82a199f02f671bb8b6f49cd99f3a9908068834e86d51a3c77ec4d3

See more details on using hashes here.

Supported by

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