GithubHelp home page GithubHelp logo

nbiswasuw / gee_tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gee-community/geetools

0.0 1.0 0.0 1.9 MB

Google Earth Engine Tools (scripts)

License: MIT License

Python 90.61% JavaScript 9.39%

gee_tools's Introduction

Google Earth Engine tools

These are a set of tools for Google Earth Engine that may help to solve or automatize some processes.

There are some JavaScript functions that you can use in the Code Editor (https://code.earthengine.google.com/) placed in a folder called js

The rest of the repository is oriented to the GEE Python API. You can install these tools as a normal python package.

Installation

pip install geetools

Upgrade

pip install --upgrade geetools

Basic Usage

from geetools import tools

col = ee.ImageCollection("your_ID")
tasklist = tools.col2asset(col)

Full documentation

http://geetools.readthedocs.io

Some Examples

execli

Executes a client-side function (e.g. getInfo ) as many time as needed and waits between each call as much as needed.

from geetools.tools import execli
import ee

# This image doesn't exist so it will throw an error
img = ee.Image("wrongparam")

# try to get the info with default parameters (10 times, wait 0 sec)
info = execli(img.getInfo)()
print info

# try with custom param (2 times 5 seconds with traceback)
info2 = execli(img.getInfo, 2, 5, True)
print info2

execli_deco

Performs the same action as execli but is meant to be used as a decorator.

from geetools.tools import execli_deco
import ee

# TRY TO GET THE INFO OF AN IMAGE WITH DEFAULT PARAMETERS

@execli_deco()
def info():
    # THIS IMAGE DOESN'E EXISTE SO IT WILL THROW AN ERROR
    img = ee.Image("wrongparam")

    return img.getInfo()

# TRY WITH CUSTOM PARAM (2 times 5 seconds and traceback)

@execli_deco(2, 5, True)
def info():
    # THIS IMAGE DOESN'E EXISTE SO IT WILL THROW AN ERROR
    img = ee.Image("wrongparam")

    return img.getInfo()

addConstantBands

Adds constant bands to an image. You can use it in 3 ways (see example below)

from geetools.tools import addConstantBands
import ee

col = ee.ImageCollection(ID)

# Option 1 - arguments
addC = addConstantBands(0, "a", "b", "c")
newcol = col.map(addC)

# Option 2 - keyword arguments
addC = addConstantBands(a=0, b=1, c=2)
newcol = col.map(addC)

# Option 3 - Combining
addC = addC = addConstantBands(0, "a", "b", "c", d=1, e=2)
newcol = col.map(addC)

Any contribution is welcome. Any bug or question please use the github issue tracker.

gee_tools's People

Contributors

fitoprincipe avatar samsammurphy avatar

Watchers

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