Resolve assets from a datapoint
Query an asset-enabled dataset and select one datapoint. See Querying data for the complete query API.Python
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
Useread_bytes for small files. Set max_bytes to reject unexpectedly large objects.
Python
Stream asset bytes
Useiter_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. Usewindow_from_bounds to convert geographic bounds into a pixel window.
Python
Read RGB bands in parallel
Useasyncio.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 anAssetAccessPolicy to change that order.
Python
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.