Differences
This shows you the differences between two versions of the page.
| datalake:minio:zarrv2 [2025/10/15 15:44] – created fabricio | datalake:minio:zarrv2 [2025/10/15 16:37] (current) – fabricio | ||
|---|---|---|---|
| Line 200: | Line 200: | ||
| Both '' | Both '' | ||
| + | |||
| + | |||
| + | ====== RKNS (Zarr V2) from Minio ZIP ====== | ||
| + | Execute the following with 'uv run', the dependencies are automatically resolved. | ||
| + | This assumes you have our internal pypi registry set up with uv. | ||
| + | |||
| + | <code python> | ||
| + | # /// script | ||
| + | # requires-python = "> | ||
| + | # dependencies = [ | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # ] | ||
| + | # /// | ||
| + | import os | ||
| + | from pathlib import Path | ||
| + | from dotenv import load_dotenv | ||
| + | from fsspec.implementations.zip import ZipFileSystem | ||
| + | from fsspec.mapping import FSMap | ||
| + | import s3fs | ||
| + | import zarr | ||
| + | import rkns | ||
| + | |||
| + | # load credentials from .env file | ||
| + | load_dotenv() | ||
| + | access_key_id = os.getenv(" | ||
| + | secret_access_key = os.getenv(" | ||
| + | endpoint_url = os.getenv(" | ||
| + | endpoint_url_full = os.getenv(" | ||
| + | |||
| + | |||
| + | # Specify the path to your custom CA certificate | ||
| + | ca_cert_path = " | ||
| + | assert Path(ca_cert_path).is_file() | ||
| + | |||
| + | |||
| + | # Create s3fs filesystem with custom cert | ||
| + | fs = s3fs.S3FileSystem( | ||
| + | client_kwargs={" | ||
| + | key=access_key_id, | ||
| + | secret=secret_access_key, | ||
| + | use_ssl=True, | ||
| + | ) | ||
| + | |||
| + | s3_path = " | ||
| + | |||
| + | zip_fs = ZipFileSystem(fo=fs.open(s3_path, | ||
| + | store = zarr.storage.FSStore(url='', | ||
| + | rkns_obj = rkns.from_RKNS(store) | ||
| + | print(rkns_obj.tree) | ||
| + | </ | ||
| + | |||