ee.cli package

Submodules

ee.cli.commands module

Commands supported by the Earth Engine command line interface.

Each command is implemented by extending the Command class. Each class defines the supported positional and optional arguments, as well as the actions to be taken when the command is executed.

class ee.cli.commands.AclChCommand(parser)

Bases: object

Changes the access control list for an asset.

Each change specifies the email address of a user or group and, for additions, one of R or W corresponding to the read or write permissions to be granted, as in “user@domain.com:R”. Use the special name “allUsers” to change whether all users can read the asset.

name = 'ch'
run(args, config)

Performs an ACL update.

class ee.cli.commands.AclCommand(parser)

Bases: ee.cli.commands.Dispatcher

Prints or updates the access control list of the specified asset.

COMMANDS = [<class 'ee.cli.commands.AclChCommand'>, <class 'ee.cli.commands.AclGetCommand'>, <class 'ee.cli.commands.AclSetCommand'>]
name = 'acl'
class ee.cli.commands.AclGetCommand(parser)

Bases: object

Prints the access control list for an asset.

name = 'get'
run(args, config)
class ee.cli.commands.AclSetCommand(parser)

Bases: object

Sets the access control list for an asset.

The ACL may be the name of a canned ACL, or it may be the path to a file containing the output from “acl get”. The recognized canned ACL names are “private”, indicating that no users other than the owner have access, and “public”, indicating that all users have read access. It is currently not possible to modify the owner ACL using this tool.

CANNED_ACLS = {'private': {'all_users_can_read': False, 'readers': [], 'writers': []}, 'public': {'all_users_can_read': True, 'readers': [], 'writers': []}}
name = 'set'
run(args, config)

Sets asset ACL to a canned ACL or one provided in a JSON file.

class ee.cli.commands.AssetCommand(parser)

Bases: ee.cli.commands.Dispatcher

Prints or updates metadata associated with an Earth Engine asset.

COMMANDS = [<class 'ee.cli.commands.AssetInfoCommand'>, <class 'ee.cli.commands.AssetSetCommand'>]
name = 'asset'
class ee.cli.commands.AssetInfoCommand(parser)

Bases: object

Prints metadata and other information about an Earth Engine asset.

name = 'info'
run(args, config)
class ee.cli.commands.AssetSetCommand(parser)

Bases: object

Sets metadata properties of an Earth Engine asset.

Properties may be of type “string”, “number”, or “date”. Dates must be specified in the form YYYY-MM-DD[Thh:mm:ss[.ff]] in UTC and are stored as numbers representing the number of milliseconds since the Unix epoch (00:00:00 UTC on 1 January 1970).

To delete a property, set it to null without a type:
prop=null.
To set a property to the string value ‘null’, use the assignment
(string)prop4=null.
name = 'set'
run(args, config)

Runs the asset update.

class ee.cli.commands.AuthenticateCommand(parser)

Bases: object

Prompts the user to authorize access to Earth Engine via OAuth2.

name = 'authenticate'
run(args, unused_config)

Prompts for an auth code, requests a token and saves it.

class ee.cli.commands.CopyCommand(parser)

Bases: object

Creates a new Earth Engine asset as a copy of another asset.

name = 'cp'
run(args, config)

Runs the asset copy.

class ee.cli.commands.CreateCollectionCommand(parser)

Bases: ee.cli.commands.CreateCommandBase

Creates one or more image collections.

name = 'collection'
class ee.cli.commands.CreateCommand(parser)

Bases: ee.cli.commands.Dispatcher

Creates assets and folders.

COMMANDS = [<class 'ee.cli.commands.CreateCollectionCommand'>, <class 'ee.cli.commands.CreateFolderCommand'>]
name = 'create'
class ee.cli.commands.CreateCommandBase(parser, fragment, asset_type)

Bases: object

Base class for implementing Create subcommands.

run(args, config)
class ee.cli.commands.CreateFolderCommand(parser)

Bases: ee.cli.commands.CreateCommandBase

Creates one or more folders.

name = 'folder'
class ee.cli.commands.Dispatcher(parser)

Bases: object

Dispatches to a set of commands implemented as command classes.

run(args, config)
class ee.cli.commands.ListCommand(parser)

Bases: object

Prints the contents of a folder or collection.

name = 'ls'
run(args, config)
class ee.cli.commands.MoveCommand(parser)

Bases: object

Moves or renames an Earth Engine asset.

name = 'mv'
run(args, config)
class ee.cli.commands.RmCommand(parser)

Bases: object

Deletes the specified assets.

name = 'rm'
run(args, config)
class ee.cli.commands.SetProjectCommand(parser)

Bases: object

Sets the default user project to be used for all API calls.

name = 'set_project'
run(args, config)

Saves the project to the config file.

class ee.cli.commands.SizeCommand(parser)

Bases: object

Prints the size and names of all items in a given folder or collection.

name = 'du'
run(args, config)

Runs the du command.

class ee.cli.commands.TaskCancelCommand(parser)

Bases: object

Cancels a running task.

name = 'cancel'
run(args, config)
class ee.cli.commands.TaskCommand(parser)

Bases: ee.cli.commands.Dispatcher

Prints information about or manages long-running tasks.

COMMANDS = [<class 'ee.cli.commands.TaskCancelCommand'>, <class 'ee.cli.commands.TaskInfoCommand'>, <class 'ee.cli.commands.TaskListCommand'>, <class 'ee.cli.commands.TaskWaitCommand'>]
name = 'task'
class ee.cli.commands.TaskInfoCommand(parser)

