Skip to content

Write

stacrs.write async

write(href: str, value: dict[str, Any] | list[dict[str, Any]], *, format: str | None = None, options: list[tuple[str, str]] | None = None) -> dict[str, str] | None

Writes STAC to a href.

Parameters:

  • href (str) –

    The href to write to

  • value (dict[str, Any] | list[dict[str, Any]]) –

    The value to write. This can be a STAC dictionary or a list of items.

  • format (str | None, default: None ) –

    The output format to write. If not provided, will be inferred from the href's extension.

  • options (list[tuple[str, str]] | None, default: None ) –

    Options for configuring an object store, e.g. your AWS credentials.

Returns:

  • dict[str, str] | None

    dict[str, str] | None: The result of putting data into an object store, e.g. the e_tag and the version. None is returned if the file was written locally.

Examples:

>>> with open("items.json") as f:
...     items = json.load(f)
>>> await stacrs.write("items.parquet", items)