Asset

Retrieve and manage assets using the SDK.


Overview

Get assets and STAC objects from orders and processing jobs.

View repository

Class: Asset

A class that enables access to assets.

Functions

asset_id

Retrieves the ID of the asset. Returns str.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")
asset.asset_id

  

stac_info

Retrieves the STAC collection associated with a specific asset. Returns Union[pystac.Collection, pystac_client.CollectionClient].

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")
asset.stac_info

  

stac_items

Retrieves STAC items associated with a specific asset. Returns pystac.ItemCollection.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")
asset.stac_items

  

update_metadata

Updates the title and tags of an asset. Returns dict.

ParameterDescription
titleUnion[Optional[str], object]
An editable asset title. If no value is provided, the current title will remain unchanged.
tagsUnion[Optional[List[str]], object]
An editable list of tags to categorize the asset. A tag can consist of letters, numbers, spaces, and special characters (., -, _, /, :). If no value is provided, the current tags will remain unchanged.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

asset.update_metadata(
    title="Sentinel-2 over Western Europe",
    tags=["optical", "WEU"],
)

  

get_stac_asset_url

Generates a signed download URL for a STAC asset. The generated URL can be used for up to 5 minutes to download the asset without authentication. Returns str.

ParameterDescription
stac_assetpystac.Asset
The name of the STAC asset.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

asset.get_stac_asset_url(
    stac_asset=asset.stac_items.items[0].assets.get("b01.tiff"),
)

  

download

Downloads assets from storage and returns a list of download paths. Returns List[str].

ParameterDescription
output_directoryUnion[str, pathlib.Path, None]
The file output directory. The default value is the current directory.
unpackingbool
Determines how to download the asset:
  • True: Downloads and unpacks the file.
  • False: Downloads the compressed file.
The default value is True.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

asset.download(
    output_directory="/Users/max.mustermann/Desktop/",
    unpacking=False,
)

  

download_stac_asset

Downloads a STAC asset from storage and provides the path to the downloaded file. A new directory for the file will be created. Returns pathlib.Path.

ParameterDescription
stac_assetpystac.Asset
The name of the STAC asset.
output_directoryUnion[str, pathlib.Path, None]
The file output directory. The default value is the current directory.

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

asset.download_stac_asset(
    stac_asset=asset.stac_items.items[0].assets.get("b01.tiff"),
    output_directory="/Users/max.mustermann/Desktop/",
)

  

Learn more