Skip to content

Write

stacrs.write builtin

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:

Name Type Description Default
href str

The href to write to

required
value dict[str, Any] | list[dict[str, Any]]

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

required
format str | None

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

None
options list[tuple[str, str]] | None

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

None

Returns:

Type Description
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)
>>> stacrs.write("items.parquet", items)