AGENT SKILL

zarr-python-basics

Create, resize, and inspect a small Zarr v3 array using the tested Python API.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 1
Forks
0

01 前言 Front Matter

name
zarr-python-basics
license
MIT
description
Create, resize, and inspect a small Zarr v3 array using the tested Python API.

02 资源文件 4

03 SKILL.md 正文

Zarr Python: selected array operations

Apply Caveman for every task, CocoIndex Code before broad repository navigation, and Crawl4AI for web-page research. Follow docs/agent-tools.md in the repository root and retain the required execution evidence.

This overlay addresses selected examples from the locked upstream skill. It was checked with Zarr Python 3.4.2 and NumPy 2.5.4 on the recorded Windows and Linux environments. The Zarr Python package version and the array format version are distinct: this example explicitly requests format 3. Python 3.12 or later is required by the tested Zarr package version; check the selected release's own requirements when using another version.

Create, resize, and inspect

import numpy as np
import zarr
from zarr.codecs import BloscCodec
from zarr.storage import MemoryStore

array = zarr.create_array(
    store=MemoryStore(),
    shape=(2, 2),
    chunks=(2, 2),
    dtype="int32",
    zarr_format=3,
    compressors=[BloscCodec(cname="zstd", clevel=5, shuffle="shuffle")],
)
array[:] = np.array([[1, 2], [3, 4]], dtype="int32")
array.resize((3, 2))
values = array[:]
stored_bytes = array.nbytes_stored()

MemoryStore is ephemeral. Choose a persistent store and its lifecycle according to the application. Resize takes a shape tuple; call nbytes_stored() to obtain the stored size. compressors specifies compression, while serialization is a separate setting. Check the version's API before configuring either. In the tested version, chunks=None can still produce multiple chunks; inspect the resulting chunk shape. The locked reference's array.copy() and array.info_items() examples are unavailable in this version.

For separate processes, the Zarr documentation requires writes to different chunks and a storage backend supporting atomic writes for concurrent operation; coordinate writers that can affect the same chunk. Validate the actual storage and write pattern, including sharded layouts, before relying on concurrency. The old ThreadSynchronizer and ProcessSynchronizer examples are not supported by the tested Zarr Python 3 API. Cloud stores, sharding, concurrency, other codecs, and agent performance were not tested by this overlay's component control.

04 同仓库更多 Skills

strmt7
strmt7/ai_skills_collection_benchmarked

makefile-generator-project-wrappers

Repair Python, Java and generic GNU Make wrappers that report false success, miss changed inputs or clean dependency environments. Preserve the actual project build system and test runner; use when adapting the collection's original Makefile generator.

★ 1
strmt7
strmt7/ai_skills_collection_benchmarked

makefile-generator-go

Author or repair GNU Make wrappers for Go modules, retaining Go's dependency discovery and build cache. Use when wrapper timestamps hide embedded-resource changes or build failures; preserve the project's existing build system and real test commands.

★ 1
strmt7
strmt7/ai_skills_collection_benchmarked

strategic-compact-resume

Checkpoint and resume long agent work when context pressure or a handoff could lose constraints, verified progress, or ownership of active jobs.

★ 1
strmt7
strmt7/ai_skills_collection_benchmarked

makefile-generator-cpp

Author or repair GNU Make builds for C++ executables, preserving compiler/linker flags, header dependencies and real project test contracts. Use the optional scaffold for a flat src directory; retain an existing build system unless the task requires changing it.

★ 1
strmt7
strmt7/ai_skills_collection_benchmarked

eval-harness-integrity

Design and verify matched coding-agent evaluations when comparing skills, prompts, models, or harnesses using executable acceptance checks and native result evidence.

★ 1
strmt7
strmt7/ai_skills_collection_benchmarked

eval-harness-evidence

Design and verify matched coding-agent evaluations when comparing skills, prompts, models, or harnesses using executable acceptance checks and native result evidence.

★ 1