Skip to content

feat: add experimental geoxarray reader#914

Draft
vincentsarago wants to merge 3 commits intomainfrom
feat/experimental-geoxarray
Draft

feat: add experimental geoxarray reader#914
vincentsarago wants to merge 3 commits intomainfrom
feat/experimental-geoxarray

Conversation

@vincentsarago
Copy link
Copy Markdown
Member

@vincentsarago vincentsarago commented Apr 15, 2026

ref #909

import xarray
from obstore.store import HTTPStore
from zarr.storage import ObjectStore
from affine import Affine
from rasterio.crs import CRS
from matplotlib.pyplot import imshow

from rio_tiler.experimental.xarray import GeoArrayReader

# Create Obstore Store
store = HTTPStore("https://s3.explorer.eopf.copernicus.eu/esa-zarr-sentinel-explorer-fra/tests-output/sentinel-2-l2a/S2B_MSIL2A_20260216T142149_N0512_R096_T25WFV_20260216T165051.zarr")
zarr_store = ObjectStore(store=store, read_only=True)
dt = xarray.open_datatree(
    zarr_store,
    engine="zarr",
    create_default_indexes=False,
    consolidated=True,
)

ds = dt["/measurements/reflectance/r720m"]

attributes = ds.attrs

tr = attributes["spatial:transform"]
transform = Affine(*tr)
crs = CRS.from_user_input(attributes["proj:code"])

with GeoArrayReader(ds["b02"], transform=transform, crs=crs) as dst:
    img = dst.preview()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant