Get assets and STAC objects from orders and processing jobs.
View repositoryA class that contains predefined sorting fields.
Attributes
Attribute | Description |
---|---|
name | utils.SortingField Sorts by asset name. The default order is ascending. |
title | utils.SortingField Sorts by title. The default order is ascending. |
size | utils.SortingField Sorts by size. The default order is ascending. |
created_at | utils.SortingField Sorts by creation date. The default order is ascending. |
updated_at | utils.SortingField Sorts by update date. The default order is ascending. |
source | utils.SortingField Sorts by source. The default order is ascending. |
collection_name | utils.SortingField Sorts by collection name. The default order is ascending. |
producer_name | utils.SortingField Sorts by producer name. The default order is ascending. |
Python
# Sort by creation date, from the most recent to the earliest
up42.Asset.all(sort_by=up42.AssetSorting.created_at.desc)
A data class that enables access to assets.
Attributes
Attribute | Description |
---|---|
id | str The asset ID. |
account_id | str The account ID. |
created_at | str The timestamp when the asset was created. |
name | Optional[str] The file name. |
size | int The asset size. |
updated_at | str The timestamp when the asset was last updated. |
workspace_id | str The workspace ID. |
order_id | Optional[str] The order ID. |
source | Optional[Literal[“ARCHIVE”, “TASKING”, “PROCESSING”]] The asset source. |
product_id | Optional[str] The data product ID. |
content_type | str The asset file format. |
producer_name | Optional[str] The company that initially acquired and processed the source data. |
collection_name | Optional[str] The geospatial collection name. |
geospatial_metadata_extraction_status | Optional[Literal[“SUCCESSFUL”, “FAILED”, “IN_PROGRESS”, “NOT_PROCESSED”]] The status indicating the progress and outcome of transforming the asset’s metadata for CNAM compatibility. |
title | Optional[str] The asset title. |
tags | Optional[list[str]] A list of tags that categorize the asset. A tag can consist of letters, numbers, spaces, and special characters ( . , - , _ , / , : ). |
Properties
3.0.0
. Retrieves the ID of the asset. Returns str
.
Python
asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")
asset.asset_id
Retrieves STAC items associated with a specific asset. Returns pystac.ItemCollection
.
Python
up42.Asset.get(asset_id="d290f1ee-6c54-4b01-90e6-d701748f0851").stac_items
Retrieves the STAC collection associated with a specific asset. Returns Union[pystac.Collection, pystac_client.CollectionClient]
.
Python
up42.Asset.get(asset_id="d290f1ee-6c54-4b01-90e6-d701748f0851").stac_info
Retrieves an asset file. Returns utils.ImageFile
.
Python
up42.Asset.get(asset_id="d290f1ee-6c54-4b01-90e6-d701748f0851").file.download(output_dir)
Methods
Fetches a specific asset by its ID. Returns Asset
.
Parameter | Description |
---|---|
asset_id | str The asset ID. |
Python
up42.Asset.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")
Retrieves all assets, with optional filtering. Returns Iterator["Asset"]
. Use itertools.islice
to offset and limit the results.
Parameter | Description |
---|---|
created_after | Optional[Union[str, dt.datetime]] A time condition for search. Use to search for assets created after the timestamp specified in the YYYY-MM-DD format. |
created_before | Optional[Union[str, dt.datetime]] A time condition for search. Use to search for assets created before the timestamp specified in the YYYY-MM-DD format. |
workspace_id | Optional[str] The workspace ID. Use to get assets from a specific workspace. Otherwise, assets from the entire account will be returned. |
collection_names | Optional[List[str]] The names of geospatial collections. Use to search for assets from any of the provided collections. |
producer_names | Optional[List[str]] The names of producers. Use to search for assets from any of the provided producers. A producer is the type of geospatial collection provider that initially acquired and processed the source data. Data acquired by a producer can be distributed to various hosts. |
tags | Optional[List[str]] Asset tags. Use to search for assets with any of the provided tags. A tag can consist of letters, numbers, spaces, and special characters ( . , - , _ , / , : ). |
sources | Optional[List[str]] Asset sources. Use to search for assets from any of the provided sources. |
search | Optional[str] Additional search terms. Use to search for assets that partially or fully match the provided query in their name, title, or order ID. |
sort_by | Optional[utils.SortingField] The results sorting method that arranges elements in ascending or descending order based on a chosen field. To view the list of possible values, see AssetSorting . |
Python
# Sort by creation date, from the most recent to the earliest
all_assets = up42.Asset.all(sort_by=up42.AssetSorting.created_at.desc)
assets = islice(all_assets, offset, limit)
3.0.0
. Use pystac.Item.update
. Updates the title and tags of an asset. Returns dict
.
Parameter | Description |
---|---|
title | Union[Optional[str], object] An editable asset title. If no value is provided, the current title will remain unchanged. |
tags | Union[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"],
)
3.0.0
. Use pystac.Asset.file.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
.
Parameter | Description |
---|---|
stac_asset | pystac.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"),
)
3.0.0
. Use Asset.file.download
. Downloads assets from storage and returns a list of download paths. Returns List[str]
.
Parameter | Description |
---|---|
output_directory | Union[str, pathlib.Path, None] The file output directory. The default value is the current directory. |
unpacking | bool Determines how to download the asset:
True . |
Python
asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")
asset.download(
output_directory="/Users/max.mustermann/Desktop/",
unpacking=False,
)
3.0.0
. Use pystac.Asset.file.download
. 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
.
Parameter | Description |
---|---|
stac_asset | pystac.Asset The name of the STAC asset. |
output_directory | Union[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/",
)