feat: add geozarr reader - #908
Merged
Merged
Conversation
vincentsarago
commented
Apr 11, 2026
| self.height = spatial_shape[0] | ||
| self.width = spatial_shape[1] | ||
|
|
||
| self.bounds = array_bounds(self.height, self.width, self.transform) |
Member
Author
There was a problem hiding this comment.
For rio-tiler we need bound and the shape of the dataset to be able to derive the min/max zoom.
This is specific to the tiler usage where the user needs to know where the dataset is and which zoom level they can load the data to before reading the arrays
vincentsarago
commented
Apr 11, 2026
vincentsarago
commented
Apr 12, 2026
kylebarron
reviewed
Apr 13, 2026
Member
Author
|
With latest commits we can now open a root zarr store even If there is not geo metadata the from obstore.store import HTTPStore
import zarr
from zarr.storage import ObjectStore
from rio_tiler.experimental.zarr import GeoZarrReader
from matplotlib.pyplot import imshow
# 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)
# # Get Group and Array
geozarr = await zarr.api.asynchronous.open_group(store=zarr_store, mode="r")
reader = GeoZarrReader(geozarr)
variables = await reader.list_variables()
print(variables)
>>> ['measurements/reflectance:b01', 'measurements/reflectance:b02', 'measurements/reflectance:b03', 'measurements/reflectance:b04', 'measurements/reflectance:b05', 'measurements/reflectance:b06', 'measurements/reflectance:b07', 'measurements/reflectance:b08', 'measurements/reflectance:b09', 'measurements/reflectance:b11', 'measurements/reflectance:b12', 'measurements/reflectance:b8a', 'quality/atmosphere/r10m:aot', 'quality/atmosphere/r10m:wvp', 'quality/atmosphere/r20m:aot', 'quality/atmosphere/r20m:wvp', 'quality/atmosphere/r60m:aot', 'quality/atmosphere/r60m:wvp', 'quality/mask/r10m:b02', 'quality/mask/r10m:b03', 'quality/mask/r10m:b04', 'quality/mask/r10m:b08', 'quality/mask/r20m:b05', 'quality/mask/r20m:b06', 'quality/mask/r20m:b07', 'quality/mask/r20m:b11', 'quality/mask/r20m:b12', 'quality/mask/r20m:b8a', 'quality/mask/r60m:b01', 'quality/mask/r60m:b09', 'quality/mask/r60m:b10', 'quality/probability/r20m:cld', 'quality/probability/r20m:snw']
img = await reader.preview(variables=["measurements/reflectance:b02"], max_size=128) |
vincentsarago
commented
Apr 20, 2026
| if ":" in variable: | ||
| group_name, variable = variable.split(":")[0:2] | ||
|
|
||
| return group_name, variable, None |
Member
Author
There was a problem hiding this comment.
This is prepping for the future if we can select dimensions within a AsyncArray.
we could in theory have variable being set at {group}:{array}:time=slice(0, 1)
vincentsarago
marked this pull request as ready for review
April 21, 2026 13:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.