Skip to content

Instantly share code, notes, and snippets.

View d-v-b's full-sized avatar
💭
status

Davis Bennett d-v-b

💭
status
  • Independent software engineer
  • Würzburg, Germany
  • 07:42 (UTC +01:00)
View GitHub Profile
@d-v-b
d-v-b / create_sharded_array.py
Created January 16, 2025 10:32
zarr-python 3 array creation example
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "zarr == 3.0.0",
# ]
# ///
from zarr import create_array
import numpy as np
@d-v-b
d-v-b / out.log
Created January 8, 2025 14:36
zarr 3 gcsfs log output
2025-01-08 15:34:58,955 - gcsfs - DEBUG - _call -- GET: https://storage.googleapis.com/download/storage/v1/b/gcp-public-data-arco-era5/o/ar%2Ffull_37-1h-0p25deg-chunk-1.zarr-v3%2Fzarr.json?alt=media, (), {}
2025-01-08 15:34:58,955 - gcsfs - DEBUG - _call -- GET: https://storage.googleapis.com/download/storage/v1/b/gcp-public-data-arco-era5/o/ar%2Ffull_37-1h-0p25deg-chunk-1.zarr-v3%2F.zgroup?alt=media, (), {}
2025-01-08 15:34:58,955 - gcsfs - DEBUG - _call -- GET: https://storage.googleapis.com/download/storage/v1/b/gcp-public-data-arco-era5/o/ar%2Ffull_37-1h-0p25deg-chunk-1.zarr-v3%2F.zattrs?alt=media, (), {}
2025-01-08 15:34:58,955 - gcsfs - DEBUG - _call -- GET: https://storage.googleapis.com/download/storage/v1/b/gcp-public-data-arco-era5/o/ar%2Ffull_37-1h-0p25deg-chunk-1.zarr-v3%2F.zmetadata?alt=media, (), {}
2025-01-08 15:34:59,751 - gcsfs - DEBUG - _call -- GET: b/{}/o, ('gcp-public-data-arco-era5',), None
2025-01-08 15:35:00,364 - gcsfs - DEBUG - _call -- GET: b/{}/o, ('gcp-public-data-arco-era5',), No
@d-v-b
d-v-b / panel_neuroglancer_demo.ipynb
Created December 17, 2024 13:46
demo of panel-neuroglancer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@d-v-b
d-v-b / cached_array.py
Created December 17, 2024 11:07
A simple bounding-box-based array with caching
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# ]
# ///
import numpy as np
from typing import Iterable
BBox = tuple[tuple[int, int], ...]
@d-v-b
d-v-b / cached_array.py
Created December 17, 2024 11:06
A simple bounding-box-based array with caching
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# ]
# ///
import numpy as np
from typing import Iterable
BBox = tuple[tuple[int, int], ...]
@d-v-b
d-v-b / caddyfile
Last active August 9, 2024 16:49
neuroglancer-compatible caddyfile
{
debug
}
:8000 {
file_server {
browse
root /path/to/data
}
header {
Access-Control-Allow-Headers *
@d-v-b
d-v-b / dacapo_demo_data.py
Last active March 4, 2024 15:28
copy demo data from s3 for dacapo
from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor, as_completed, wait
import os
import time
from typing import Any, Dict, List
import click
import numpy as np
import zarr
from zarr.storage import FSStore
import logging
"""
Demo of TypedDict for payloads for a method on a dataclass that returns a new instance with updated attributes.
"""
from dataclasses import dataclass
from typing import TypedDict
class FooUpdate(TypedDict):
prop_a: int
prop_b: str
@d-v-b
d-v-b / create_dataarray.py
Created November 7, 2023 21:09
crappy ome-ngff to xarray
from xarray_ome_ngff.registry import get_adapters
import zarr
from typing import Union
import dask.array as da
from xarray import DataArray
import os
def infer_coords(group: zarr.Group, array: zarr.Array):
# these conditionals should be handled by a lower-level validation function
if 'multiscales' in group.attrs: