Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read zarr? #510

Closed
Break00 opened this issue Aug 15, 2022 · 1 comment
Closed

How to read zarr? #510

Break00 opened this issue Aug 15, 2022 · 1 comment

Comments

@Break00
Copy link

Break00 commented Aug 15, 2022

import xarray as xr
import zarr
from rio_tiler.io import COGReader

read zarr

ds = xr.open_zarr(r'D:\work\data\test.zarr')

I want to read zarr by COGReader, but Error !!!

with COGReader(None,dataset=ds) as image:
img = image.read()

#################################
Traceback (most recent call last):
File "D:\python\zarr\test.py", line 43, in
with COGReader(None,dataset=ds) as image:
File "", line 16, in init
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\rio_tiler\io\cogeo.py", line 135, in attrs_post_init
self.bounds = tuple(self.dataset.bounds)
File "C:\Users\dell\AppData\Roaming\Python\Python39\site-packages\xarray\core\common.py", line 256, in getattr
raise AttributeError(
AttributeError: 'Dataset' object has no attribute 'bounds'

@vincentsarago
Copy link
Member

vincentsarago commented Aug 15, 2022

Rio-tiler only accept rasterio object not fsspec ones.

Have a look on the cogeotiff/rio-tiler-fs project

Also there is no guarantee that rio-tiler will fully support Zarr dataset because GDAL support is somehow complicated (it splits the dataset in subdataset only for dataset with more than 2 dim)

See #453

Edit: oh I miss read what you were doing, but almost the same answer rio-tiler only accept rasterio object not xarray ones

I'm planning to support Zarr at some point but the specification and GDAL native support makes it non trivial

@cogeotiff cogeotiff locked and limited conversation to collaborators Aug 16, 2022
@vincentsarago vincentsarago converted this issue into discussion #511 Aug 16, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants