Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| dev-tools:s3_object_storage [2025/10/15 16:35] – fabricio | dev-tools:s3_object_storage [2025/10/15 16:37] (current) – [RKNS (Zarr V2) from Minio ZIP] fabricio | ||
|---|---|---|---|
| Line 315: | Line 315: | ||
| - | ====== RKNS (Zarr V2) from Minio ZIP ====== | ||
| - | |||
| - | < | ||
| - | |||
| - | # /// 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) | ||
| - | </ | ||