Skip to main content

Extract an image's dataset-level mask and write to a new file.

Project description

rio-ds-mask

A Rasterio plugin for extracting an image’s dataset-level mask.

https://travis-ci.org/geowurster/rio-ds-mask.svg?branch=master https://coveralls.io/repos/github/geowurster/rio-ds-mask/badge.svg?branch=master

Usage

$ rio ds-mask --help
Usage: rio ds-mask [OPTIONS] INPUT OUTPUT

  Extract an image's dataset-level mask.

  If '--driver' is not given the input driver is used.

Options:
  -f, --format, --driver TEXT  Output format driver
  --co, --profile NAME=VALUE   Driver specific creation options.See the
                               documentation for the selected output driver
                               for more information.
  --help                       Show this message and exit.

This example command creates a singleband uint8 image that is acceptable to use as a GDAL mask band, meaning that pixels with a value of 255 are transparent and pixels with a vaue of 0 are opaque. The image is losslessly compressed and internally tiled.

$ rio ds-mask \
    --driver GTiff \
    tests/data/alpha.tif \
    mask.tif \
    --co COMPRESS=DEFLATE \
    --co TILED=YES

Installing

First install Rasterio, then:

$ pip install rio-ds-mask --user

Developing

$ git clone https://github.com/geowurster/rio-ds-mask.git
$ cd rio-ds-mask
$ pip install -e .\[all\]
$ pytest --cov rio-ds-mask --cov-report term-missing

License

See LICENSE.txt

Changelog

See CHANGES.md

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

rio-ds-mask-1.1.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

rio_ds_mask-1.1-py2.py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 2 Python 3

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