Skip to main content
The storage client reads assets from local files, S3, Google Cloud Storage, Azure, and HTTP locations. It selects a compatible location from the metadata attached to each asset.

Resolve assets from a datapoint

Query an asset-enabled dataset and select one datapoint. See Querying data for the complete query API.
Python
An asset exposes its media type, roles, bands, primary location, and alternate locations. from_datapoint accepts one selected datapoint; for multiple results, resolve each datapoint separately. Create one client and reuse it across assets so it can reuse the underlying object stores:
Python

Storage operations

Read an asset into memory

Use read_bytes for small files. Set max_bytes to reject unexpectedly large objects.
Python

Stream asset bytes

Use iter_bytes when you can process the file incrementally.
Python

Download an asset

download writes atomically to the exact destination path and does not replace an existing file unless requested.
Python

Open a GeoTIFF

open_geotiff opens TIFF metadata without downloading the complete file. The COG and GeoTIFF section shows how to read a region.
Python

Inspect the selected location

resolve selects a location without making a network request. Most code can let the other operations call it automatically.
Python

Work with COG and GeoTIFF assets

A Cloud Optimized GeoTIFF (COG) supports range requests, so you can read the pixels for one region without downloading the complete image. Use window_from_bounds to convert geographic bounds into a pixel window.
Python
The storage client does not apply scale, offset, no-data masks, band stacking, or coordinate transformations. GeoTIFF access requires Python 3.11 or newer.

Read RGB bands in parallel

Use asyncio.gather to fetch independent assets concurrently. This example reads the same 512 × 512 pixel window from the red, green, and blue COGs and stacks the results into an RGB array.
Python

Choose a location

Assets can provide primary and alternate locations. By default, the client prefers local files, S3, Google Cloud Storage, Azure, HTTPS, and HTTP, in that order. Configure an AssetAccessPolicy to change that order.
Python
Storage metadata can provide regions, endpoints, and requester-pays settings.

Authentication

Asset locations can reference authentication metadata. The storage client currently supports S3 credentials from the standard AWS credential environment. Authenticated HTTP locations are not yet supported.

Next steps

Access Sentinel-2 assets

Query Sentinel-2 and read a selected image region.

Reference your own assets

Attach file references to datapoints you ingest.