Giter Club home page Giter Club logo

geebap's Introduction

Best Available Pixel (Bap) Composite using the Python API of Google Earth Engine (Gee)

This code is based on Pixel-Based Image Compositing for Large-Area Dense Time Series Applications and Science. (White et al., 2014) http://www.tandfonline.com/doi/full/10.1080/07038992.2014.945827

It uses a series of pixel based scores to generate a composite with the Best Available Pixel, assuming it is the one that has better score.

License and Copyright

2017 Rodrigo E. Principe - geebap - https://github.com/fitoprincipe/geebap

This work was financed by 'Ministerio de Ambiente y Desarrollo Sustentable" (Argentine Nation) and CIEFAP (Centro de Investigación y Extensión Forestal Andino Patagónico)

Contact

Rodrigo E. Principe: [email protected]

Installation

To use this package you must have installed and running Google Earth Engine Python API: https://developers.google.com/earth-engine/python_install

Once you have that, proceed

download the latest release from https://github.com/fitoprincipe/geebap/releases

pip install geebap-(ver)-py2-none-any.whl

replace (ver) for the version you have downloaded. Example:

pip install geebap-0.0.2-py2-none-any.whl

Available Collections

  • Serie Landsat

    • Landsat 1,2 and 3: Raw collections
    • Landsat 4: TOA collection
    • Landsat 5: TOA, SR (Ledaps and USGS) collections
    • Landsat 7: TOA, SR (Ledaps and USGS) collections
    • Landsat 8: TOA, SR (USGS) collections
  • Sentinel 2

  • Modis Series (experimental)

    • Modis Aqua
    • Modis Terra

Available Scores

  • Satellite
  • Distance to clouds and shadows masks
  • Atmospheric Opacity
  • Day of the year (doy)
  • Masked pixels percentage
  • Outliers
  • Absolute value of a vegetation index

Available Indices

  • ndvi
  • evi
  • nbr

Some considerations

  • Sites size must not be too big. Works with 300 km2 tiles
  • There is a module (sites.py) that has the avility to read a list of fusion table sites from a csv file

Basic Usage

from geebap import bap, season, filters, masks, \
                   scores, satcol, functions

import ee
ee.Initialize()

# COLLECTION
col_group = satcol.ColGroup.Landsat()

# SEASON
a_season = season.Season.Growing_North()

# MASKS
cld_mask = masks.Clouds()
equiv_mask = masks.Equivalent()

# Combine masks in a tuple
masks = (cld_mask, equiv_mask)

# FILTERS
filt_cld = filters.CloudsPercent()
filt_mask = filters.MaskPercent()

# Combine filters in a tuple
filters = (filt_cld, filt_mask)

# SCORES
doy = scores.Doy()
sat = scores.Satellite()
op = scores.AtmosOpacity()
out = scores.Outliers(("ndvi",))
ind = scores.Index("ndvi")
mascpor = scores.MaskPercent()
dist = scores.CloudDist()

# Combine scores in a tuple
scores = (doy, sat, op, out, ind, mascpor, dist)

# BAP OBJECT
bap = bap.Bap(year=2010, range=(0, 0),
              season=a_season,
              colgroup=col_group,
              masks=masks,
              scores=scores,
              filters=filters)

# SITE
site = ee.Geometry.Polygon([[-71,-42],
                            [-71,-43],
                            [-72,-43],
                            [-72,-42]])

# COMPOSITE
composite = bap.bestpixel(site=site,
                          indices=("ndvi",))

# The result (composite) is a namedtuple, so
image = composite.image

# image is a ee.Image object, so you can do anything
# from here..

one_value = functions.get_value(
                        image,
                        ee.Geometry.Point([-71.9, -38.9]),
                        30)

print(one_value)

Prints:

{u'BLUE': 0.018400000408291817,
 u'bandID': 10.0,
 u'date': 14592.0,
 u'score': 0.4800287335965901,
 u'psat': 0.8500000238418579,
 u'poutlier': 1.0,
 u'pdoy': 0.010760011453995735,
 u'pop': 0.01338691782766488,
 u'NIR': 0.365200012922287,
 u'pindice': 0.934493362903595,
 u'GREEN': 0.041200000792741776,
 u'pdist': 5.749522023787777e-19,
 u'pmascpor': 0.5515608191490173,
 u'ATM_OP': 93.0,
 u'ndvi': 0.8689867258071899,
 u'RED': 0.025599999353289604,
 u'SWIR': 0.13779999315738678}

geebap's People

Stargazers

 avatar

Watchers

James Cloos avatar  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.