SkillAgentSearch skills...

Eemont

A python package that extends Google Earth Engine.

Install / Use

/learn @davemlz/Eemont

README

<p align="center"> <a href="https://github.com/davemlz/eemont"><img src="https://raw.githubusercontent.com/davemlz/eemont/master/docs/_static/header2.png" alt="header"></a> </p> <p align="center"> <em>A python package that extends Google Earth Engine</em> </p> <p align="center"> <a href='https://pypi.python.org/pypi/eemont'> <img src='https://img.shields.io/pypi/v/eemont.svg' alt='PyPI' /> </a> <a href='https://anaconda.org/conda-forge/eemont'> <img src='https://img.shields.io/conda/vn/conda-forge/eemont.svg' alt='conda-forge' /> </a> <a href="https://opensource.org/licenses/MIT" target="_blank"> <img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"> </a> <a href='https://eemont.readthedocs.io/en/latest/?badge=latest'> <img src='https://readthedocs.org/projects/eemont/badge/?version=latest' alt='Documentation Status' /> </a> <a href="https://github.com/davemlz/eemont/actions/workflows/tests.yml" target="_blank"> <img src="https://github.com/davemlz/eemont/actions/workflows/tests.yml/badge.svg" alt="Tests"> </a> <a href="https://github.com/sponsors/davemlz" target="_blank"> <img src="https://img.shields.io/badge/GitHub%20Sponsors-Donate-ff69b4.svg" alt="GitHub Sponsors"> </a> <a href="https://www.buymeacoffee.com/davemlz" target="_blank"> <img src="https://img.shields.io/badge/Buy%20me%20a%20coffee-Donate-ff69b4.svg" alt="Buy me a coffee"> </a> <a href="https://ko-fi.com/davemlz" target="_blank"> <img src="https://img.shields.io/badge/kofi-Donate-ff69b4.svg" alt="Ko-fi"> </a> <a href="https://developers.google.com/earth-engine/tutorials/community/developer-resources" target="_blank"> <img src="https://img.shields.io/badge/GEE%20Community-Developer%20Resources-00b6ff.svg" alt="GEE Community"> </a> <a href="https://twitter.com/dmlmont" target="_blank"> <img src="https://img.shields.io/twitter/follow/dmlmont?style=social" alt="Twitter"> </a> <a href='https://joss.theoj.org/papers/34696c5b62c50898b4129cbbe8befb0a'> <img src='https://joss.theoj.org/papers/34696c5b62c50898b4129cbbe8befb0a/status.svg' alt='JOSS' /> </a> <a href="https://github.com/psf/black" target="_blank"> <img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Black"> </a> <a href="https://pycqa.github.io/isort/" target="_blank"> <img src="https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336" alt="isort"> </a> </p>

GitHub: https://github.com/davemlz/eemont

Documentation: https://eemont.readthedocs.io/

PyPI: https://pypi.org/project/eemont/

Conda-forge: https://anaconda.org/conda-forge/eemont

Tutorials: https://github.com/davemlz/eemont/tree/master/docs/tutorials

Paper: https://joss.theoj.org/papers/10.21105/joss.03168


Overview

Google Earth Engine is a cloud-based service for geospatial processing of vector and raster data. The Earth Engine platform has a JavaScript and a Python API with different methods to process geospatial objects. Google Earth Engine also provides a HUGE PETABYTE-SCALE CATALOG of raster and vector data that users can process online (e.g. Landsat Missions Image Collections, Sentinel Missions Image Collections, MODIS Products Image Collections, World Database of Protected Areas, etc.). The eemont package extends the Google Earth Engine Python API with pre-processing and processing tools for the most used satellite platforms by adding utility methods for different Earth Engine Objects that are friendly with the Python method chaining.

Google Earth Engine Community: Developer Resources

The eemont Python package can be found in the Earth Engine Community: Developer Resources together with other awesome resources such as geemap and rgee.

How does it work?

The eemont python package extends the following Earth Engine classes:

New utility methods and constructors are added to above-mentioned classes in order to create a more fluid code by being friendly with the Python method chaining. These methods are mandatory for some pre-processing and processing tasks (e.g. clouds masking, shadows masking, image scaling, spectral indices computation, etc.), and they are presented as simple functions that give researchers, students and analysts the chance to analyze data with far fewer lines of code.

Look at this simple example where a Sentinel-2 Surface Reflectance Image Collection is pre-processed and processed in just one step:

import ee, eemont
   
ee.Authenticate()
ee.Initialize()

point = ee.Geometry.PointFromQuery(
    'Cali, Colombia',
    user_agent = 'eemont-example'
) # Extended constructor

