Skip to main content

Set of tools to use in Google Earth Engine Python API

Project description

These are a bunch of Google Earth Engine Scripts with some tools that may help to solve or automatize some processes. The JavaScript scripts here can only be pasted to the code editor.

For the Python module, clone the repository and copy the folder gee_tools_py to the folder you have the scripts. As it is a module, you can import it directly like:

from gee_tools_py import geetools as gee

and then you can use it:

from gee_tools_py import geetools as gee

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

Function’s 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 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 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 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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geetools-0.0.2.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

geetools-0.0.2-py2-none-any.whl (15.0 kB view details)

Uploaded Python 2

File details

Details for the file geetools-0.0.2.tar.gz.

File metadata

  • Download URL: geetools-0.0.2.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for geetools-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1e05a4689f65b404cb8d681d50fe3c050453d54bd4b99c8557f86769315c5a12
MD5 0b9519af55f12d87eda494eeb6e3de33
BLAKE2b-256 d8cceed358dfbe31abeafa935bff526f63606ca65ca250c79362d71ee631b76e

See more details on using hashes here.

File details

Details for the file geetools-0.0.2-py2-none-any.whl.

File metadata

File hashes

Hashes for geetools-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 e926cd1942d38773d23d3960a28ecd48fc8705bc8951d73ccec96b90b497e24d
MD5 7b8c1665f04d9af9175b30843f7a7ec6
BLAKE2b-256 fb8af3e83e48a226f720b63536fd382dc40df5a71357659ef80d2c90dc23f01e

See more details on using hashes here.

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