GithubHelp home page GithubHelp logo

bryanlandia / pymasker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from haoliangyu/pymasker

0.0 1.0 0.0 35 KB

generate masks from Landsat 8 and MODIS land product QA band

License: Apache License 2.0

Python 100.00%

pymasker's Introduction

pymasker

Pymasker is a python package to generate various masks from the Landsat 8 Quality Assessment band and MODIS land products.

Installation

The package can be shipped to your computer using pip.

pip install pymasker

Or just install it with the source code.

python setup.py install

This package depends on numpy and GDAL.

An ArcMap python toolbox based on this package could be find here.

Use Example

Python

For Landsat 8 Quality Accessment band

from pymasker import LandsatMasker
from pymasker import LandsatConfidence

# load the QA band directly
masker = LandsatMasker('LC80170302014272LGN00_BQA.TIF')

# algorithm has high confidence that this condition exists (67-100 percent confidence)
conf = LandsatConfidence.high

# Get mask indicating cloud pixels with high confidence
mask = masker.get_cloud_mask(conf)

# save the result
masker.save_tif(mask, 'result.tif')

For MODIS land products

from pymasker import ModisMasker
from pymasker import ModisQuality

# load the QA band directly
masker = ModisMasker('MOD09GQ.A2015025.h12v04.005.2015027064556.hdf')

# Corrected product produced at ideal quality for all bands.
quality = ModisQuality.high

# Create a MODIS QA masker
mask = masker.get_qa_mask(quality)

# save the result
masker.save_tif(mask, 'result.tif')

Command Line

pymasker -s landsat -i landsat.tif -o mask.tif -c high -t cirrus

General parameters:

-s, --source SOURCE
                      source type: landsat, modis
-i, --input INPUT
                      input image file path
-o, --output OUTPUT
                      output raster path

Landsat parameters:

-c, --confidence CONFIDENCE
                      level of confidence that a condition exists in a landsat image: high, medium, low, undefined, none
-t, --target TARGET
                      target object: cloud, cirrus, water, vegetation, snow

MODIS parameters:

-q, --quality QUALITY
                      Level of data quality of MODIS land products at each pixel: high, medium, low, low_cloud

More Detail

The following two articles explains the mechanism behind the tool in detail.

For JavaScript Developer

node-qa-masker provides the same masking functionality in NodeJS.

Change Log

  • 0.3.2

    • Add get_fill_mask() to LandsatMasker (thanks to kbasten)
  • 0.3.1

    • Simplify the initialization of ModisMasker
  • 0.3.0

    • BREAKING CHANGE change most class and function names according to pep8
    • add command line tool

pymasker's People

Contributors

haoliangyu avatar kbasten avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.