Bases: object

Prints information about a task.

name = 'info'
run(args, config)
class ee.cli.commands.TaskListCommand(unused_parser)

Bases: object

Lists the tasks submitted recently.

name = 'list'
run(unused_args, config)
class ee.cli.commands.TaskWaitCommand(parser)

Bases: object

Waits for the specified task or tasks to complete.

name = 'wait'
run(args, config)

Waits on the given tasks to complete or for a timeout to pass.

class ee.cli.commands.UnSetProjectCommand(unused_parser)

Bases: object

UnSets the default user project to be used for all API calls.

name = 'unset_project'
run(unused_args, config)

Saves the project to the config file.

class ee.cli.commands.UploadCommand(parser)

Bases: ee.cli.commands.Dispatcher

Uploads assets to Earth Engine.

COMMANDS = [<class 'ee.cli.commands.UploadImageCommand'>, <class 'ee.cli.commands.UploadTableCommand'>]
name = 'upload'
class ee.cli.commands.UploadImageCommand(parser)

Bases: object

Uploads an image from Cloud Storage to Earth Engine.

See docs for “asset set” for additional details on how to specify asset metadata properties.

manifest_from_args(args, config)

Constructs an upload manifest from the command-line flags.

name = 'image'
run(args, config)

Starts the upload task, and waits for completion if requested.

class ee.cli.commands.UploadImageManifestCommand(parser)

Bases: ee.cli.commands._UploadManifestBase

Uploads an image to Earth Engine using the given manifest file.

name = 'upload_manifest'
run(args, config)

Starts the upload task, and waits for completion if requested.

class ee.cli.commands.UploadTableCommand(parser)

Bases: object

Uploads a table from Cloud Storage to Earth Engine.

manifest_from_args(args, config)

Constructs an upload manifest from the command-line flags.

name = 'table'
run(args, config)

Starts the upload task, and waits for completion if requested.

class ee.cli.commands.UploadTableManifestCommand(parser)

Bases: ee.cli.commands._UploadManifestBase

Uploads a table to Earth Engine using the given manifest file.

name = 'upload_table_manifest'
run(args, config)

Starts the upload task, and waits for completion if requested.

ee.cli.eecli module

Executable for the Earth Engine command line interface.

This executable starts a Python Cmd instance to receive and process command line input entered by the user. If the executable is invoked with some command line arguments, the Cmd is launched in the one-off mode, where the provided arguments are processed as a single command after which the program is terminated. Otherwise, this executable will launch the Cmd in the interactive (looping) mode, where the user will be able to run multiple commands as in a typical terminal program.

class ee.cli.eecli.CommandDispatcher(parser)

Bases: ee.cli.commands.Dispatcher

COMMANDS = [<class 'ee.cli.commands.AuthenticateCommand'>, <class 'ee.cli.commands.AclCommand'>, <class 'ee.cli.commands.AssetCommand'>, <class 'ee.cli.commands.CopyCommand'>, <class 'ee.cli.commands.CreateCommand'>, <class 'ee.cli.commands.ListCommand'>, <class 'ee.cli.commands.SizeCommand'>, <class 'ee.cli.commands.MoveCommand'>, <class 'ee.cli.commands.RmCommand'>, <class 'ee.cli.commands.SetProjectCommand'>, <class 'ee.cli.commands.TaskCommand'>, <class 'ee.cli.commands.UnSetProjectCommand'>, <class 'ee.cli.commands.UploadCommand'>, <class 'ee.cli.commands.UploadImageManifestCommand'>, <class 'ee.cli.commands.UploadTableManifestCommand'>]
name = 'main'
ee.cli.eecli.main()

ee.cli.eecli_wrapper module

ee.cli.utils module

Support utilities used by the Earth Engine command line interface.

This module defines the Command class which is the base class of all the commands supported by the EE command line tool. It also defines the classes for configuration and runtime context management.

class ee.cli.utils.CommandLineConfig(config_file=None, service_account_file=None, use_cloud_api=False)

Bases: object

Holds the configuration parameters used by the EE command line interface.

This class attempts to load the configuration parameters from a file specified as a constructor argument. If not provided, it attempts to load the configuration from a file specified via the EE_CONFIG_FILE environment variable. If the variable is not set, it looks for a JSON file at the path ~/.config/earthengine/credentials. If all fails, it falls back to using some predefined defaults for each configuration parameter.

If –service_account_file is specified, it is used instead.

ee_init()

Loads the EE credentials and initializes the EE client.

save()
ee.cli.utils.expand_gcs_wildcards(source_files)

Implements glob-like ‘*’ wildcard completion for cloud storage objects.

Args:
source_files: A list of one or more cloud storage paths of the format
gs://[bucket]/[path-maybe-with-wildcards]
Yields:
cloud storage paths of the above format with ‘*’ wildcards expanded.
Raises:
EEException: If badly formatted source_files
(e.g., missing gs://) are specified
ee.cli.utils.query_yes_no(msg)
ee.cli.utils.truncate(string, length)
ee.cli.utils.wait_for_task(task_id, timeout, log_progress=True)

Waits for the specified task to finish, or a timeout to occur.

ee.cli.utils.wait_for_tasks(task_id_list, timeout, log_progress=False)

For each task specified in task_id_list, wait for that task or timeout.

Module contents