S2 = (ee.ImageCollection('COPERNICUS/S2_SR')
    .filterBounds(point)
    .closest('2020-10-15') # Extended (pre-processing)
    .maskClouds(prob = 70) # Extended (pre-processing)
    .scaleAndOffset() # Extended (pre-processing)
    .spectralIndices(['NDVI','NDWI','BAIS2'])) # Extended (processing)

And just like that, the collection was pre-processed, processed and ready to be analyzed!

Installation

Install the latest version from PyPI:

pip install eemont

Upgrade eemont by running:

pip install -U eemont

Install the latest version from conda-forge:

conda install -c conda-forge eemont

Install the latest dev version from GitHub by running:

pip install git+https://github.com/davemlz/eemont

Features

Let's see some of the main features of eemont and how simple they are compared to the GEE Python API original methods:

Overloaded Operators

The following operators are overloaded: +, -, *, /, //, %, **\ , <<, >>, &, |, <, <=, ==, !=, >, >=, -, ~. (and you can avoid the ee.Image.expression() method!)

<table> <tr> <th> GEE Python API </th> <th> eemont-style </th> </tr> <tr> <td>
ds = 'COPERNICUS/S2_SR'
          
S2 = (ee.ImageCollection(ds)
.first())

def scaleImage(img):
    scaling = img.select('B.*')
    x = scaling.multiply(0.0001)
    scaling = img.select(['AOT','WVP'])
    scaling = scaling.multiply(0.001)
    x = x.addBands(scaling)
    notScaling = img.select([
        'SCL',
        'TCI.*',
        'MSK.*',
        'QA.*'
    ]))
    return x.addBands(notScaling)
    
S2 = scaleImage(S2)

exp = '2.5*(N-R)/(N+(6*R)-(7.5*B)+1)'

imgDict = {
'N': S2.select('B8'),
'R': S2.select('B4'),
'B': S2.select('B2')
}

EVI = S2.expression(exp,imgDict)
</td> <td>
ds = 'COPERNICUS/S2_SR'
          
S2 = (ee.ImageCollection(ds)
.first()
.scale())

N = S2.select('B8')
R = S2.select('B4')
B = S2.select('B2')

EVI = 2.5*(N-R)/(N+(6*R)-(7.5*B)+1)
</td> </tr> </table>

Clouds and Shadows Masking

Masking clouds and shadows can be done using eemont with just one method: maskClouds()!

<table> <tr> <th> GEE Python API </th> <th> eemont-style </th> </tr> <tr> <td>
ds = 'LANDSAT/LC08/C01/T1_SR'
          
def maskCloudsShadows(img):
    c = (1 << 3)
    s = (1 << 5)
    qa = 'pixel_qa'
    qa = img.select(qa)
    cm = qa.bitwiseAnd(c).eq(0)
    sm = qa.bitwiseAnd(s).eq(0)
    mask = cm.And(sm)
    return img.updateMask(mask)
    
(ee.ImageCollection(ds)
    .map(maskCloudsShadows))
</td> <td>
ds = 'LANDSAT/LC08/C01/T1_SR'
          
(ee.ImageCollection(ds)
    .maskClouds())
</td> </tr> </table>

Image Scaling and Offsetting

Scaling and offsetting can also be done using eemont with just one method: scale()!

<table> <tr> <th> GEE Python API </th> <th> eemont-style </th> </tr> <tr> <td>
def scaleBands(img):
    scaling = img.select([
    'NDVI',
    'EVI',
    'sur.*'
    ])
    x = scaling.multiply(0.0001)
    scaling = img.select('.*th')
    scaling = scaling.multiply(0.01)
    x = x.addBands(scaling)
    notScaling = img.select([
    'DetailedQA',
    'DayOfYear',
    'SummaryQA'
    ])
    return x.addBands(notScaling)              

ds = 'MODIS/006/MOD13Q1'

(ee.ImageCollection(ds)
    .map(scaleBands))
</td> <td>
ds = 'MODIS/006/MOD13Q1'
          
(ee.ImageCollection(ds)
    .scaleAndOffset())
</td> </tr> </table>

Complete Preprocessing

The complete preprocessing workflow (Masking clouds and shadows, and image scaling and offsetting) can be done using eemont with just one method: preprocess()!

<table> <tr> <th> GEE Python API </th> <th> eemont-style </th> </tr> <tr> <td>
ds = 'LANDSAT/LC08/C01/T1_SR'
          
def maskCloudsShadows(img):
    c = (1 << 3)
    s = (1 << 5)
    qa = 'pixel_qa'
    qa = img.select(qa)
    cm = qa.bitwiseAnd(c).eq(0)
    sm = qa.bitwiseAnd(s).eq(0)
    mask = c

Related Skills

View on GitHub
GitHub Stars446
CategoryProduct
Updated1d ago
Forks76

Languages

Python

Security Score

100/100

Audited on Apr 1, 2026

No findings