geetools.Asset.Asset#

class geetools.Asset.Asset(*args)#

An Asset management class mimicking the pathlib.Path class behaviour.

Initialize the Asset class.

Note

An asset cannot be an absolute path like in a normal filesystem and thus any trailing “/” will be removed.

property name#

Return the asset name.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.name
property owner#

Return the asset owner (project name).

This method is only parsing the asset path and is not checking asset existence.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.owner
property parent#

Return the direct parent directory.

It can go further up than the root folder if the asset is not absolute.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.parent
property parents#

Return the parent directories from the root folder.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.parents
property parts#

Return the asset parts of the path.

We will show all the parts from the root to the asset name. Remember that projects/user/assets is not part of the asset name but is part of the path.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.parts
property st_size#

Return the byte size of the file.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.st_size
property type: str#

Return the asset type.

Examples

asset = ee.Asset("projects/ee-geetools/assets/folder/image")
asset.type
Return type:

str

Methods#

__eq__(other)

Override the equal operator to compare the asset with other paths.

__ge__(other)

Override the greater than or equal operator to compare the asset with other paths.

__gt__(other)

Override the greater than operator to compare the asset with other paths.

__idiv__(other)

Override the in-place division operator to join the asset with other paths.

__le__(other)

Override the less than or equal operator to compare the asset with other paths.

__lt__(other)

Override the less than operator to compare the asset with other paths.

__ne__(other)

Override the not equal operator to compare the asset with other paths.

__repr__()

Return the asset object representation as a string.

__str__()

Transform the asset id to a string.

__truediv__(other)

Override the division operator to join the asset with other paths.

as_description()

Transform the name of the Asset in to a description compatible string for a Task.

as_posix()

Return the asset id as a posix path.

as_uri()

Return the asset id as a uri.

copy(new_asset[, overwrite])

Copy the asset to a target destination.

delete()

Alias for unlink.

exists([raised])

Return True if the asset exists and/or the user has access to it.

expanduser()

Return a new path with expanded ~ constructs.

format_description(description)

Format a name to be accepted as a Task description.

glob(pattern)

Return a list of assets matching the pattern.

home()

Return the root asset folder of the used cloud project.

is_absolute([raised])

Return True if the asset is absolute.

is_feature_collection([raised])

Return True if the asset is a feature collection.

is_folder([raised])

Return True if the asset is a folder.

is_image([raised])

Return True if the asset is an image.

is_image_collection([raised])

Return True if the asset is an image collection.

is_project([raised])

Return True if the asset is a project.

is_relative_to(other)

Return True if the asset is relative to another asset.

is_type(asset_type[, raised])

Return True if the asset is of the specified type.

is_user_project([raised])

Check if the current asset is in the same project as the user.

iterdir([recursive])

Get the list of children of a folder.

joinpath(*args)

Join the asset with other paths.

match(*patterns)

Return True if the asset matches the patterns.

mkdir([parents, exist_ok])

Create a folder asset from the Asset path.

move(new_asset[, overwrite])

Move the asset to a target destination.

rglob(pattern)

Return a list of assets matching the pattern recursively.

rmdir([recursive, dry_run])

Remove the asset folder.

unlink()

Remove the asset.

with_name(name)

Return the asset with the given name.