Git Product home page Git Product logo

gee_toolbox's Introduction

gee_toolbox ( this is a work in progress )

gee_toolbox is convenience module and command line tool for GEE. Note if you have earthengine installed you already have access to the earthengine CLI. In most respects the earthengine CLI is better and more complete.

Use cases for this CLI/Module are:

CLI
  • Task management: easily list, cancel, summarize tasks
  • User management: manage multiple users on one machine. (note: you probably shouldn't use this)
PYTHON MODULE
  • gee.init: initialization that automatically uses service accounts (when an ENV var is present)
  • Asset management: a python wrapper for the earthengine-cli that provides
    • asset_exists()!!!
    • asset_cp/mv/list()
INSTALL
# pip (testpypi)
pip install -U -i https://testpypi.python.org/pypi gee_toolbox

# github
$ git https://github.com/wri/gee_toolbox
$ cd gee_toolbox/
$ pip install . 

ASSET MANAGEMENT

These methods

def asset_exists(path,full_path=False):
def asset_mv(from_path,to_path,full_path=False):
def asset_cp(from_path,to_path,full_path=False):
def asset_list(path,full_path=False):

do exactly what you think they do. If full_path=False and the environment variable EE_PROJECT_ROOT exists, it will prefix the file paths with $EE_PROJECT_ROOT/.

gee.asset_cmd is a more general cli wrapper that is used internally for the above methods but could be used to implement other cli methods. As an example, gee.asset_cmd('cp',[from_path,to_path]) is the same as earthengine cp from_path to_path (Note however for copy you would just use gee.asset_cp).


COMMAND LINE
$ gee -h
usage: gee.py [-h] {status,summary,cancel,tasks,user} ...

GEE HELPER

positional arguments:
  {status,summary,cancel,tasks,user}
    status              GEE Task Status (consider using gee.summary)
    summary             GEE Task Summary
    cancel              Cancel Tasks
    tasks               Prints summary of recent tasks
    user                User Info

optional arguments:
  -h, --help            show this help message and exit

$ gee summary -h
usage: gee.py summary [-h] [-d DETAILED] [-p PROPS] task_id

positional arguments:
  task_id               gee-task-id

optional arguments:
  -d DETAILED, --detailed DETAILED
                        include details
  -p PROPS, --props PROPS
                        comma seperated string of properties

$ gee tasks -h
usage: gee.py tasks [-h] [-n NUM] [-t TASK_ID] [-d DESCRIPTION] [-s STATES]
                    [-p PROPS]

optional arguments:
  -n NUM, --num NUM     number of tasks to print
  -t TASK_ID, --task_id TASK_ID
                        any portion of gee-task-id
  -d DESCRIPTION, --description DESCRIPTION
                        any portion of gee-task-description
  -s STATES, --states STATES
                        commas seperated state names or one of
                        all|opentasks|finished
  -p PROPS, --props PROPS
                        commas seperated property names to display

$ gee cancel -h
usage: gee.py cancel [-h] [-t TASK_ID] [-d DESCRIPTION] [-s STATES]

optional arguments:
  -t TASK_ID, --task_id TASK_ID
                        any portion of gee-task-id
  -d DESCRIPTION, --description DESCRIPTION
                        any portion of gee-task-description
  -s STATES, --states STATES
                        commas seperated state names or one of
                        all|opentasks

SERVICE_ACCOUNT

To use a service account simply set a SERVICE_ACCOUNT environment variable

$ export SERVICE_ACCOUNT=yourserviceaccount@project_id.iam.gserviceaccount.com

and gee.init() will use the account to initialize earthengine.


USERS

This module contains methods for (the potentially unsafe but convenient practice of) handling multiple GEE accounts on the same computer. For this to work simply create a sub-directories in your .config/earthengine for each user containing their crediential file. The system will then create a current_user.txt file and credentials-last (backup) file. Your .config/earthengine directory will look like this:

$ tree <USER_HOME>/.config/earthengine
<USER_HOME>/.config/earthengine
├── username1
│   └── credentials
├── username2
│   └── credentials
├── credentials
├── credentials-last
├── current_user.txt
├── username3
│   └── credentials
$ gee user -h
usage: gee.py user [-h] [-n NEW]

optional arguments:
  -n NEW, --new NEW  new username

gee_toolbox's People

Contributors

brookisme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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