Skip to content

STAC

Resource

cdse.stac.api.Stac

Stac(transport: Transport, base_url: str)

Bases: StacSearch

Entry point for the STAC catalogue: search, browse, and download.

download_asset

download_asset(
    item: Item,
    asset_key: str,
    destination: str | Path,
    *,
    chunk_size: int = DEFAULT_CHUNK_SIZE,
    resume: bool = False,
) -> Path

Download a named asset of an item to destination.

download_href

download_href(
    href: str,
    destination: str | Path,
    *,
    chunk_size: int = DEFAULT_CHUNK_SIZE,
    resume: bool = False,
) -> Path

Download an asset by its href directly.

cdse.stac.search.StacSearch

StacSearch(transport: Transport, base_url: str)

Access the STAC API search and browse endpoints.

search

search(
    *,
    collections: Sequence[str] | None = None,
    ids: Sequence[str] | None = None,
    bbox: Sequence[float] | None = None,
    datetime: str | None = None,
    intersects: dict[str, Any] | None = None,
    limit: int | None = None,
    filter: dict[str, Any] | str | None = None,
    filter_lang: str | None = None,
    query: dict[str, Any] | None = None,
    sortby: list[dict[str, str]] | str | None = None,
    fields: dict[str, list[str]] | None = None,
) -> Iterator[Item]

Search for items, following paging links lazily.

Parameters:

Name Type Description Default
collections Sequence[str] | None

Collection ids to restrict the search to.

None
ids Sequence[str] | None

Specific item ids to return.

None
bbox Sequence[float] | None

Bounding box as [minx, miny, maxx, maxy].

None
datetime str | None

An RFC 3339 instant or start/end interval.

None
intersects dict[str, Any] | None

A GeoJSON geometry to intersect.

None
limit int | None

Page size.

None
filter dict[str, Any] | str | None

A CQL2 filter, as JSON (dict) or text (str).

None
filter_lang str | None

The filter language, for example cql2-json.

None
query dict[str, Any] | None

A Query extension expression.

None
sortby list[dict[str, str]] | str | None

A Sort extension expression.

None
fields dict[str, list[str]] | None

A Fields extension include/exclude expression.

None

search_page

search_page(
    body: dict[str, Any] | None = None,
) -> ItemCollection

Run a single POST search with the given request body.

collections

collections() -> list[Collection]

List all available collections.

collection

collection(collection_id: str) -> Collection

Fetch a single collection by id.

items

items(
    collection_id: str, *, limit: int | None = None
) -> Iterator[Item]

Iterate the items of a collection, following paging links.

item

item(collection_id: str, item_id: str) -> Item

Fetch a single item by collection and item id.

queryables

queryables(
    collection_id: str | None = None,
) -> dict[str, Any]

Return the queryable properties, globally or for one collection.

Models

cdse.stac.models

Typed models for STAC API responses.

These follow the STAC 1.1.0 specification. Item properties are open ended, so they are kept as a dictionary while a few common ones are exposed through convenience accessors. Unknown fields are ignored so that responses validate across collections.

Bases: BaseModel

A hypermedia link, used for navigation and pagination.

Asset

Bases: BaseModel

A downloadable asset attached to an item.

Item

Bases: BaseModel

A STAC item, representing a single product.

datetime property

datetime: str | None

The item's datetime property, when present.

cloud_cover property

cloud_cover: float | None

The eo:cloud_cover property, when present.

ItemCollection

Bases: BaseModel

A GeoJSON FeatureCollection of STAC items, as returned by search.

Collection

Bases: BaseModel

A STAC collection description.

CollectionList

Bases: BaseModel

The response of the /collections endpoint.