Skip to content

Feature request - support xarray creation direct from stacgeoparquet #222

@alexgleith

Description

@alexgleith

There are some folks doing STAC in GeoParquet files, see: https://github.com/stac-utils/rustac-py

You can load this into an xarray using odc.stac.load as shown in the below code.

import rustac
import pystac
from odc.stac import load

url = "https://data.source.coop/ausantarctic/ghrsst-mur-v2/ghrsst-mur-v2.parquet"

year = 2025

dicts = await rustac.read(url)
items = [pystac.Item.from_dict(d) for d in dicts["features"]]
less_items = [i for i in items if i.datetime.year == year]

print(f"Found {len(items)} items, filtered to {len(less_items)} items for {year}")

data = load(
    less_items,
    chunks={"longitude": 4000, "latitude": 4000, "time": 1},
    measurements=["analysed_sst"],
    fail_on_error=False
)

data

We could shortcut this by supporting a parquet file in the load function, so odc.stac.load("https://example.com/stac.parquet") and handle all the filtering and so on. It would be pretty neat!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions