dev-tools:s3_object_storage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dev-tools:s3_object_storage [2025/10/15 16:36] – [RKNS (Zarr V2) from Minio ZIP] fabriciodev-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 ====== 
-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 = ">=3.8" 
-# dependencies = [ 
-#     "boto3>=1.40.49", 
-#     "python-dotenv>=0.9.9", 
-#     "packaging>=25.0", 
-#     "rkns==0.6.2", 
-#     "s3fs[boto3]>=2023.12.0", 
-#     "typing-extensions>=4.15.0", 
-# ] 
-# /// 
-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("STORAGE_ACCESS_KEY") 
-secret_access_key = os.getenv("STORAGE_SECRET_KEY") 
-endpoint_url = os.getenv("ENDPOINT") 
-endpoint_url_full = os.getenv("ENDPOINT_FULL") 
- 
- 
-# Specify the path to your custom CA certificate 
-ca_cert_path = "ca.crt.cer" 
-assert Path(ca_cert_path).is_file() 
- 
- 
-# Create s3fs filesystem with custom cert 
-fs = s3fs.S3FileSystem( 
-    client_kwargs={"endpoint_url": endpoint_url_full, "verify": str(ca_cert_path)}, 
-    key=access_key_id, 
-    secret=secret_access_key, 
-    use_ssl=True, 
-) 
- 
-s3_path = "rekonas-dataset-shhs-rkns/sub-shhs200001_ses-01_task-sleep_eeg.rkns" 
- 
-zip_fs = ZipFileSystem(fo=fs.open(s3_path, "rb")) 
-store = zarr.storage.FSStore(url='', fs=zip_fs) 
-rkns_obj = rkns.from_RKNS(store) 
-print(rkns_obj.tree) 
-</code> 
  
  • dev-tools/s3_object_storage.txt
  • Last modified: 2025/10/15 16:37
  • by fabricio