Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Python agent-skillsai-scientistbioinformaticschemoinformaticsclaudeclaude-skillsclaudecodeclinical-researchcomputational-biologydata-analysisdrug-discoverygenomicsmaterials-sciencemetabolomicsproteomicsscientific-computingscientific-visualization
chore: update documentation and descriptions for scientific skills
Timothy Kassisb092ba5d4a98
diff --git a/README.md b/README.mdindex 3589a1b5..7e7e66a9 100644--- a/README.md+++ b/README.md@@ -545,7 +545,7 @@ This repository contains **139 scientific and research skills** organized across#### 🎓 **Research Methodology & Planning** (12+ skills)- Ideation: Scientific Brainstorming, Hypothesis Generation- Critical analysis: Scientific Critical Thinking, Scholar Evaluation-- Scenario analysis: What-If Oracle (multi-branch possibility exploration, risk analysis, strategic options)+- Scenario analysis: What-If Oracle (4–6 branch possibility exploration, contingency planning, decision stress-testing)- Multi-perspective deliberation: Consciousness Council (diverse expert viewpoints, devil's advocate analysis)- Cognitive profiling: DHDNA Profiler (extract thinking patterns and cognitive signatures from any text)- Funding: Research Grantsdiff --git a/docs/scientific-skills.md b/docs/scientific-skills.mdindex 08108b88..3d52ef13 100644--- a/docs/scientific-skills.md+++ b/docs/scientific-skills.md@@ -55,7 +55,7 @@- **scvi-tools** - Probabilistic deep learning models for single-cell omics analysis. PyTorch-based framework providing variational autoencoders (VAEs) for dimensionality reduction, batch correction, differential expression, and data integration across modalities. Includes 25+ models: scVI/scANVI (RNA-seq integration and cell type annotation), totalVI (CITE-seq protein+RNA), MultiVI (multiome RNA+ATAC integration), PeakVI (ATAC-seq analysis), DestVI/Stereoscope/Tangram (spatial transcriptomics deconvolution), MethylVI (methylation), CytoVI (flow/mass cytometry), VeloVI (RNA velocity), contrastiveVI (perturbation studies), and Solo (doublet detection). Supports seamless integration with Scanpy/AnnData ecosystem, GPU acceleration, reference mapping (scArches), and probabilistic differential expression with uncertainty quantification- **scikit-bio** - Python library for bioinformatics providing data structures, algorithms, and parsers for biological sequence analysis. Built on NumPy, SciPy, and pandas. Key features include: sequence objects (DNA, RNA, protein sequences) with biological alphabet validation, sequence alignment algorithms (local, global, semiglobal), phylogenetic tree manipulation, diversity metrics (alpha diversity, beta diversity, phylogenetic diversity), distance metrics for sequences and communities, file format parsers (FASTA, FASTQ, QIIME formats, Newick), and statistical analysis tools. Provides scikit-learn compatible transformers for machine learning workflows. Supports efficient processing of large sequence datasets. Use cases: sequence analysis, microbial ecology (16S rRNA analysis), metagenomics, phylogenetic analysis, and bioinformatics research requiring sequence manipulation and diversity calculations- **TileDB-VCF** - High-performance C++ library with Python and CLI interfaces for efficient storage and retrieval of genomic variant-call data using TileDB multidimensional sparse array technology. Enables scalable VCF/BCF ingestion with incremental sample addition, compressed storage, parallel queries across genomic regions and samples, and export capabilities for population genomics workflows. Key features include: memory-efficient queries, cloud storage integration (S3, Azure, GCS), and CLI tools for dataset creation, sample ingestion, data export, and statistics. Supports building variant databases for large cohorts, population-scale genomics studies, and association analysis. Use cases: population genomics databases, cohort studies, variant discovery workflows, genomic data warehousing, and scaling to enterprise-level analysis with TileDB-Cloud platform-- **Zarr** - Python library implementing the Zarr chunked, compressed N-dimensional array storage format. Provides efficient storage and access to large multi-dimensional arrays with chunking and compression. Key features include: support for NumPy-like arrays with chunked storage, multiple compression codecs (zlib, blosc, lz4, zstd), support for various data types, efficient partial array reading (only load needed chunks), support for both local filesystem and cloud storage (S3, GCS, Azure), and integration with NumPy, Dask, and Xarray. Enables working with arrays larger than available RAM through lazy loading and efficient chunk access. Supports parallel read/write operations and is optimized for cloud storage backends. Use cases: large-scale scientific data storage, cloud-based array storage, out-of-core array operations, and efficient storage of multi-dimensional datasets (genomics, imaging, climate data)+- **Zarr** - Python library (Zarr-Python 3.x) implementing chunked, compressed N-dimensional arrays for local disk and cloud object storage (S3, GCS via fsspec). Supports Zarr format 2 and 3, `zarr.codecs` compression (Blosc, gzip, zstd), partial chunk reads, consolidated metadata, sharding, and integration with NumPy, Dask, and Xarray. Use for out-of-core arrays, cloud-native pipelines, and large scientific datasets (genomics, imaging, climate). Skill: `zarr-python`### Data Management & Infrastructure- **LaminDB** - Open-source data framework for biology that makes data queryable, traceable, reproducible, and FAIR (Findable, Accessible, Interoperable, Reusable). Provides unified platform combining lakehouse architecture, lineage tracking, feature stores, biological ontologies (via Bionty plugin with 20+ ontologies: genes, proteins, cell types, tissues, diseases, pathways), LIMS, and ELN capabilities through a single Python API. Key features include: automatic data lineage tracking (code, inputs, outputs, environment), versioned artifacts (DataFrame, AnnData, SpatialData, Parquet, Zarr), schema validation and data curation with standardization/synonym mapping, queryable metadata with feature-based filtering, cross-registry traversal, and streaming for large datasets. Supports integrations with workflow managers (Nextflow, Snakemake, Redun), MLOps platforms (Weights & Biases, MLflow, HuggingFace, scVI-tools), cloud storage (S3, GCS, S3-compatible), array stores (TileDB-SOMA, DuckDB), and visualization (Vitessce). Deployment options: local SQLite, cloud storage with SQLite, or cloud storage with PostgreSQL for production. Use cases: scRNA-seq standardization and analysis, flow cytometry/spatial data management, multi-modal dataset integration, computational workflow tracking with reproducibility, biological ontology-based annotation, data lakehouse construction for unified queries, ML pipeline integration with experiment tracking, and FAIR-compliant dataset publishing@@ -206,7 +206,7 @@### Decision & Scenario Analysis- **Consciousness Council** - Run a multi-perspective Mind Council deliberation on any question, decision, or creative challenge. Use for diverse viewpoints, tough decisions, devil's advocate analysis, exploring problems from multiple angles, or when facing dilemmas, trade-offs, and complex choices with no obvious answer- **DHDNA Profiler** - Extract cognitive patterns and thinking fingerprints from any text. Analyze how someone thinks, understand cognitive style, profile writing or speech patterns, compare thinking styles between people, and gain deeper insight into an author's reasoning patterns, decision-making style, or cognitive signature-- **What-If Oracle** - Run structured What-If scenario analysis with multi-branch possibility exploration. Use for speculative questions, scenario planning, risk analysis, contingency planning, strategic options evaluation, stress-testing ideas, and thinking through consequences before committing+- **What-If Oracle** - Run structured What-If scenario analysis with 4–6 branch possibility exploration (best, likely, worst, wild card). Use for speculative what-if questions, strategic forks, contingency planning, and stress-testing decisions before committing### Web Search & Information Retrieval- **Exa Search** - Web search and URL content extraction via the Exa API. Use for high-quality web search tuned for scientific and technical content, scholarly filtering via `category="research paper"` plus academic domain allowlists, and batch URL extractiondiff --git a/scientific-skills/vaex/SKILL.md b/scientific-skills/vaex/SKILL.mdindex f6de0f88..8da0c00b 100644--- a/scientific-skills/vaex/SKILL.md+++ b/scientific-skills/vaex/SKILL.md@@ -1,9 +1,11 @@---name: vaexdescription: Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.+allowed-tools: Read Write Edit Bash Grep Globlicense: MIT licensemetadata:skill-author: K-Dense Inc.+compatibility: Requires Python 3.10+ (3.12+ recommended with vaex 4.19.0). Install with uv pip install vaex. Optional s3fs/gcsfs/adlfs for cloud I/O.---# Vaex@@ -12,6 +14,24 @@ metadata:Vaex is a high-performance Python library designed for lazy, out-of-core DataFrames to process and visualize tabular datasets that are too large to fit into RAM. Vaex can process over a billion rows per second, enabling interactive data exploration and analysis on datasets with billions of rows.+## Installation++Install the full meta-package (recommended):++```bash+uv pip install vaex+```++Minimal install (pick only what you need):++```bash+uv pip install vaex-core vaex-viz vaex-hdf5 vaex-ml+```++The `vaex` package is a meta-package that pulls in `vaex-core`, `vaex-viz`, `vaex-hdf5`, `vaex-ml`, and other sub-packages. Arrow support is built into `vaex-core` (the separate `vaex-arrow` package is deprecated). `vaex-distributed` is deprecated in favor of vaex-enterprise.++**Version notes (vaex 4.19.0+):** Python 3.12 and NumPy v2 require vaex >= 4.19.0. On Windows, you may need Python dev headers to build the `annoy` dependency.+## When to Use This SkillUse Vaex when:@@ -23,6 +43,8 @@ Use Vaex when:- Needing lazy evaluation and virtual columns to avoid memory overhead- Working with astronomical data, financial time series, or other large-scale scientific datasets+**Vaex vs alternatives:** Use **polars** when data fits in RAM and you need maximum in-memory speed. Use **dask** when you need distributed pandas/NumPy across a cluster. Use **vaex** for single-machine, out-of-core analytics on tabular data that exceeds RAM via memory-mapped HDF5/Arrow files.+## Core CapabilitiesVaex provides six primary capability areas, each documented in detail in the references directory:@@ -105,9 +127,9 @@ df_filtered = df[df.age > 25]mean_val = df.x.mean()stats = df.groupby('category').agg({'value': 'sum'})-# 6. Visualize-df.plot1d(df.x, limits=[0, 100])-df.plot(df.x, df.y, limits='99.7%')+# 6. Visualize (df.viz is the recommended accessor since vaex 4.0)+df.viz.heatmap(df.x, df.y, limits='99.7%', show=True)+# Legacy: df.plot1d() and df.plot() still work on the DataFrame# 7. Export if neededdf.export_hdf5('output.hdf5')@@ -130,7 +152,7 @@ The reference files contain detailed information about each capability area. Loa3. **Batch operations** using `delay=True` when performing multiple calculations4. **Export to efficient formats** rather than keeping data in CSV5. **Use expressions** for complex calculations without intermediate storage-6. **Profile with `df.stat()`** to understand memory usage and optimize operations+6. **Profile with `df.describe()` and `df.nbytes`** to understand data shape and memory usage## Common Patterns@@ -138,8 +160,9 @@ The reference files contain detailed information about each capability area. Loa```pythonimport vaex-# Open large CSV (processes in chunks automatically)-df = vaex.from_csv('large_file.csv')+# Open large CSV lazily (vaex 4.14+), or use from_csv to convert to HDF5+df = vaex.open('large_file.csv')+# df = vaex.from_csv('large_file.csv', convert='large_file.hdf5')# Export to HDF5 for faster future accessdf.export_hdf5('large_file.hdf5')diff --git a/scientific-skills/vaex/references/core_dataframes.md b/scientific-skills/vaex/references/core_dataframes.mdindex 8a26fdae..1bd5297b 100644--- a/scientific-skills/vaex/references/core_dataframes.md+++ b/scientific-skills/vaex/references/core_dataframes.md@@ -23,7 +23,7 @@ import vaexdf = vaex.open('data.hdf5') # HDF5 (recommended)df = vaex.open('data.arrow') # Apache Arrow (recommended)df = vaex.open('data.parquet') # Parquet-df = vaex.open('data.csv') # CSV (slower for large files)+df = vaex.open('data.csv') # CSV (lazy since 4.14; convert to HDF5 for repeated use)df = vaex.open('data.fits') # FITS (astronomy)# Can open multiple files as one DataFrame@@ -32,20 +32,26 @@ df = vaex.open('data_*.hdf5') # Wildcards supported**Key characteristics:**- **Instant for HDF5/Arrow** - Memory-maps files, no loading time-- **Handles large CSVs** - Automatically chunks large CSV files+- **Lazy CSV (4.14+)** - `vaex.open('file.csv')` reads CSV lazily without loading all data into RAM- **Returns immediately** - Lazy evaluation means no computation until needed### Format-Specific Loaders```python-# CSV with options+# Lazy CSV (preferred for exploration since vaex 4.14)+df = vaex.open('large_file.csv')++# CSV with conversion to HDF5 (preferred for repeated use)df = vaex.from_csv('large_file.csv',- chunk_size=5_000_000, # Process in chunks- convert=True, # Convert to HDF5 automatically+ convert='large_file.hdf5', # or convert=True+ chunk_size=5_000_000, # Process in chunks during conversioncopy_index=False # Don't copy pandas index if present)+# To load entire CSV into memory instead of lazy open:+# df = vaex.from_csv('large_file.csv')+# Apache Arrowdf = vaex.open('data.arrow') # Native support, very fastdiff --git a/scientific-skills/vaex/references/io_operations.md b/scientific-skills/vaex/references/io_operations.mdindex 16e1915f..504aac9a 100644--- a/scientific-skills/vaex/references/io_operations.md+++ b/scientific-skills/vaex/references/io_operations.md@@ -77,14 +77,14 @@ df = vaex.open('gs://bucket/data.parquet')### CSV Files```python-# Simple CSV-df = vaex.from_csv('data.csv')+# Lazy CSV (preferred for exploration, vaex 4.14+)+df = vaex.open('data.csv')-# Large CSV with automatic chunking-df = vaex.from_csv('large_data.csv', chunk_size=5_000_000)+# Load entire CSV into memory+df = vaex.from_csv('data.csv')-# CSV with conversion to HDF5-df = vaex.from_csv('large_data.csv', convert='large_data.hdf5')+# Large CSV with automatic chunking and HDF5 conversion+df = vaex.from_csv('large_data.csv', convert='large_data.hdf5', chunk_size=5_000_000)# Creates HDF5 file for future fast loading# CSV with options@@ -335,16 +335,28 @@ df.export_arrow('output.arrow')## Remote and Cloud Storage+Vaex supports streaming HDF5, Arrow, Parquet, and CSV from S3 and Google Cloud Storage. Install optional filesystem backends:++```bash+uv pip install s3fs gcsfs adlfs+```+### Reading from S3```pythonimport vaex-# Read from S3 (requires s3fs)+# Read from S3 using default credentials (~/.aws/credentials or env vars)df = vaex.open('s3://bucket-name/data.parquet')df = vaex.open('s3://bucket-name/data.hdf5')-# With credentials+# With explicit fs_options (anon, profile, region, access_key, secret_key)+df = vaex.open(+ 's3://bucket-name/data.parquet',+ fs_options={'profile': 'myprofile', 'region': 'us-east-1'},+)++# With explicit filesystem objectimport s3fsfs = s3fs.S3FileSystem(key='access_key', secret='secret_key')df = vaex.open('s3://bucket-name/data.parquet', fs=fs)@@ -659,7 +671,10 @@ df_all.export_hdf5('unified.hdf5')### Issue: CSV Loading Too Slow```python-# Solution: Convert to HDF5+# Solution 1: Lazy open for exploration (vaex 4.14+)+df = vaex.open('large.csv')++# Solution 2: Convert to HDF5 for repeated usedf = vaex.from_csv('large.csv', convert='large.hdf5')# Future: df = vaex.open('large.hdf5')```@@ -676,7 +691,7 @@ df_materialized.export_hdf5('output.hdf5')```python# Install required libraries-# pip install s3fs gcsfs adlfs+# uv pip install s3fs gcsfs adlfs# Verify credentialsimport s3fsdiff --git a/scientific-skills/vaex/references/visualization.md b/scientific-skills/vaex/references/visualization.mdindex 66dbee0a..4c3d9500 100644--- a/scientific-skills/vaex/references/visualization.md+++ b/scientific-skills/vaex/references/visualization.md@@ -13,7 +13,38 @@ Vaex excels at visualizing datasets with billions of rows through efficient binn- Integration with matplotlib- Interactive widgets for Jupyter-## Basic Plotting+## Recommended: `df.viz` Accessor++Since vaex 4.0, plotting methods live on the `df.viz` accessor. This is the preferred API in current docs.++```python+import vaex++df = vaex.open('data.hdf5')++# 2D heatmap (most common)+df.viz.heatmap(df.x, df.y, limits='99.7%', show=True)++# 1D histogram via heatmap on a single axis+df.viz.heatmap(df.age, what='count(*)', shape=64, show=True)++# Multiple panels and selections+import numpy as np+df.viz.heatmap(+ [['x', 'y'], ['x', 'z']],+ limits='99.7%',+ what=np.log(vaex.stat.count() + 1),+ selection=[None, df.x < df.y],+ figsize=(10, 4),+ show=True,+)+```++The `df.viz.heatmap()` method supports subplots, selections, layers, and custom statistics via the `what` argument. See the [vaex tutorial](https://vaex.io/docs/tutorial.html) for advanced `visual` layout options.++## Legacy DataFrame Methods++`df.plot1d()` and `df.plot()` still work on the DataFrame (they delegate to the viz accessor). Existing code using these methods does not need to change, but prefer `df.viz.heatmap()` for new code.### 1D Histogramsdiff --git a/scientific-skills/what-if-oracle/SKILL.md b/scientific-skills/what-if-oracle/SKILL.mdindex 076829c6..9c4cc2bf 100644--- a/scientific-skills/what-if-oracle/SKILL.md+++ b/scientific-skills/what-if-oracle/SKILL.md@@ -1,19 +1,34 @@---name: what-if-oracle-description: Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like "what if...", "what would happen if...", "what are the possibilities", "explore scenarios", "scenario analysis", "possibility space", "what could go wrong", "best case / worst case", "risk analysis", "contingency planning", "strategic options", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.-allowed-tools: Read Write-license: MIT license+description: Run structured What-If scenario analysis with 4–6 branch possibility exploration (best, likely, worst, wild card, contrarian, second-order). Use when the user asks speculative what-if questions about uncertain futures, strategic forks, contingency planning, or stress-testing a decision before committing.+license: CC BY-NC-SA 4.0metadata:skill-author: AHK Strategies (ashrafkahoush-ux)+ upstream: https://github.com/ashrafkahoush-ux/claude-consciousness-skills+ research-doi:+ - 10.5281/zenodo.18736841+ - 10.5281/zenodo.18807387---# What-If Oracle — Possibility Space ExplorerA structured system for exploring uncertain futures through rigorous multi-branch scenario analysis. Instead of one prediction, the Oracle maps the full **possibility space** — branching timelines where each path has its own logic, probability, and consequences.-Based on the What-If Statement paradigm: the idea that speculative questions ("What if X?") are not idle daydreaming but a **fundamental computing operation** — the mind's way of simulating futures before committing resources to one.+Based on the What-If Paradigm: the idea that speculative questions ("What if X?") are not idle daydreaming but a **fundamental computing operation** — the mind's way of simulating futures before committing resources to one.-Published research: [The What-If Statement (DOI: 10.5281/zenodo.18736841)](https://doi.org/10.5281/zenodo.18736841) | [IDNA Consolidation v2 (DOI: 10.5281/zenodo.18807387)](https://doi.org/10.5281/zenodo.18807387)+Published research: [The What-If Paradigm (DOI: 10.5281/zenodo.18736841)](https://doi.org/10.5281/zenodo.18736841) | [IDNA v2 / Unified Digital Consciousness Theory (DOI: 10.5281/zenodo.18807387)](https://doi.org/10.5281/zenodo.18807387)++## When to Use This Skill++Use the Oracle when the user:++- Asks "what if…", "what would happen if…", or "explore the possibilities"+- Faces a fork-in-the-road decision with no obvious answer+- Wants best-case / worst-case / likely-case analysis with probabilities+- Needs contingency planning, risk mapping, or strategic option comparison+- Wants to stress-test an idea or think through second-order consequences++For domain-specific framing (startup, tech architecture, crisis response, etc.), see [references/scenario-templates.md](references/scenario-templates.md).## Core Principle: 0·IF·1@@ -159,10 +174,12 @@ Analyze the same What-If from multiple stakeholder perspectives: "If we launch t- Not a crystal ball — probabilities are estimates based on available evidence, not certainties.- Not a substitute for action — the best scenario analysis in the world is worthless without subsequent decision and execution.-## Built By+## Reference Files++| File | Purpose |+| ---- | ------- |+| [references/scenario-templates.md](references/scenario-templates.md) | Domain-specific templates (startup, tech, finance, crisis, etc.) and probability calibration |-[AHK Strategies](https://ahkstrategies.net) — AI Horizon Knowledge-Full platform: [themindbook.app](https://themindbook.app)-Research: [The What-If Statement (DOI: 10.5281/zenodo.18736841)](https://doi.org/10.5281/zenodo.18736841)+## License-_"The future is not empty. It contains completed states that exert pull on the present."_+© 2026 Ashraf Hussein Kahoush / AHK Strategies. Licensed under CC BY-NC-SA 4.0. Free for personal, educational, and research use. Commercial use requires a license from the author.diff --git a/scientific-skills/xlsx/SKILL.md b/scientific-skills/xlsx/SKILL.mdindex c5c881be..51582cf9 100644--- a/scientific-skills/xlsx/SKILL.md+++ b/scientific-skills/xlsx/SKILL.md@@ -1,7 +1,11 @@---name: xlsx-description: "Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved."+description: "Create, edit, analyze, or convert Excel spreadsheets (.xlsx, .xlsm) where the workbook file is the primary deliverable. Use for formulas, formatting, financial models, multi-sheet workbooks, and tabular cleanup exported to Excel. Also applies to .csv/.tsv when the user wants spreadsheet output. Do NOT use for Word documents, HTML reports, standalone Python scripts, database pipelines, or Google Sheets API work."+allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]license: Proprietary. LICENSE.txt has complete terms+metadata:+ skill-author: K-Dense Inc.+compatibility: Requires Python 3.8+, LibreOffice (soffice on PATH), and gcc only when Unix sockets are restricted---# Requirements for Outputs@@ -69,9 +73,39 @@ Unless otherwise stated by the user or existing templateA user may ask you to create, edit, or analyze the contents of an .xlsx file. You have different tools and workflows available for different tasks.+## Installation++```bash+uv pip install openpyxl pandas+```++Optional — faster Excel reading across formats with pandas 2.2+:++```bash+uv pip install python-calamine+```++For untrusted workbook files, harden openpyxl against XML expansion attacks:++```bash+uv pip install defusedxml+```++See [openpyxl security guidance](https://openpyxl.readthedocs.io/en/stable/index.html#security).+## Important Requirements-**LibreOffice Required for Formula Recalculation**: You can assume LibreOffice is installed for recalculating formula values using the `scripts/recalc.py` script. The script automatically configures LibreOffice on first run, including in sandboxed environments where Unix sockets are restricted (handled by `scripts/office/soffice.py`)+**LibreOffice required for formula recalculation**: Assume LibreOffice is installed for recalculating formula values using `scripts/recalc.py`. The script configures LibreOffice on first run, including in sandboxed environments where Unix sockets are restricted (handled by `scripts/office/soffice.py`).++**System dependencies** (not installed via uv):++| Tool | Purpose |+|------|---------|+| `soffice` (LibreOffice 7.x+) | Evaluates Excel formulas via `scripts/recalc.py` |+| `gcc` | Only when Unix domain sockets are blocked; compiles a one-time shim into `~/.cache/xlsx-skill/lo-shim/` |+| `gtimeout` (macOS, optional) | GNU coreutils `timeout` for recalc timeout support on Darwin |++Verify LibreOffice is available: `soffice --version`## Reading and analyzing data@@ -81,10 +115,13 @@ For data analysis, visualization, and basic operations, use **pandas** which pro```pythonimport pandas as pd-# Read Excel+# Read Excel (.xlsx default engine: openpyxl)df = pd.read_excel('file.xlsx') # Default: first sheetall_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict+# Optional: calamine engine (pandas 2.2+) — faster, supports .xlsx/.xls/.xlsb/.xlsm/.ods+# df = pd.read_excel('file.xlsx', engine='calamine')+# Analyzedf.head() # Preview datadf.info() # Column info@@ -134,9 +171,9 @@ This applies to ALL calculations - totals, percentages, ratios, differences, etc2. **Create/Load**: Create new workbook or load existing file3. **Modify**: Add/edit data, formulas, and formatting4. **Save**: Write to file-5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the scripts/recalc.py script+5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the `scripts/recalc.py` script```bash- python scripts/recalc.py output.xlsx+ python scientific-skills/xlsx/scripts/recalc.py output.xlsx```6. **Verify and fix any errors**:- The script returns JSON with error details@@ -209,12 +246,12 @@ wb.save('modified.xlsx')Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided `scripts/recalc.py` script to recalculate formulas:```bash-python scripts/recalc.py <excel_file> [timeout_seconds]+python scientific-skills/xlsx/scripts/recalc.py <excel_file> [timeout_seconds]```Example:```bash-python scripts/recalc.py output.xlsx 30+python scientific-skills/xlsx/scripts/recalc.py output.xlsx 30```The script:@@ -266,7 +303,7 @@ The script returns JSON with error details:### Library Selection- **pandas**: Best for data analysis, bulk operations, and simple data export-- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features+- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features (current stable: 3.1.5)### Working with openpyxl- Cell indices are 1-based (row=1, column=1 refers to cell A1)diff --git a/scientific-skills/xlsx/scripts/office/soffice.py b/scientific-skills/xlsx/scripts/office/soffice.pyindex c7f7e328..cc659720 100644--- a/scientific-skills/xlsx/scripts/office/soffice.py+++ b/scientific-skills/xlsx/scripts/office/soffice.py@@ -14,15 +14,37 @@ Usage:subprocess.run(["soffice", ...], env=env)"""+import hashlibimport osimport socketimport subprocess-import tempfilefrom pathlib import Path+# User-owned cache dir (mode 0700) — not world-writable /tmp+_SHIM_DIR = (+ Path(os.environ.get("XDG_CACHE_HOME", Path.home() / ".cache"))+ / "xlsx-skill"+ / "lo-shim"+)+_SHIM_SO = _SHIM_DIR / "lo_socket_shim.so"+_SHIM_HASH_FILE = _SHIM_DIR / "lo_socket_shim.sha256"++_SOFFICE_ENV_KEYS = (+ "PATH",+ "HOME",+ "LANG",+ "LC_ALL",+ "LC_CTYPE",+ "TMPDIR",+ "TMP",+ "TEMP",+ "USER",+)+def get_soffice_env() -> dict:- env = os.environ.copy()+ """Return a minimal env for LibreOffice — avoids copying secrets from os.environ."""+ env = {key: os.environ[key] for key in _SOFFICE_ENV_KEYS if key in os.environ}env["SAL_USE_VCLPLUGIN"] = "svp"if _needs_shim():@@ -37,8 +59,8 @@ def run_soffice(args: list[str], **kwargs) -> subprocess.CompletedProcess:return subprocess.run(["soffice"] + args, env=env, **kwargs)--_SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so"+def _shim_source_hash() -> str:+ return hashlib.sha256(_SHIM_SOURCE.encode()).hexdigest()def _needs_shim() -> bool:@@ -51,21 +73,33 @@ def _needs_shim() -> bool:def _ensure_shim() -> Path:- if _SHIM_SO.exists():- return _SHIM_SO+ _SHIM_DIR.mkdir(parents=True, exist_ok=True)+ os.chmod(_SHIM_DIR, 0o700)++ expected_hash = _shim_source_hash()++ if _SHIM_SO.exists() and _SHIM_HASH_FILE.exists():+ stored_hash = _SHIM_HASH_FILE.read_text().strip()+ if stored_hash == expected_hash:+ os.chmod(_SHIM_SO, 0o700)+ return _SHIM_SO+ _SHIM_SO.unlink(missing_ok=True)- src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"+ src = _SHIM_DIR / "lo_socket_shim.c"src.write_text(_SHIM_SOURCE)+ os.chmod(src, 0o600)subprocess.run(["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],check=True,capture_output=True,)- src.unlink()+ src.unlink(missing_ok=True)+ os.chmod(_SHIM_SO, 0o700)+ _SHIM_HASH_FILE.write_text(expected_hash)+ os.chmod(_SHIM_HASH_FILE, 0o600)return _SHIM_SO-_SHIM_SOURCE = r"""#define _GNU_SOURCE#include <dlfcn.h>@@ -176,8 +210,8 @@ int close(int fd) {"""-if __name__ == "__main__":import sys+result = run_soffice(sys.argv[1:])sys.exit(result.returncode)diff --git a/scientific-skills/xlsx/scripts/recalc.py b/scientific-skills/xlsx/scripts/recalc.pyindex f472e9a5..ae22b099 100755--- a/scientific-skills/xlsx/scripts/recalc.py+++ b/scientific-skills/xlsx/scripts/recalc.py@@ -10,8 +10,11 @@ import subprocessimport sysfrom pathlib import Path-from office.soffice import get_soffice_env+_SCRIPT_DIR = Path(__file__).resolve().parent+if str(_SCRIPT_DIR) not in sys.path:+ sys.path.insert(0, str(_SCRIPT_DIR))+from office.soffice import get_soffice_envfrom openpyxl import load_workbookMACRO_DIR_MACOS = "~/Library/Application Support/LibreOffice/4/user/basic/Standard"@@ -164,7 +167,7 @@ def recalc(filename, timeout=30):def main():if len(sys.argv) < 2:print("Usage: python recalc.py <excel_file> [timeout_seconds]")- print("\nRecalculates all formulas in an Excel file using LibreOffice")+ print("\nRecalculates all formulas in an Excel file using LibreOffice (soffice)")print("\nReturns JSON with error details:")print(" - status: 'success' or 'errors_found'")print(" - total_errors: Total number of Excel errors found")diff --git a/scientific-skills/zarr-python/SKILL.md b/scientific-skills/zarr-python/SKILL.mdindex 25e53699..cc2a7805 100644--- a/scientific-skills/zarr-python/SKILL.md+++ b/scientific-skills/zarr-python/SKILL.md@@ -1,7 +1,9 @@---name: zarr-python-description: Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.+description: Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I/O, S3/GCS via fsspec, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.+allowed-tools: Read Write Edit Bashlicense: MIT license+compatibility: Requires Python 3.12+ and zarr 3.x. Cloud I/O needs zarr[remote] plus s3fs or gcsfs. Legacy Zarr v2 workflows use zarr==2.* on older Python.metadata:skill-author: K-Dense Inc.---@@ -12,20 +14,26 @@ metadata:Zarr is a Python library for storing large N-dimensional arrays with chunking and compression. Apply this skill for efficient parallel I/O, cloud-native workflows, and seamless integration with NumPy, Dask, and Xarray.+**Current upstream:** zarr **3.2.1** (PyPI, May 2026). Docs: [zarr.readthedocs.io](https://zarr.readthedocs.io/en/stable/). New arrays default to **Zarr format 3**; set `zarr_format=2` for legacy interop. This skill is a **community guide** maintained by K-Dense Inc., not an official zarr-developers package.+## Quick Start### Installation```bash-uv pip install zarr+uv pip install "zarr>=3.2,<4"```-Requires Python 3.11+. For cloud storage support, install additional packages:-```python-uv pip install s3fs # For S3-uv pip install gcsfs # For Google Cloud Storage+Requires **Python 3.12+** (per PyPI metadata for zarr 3.2.x). For remote stores (S3, GCS, HTTP):++```bash+uv pip install "zarr[remote]"+uv pip install s3fs # AWS S3+uv pip install gcsfs # Google Cloud Storage```+Pin `zarr>=3,<4` in application dependencies. Use `uv pip install "zarr==2.*"` only when you must stay on Zarr-Python 2 / Python 3.10–3.11.+### Basic Array Creation```python@@ -108,8 +116,8 @@ z.blocks[0, 0] # Block/chunk indexing### Resizing and Appending```python-# Resize array-z.resize(15000, 15000) # Expands or shrinks dimensions+# Resize array (v3: pass shape as a tuple)+z.resize((15000, 15000))# Append data along an axisz.append(np.random.random((1000, 10000)), axis=0) # Adds rows@@ -159,8 +167,7 @@ z = zarr.zeros((10000, 10000), chunks=(1000, 1000)) # Square chunksWhen arrays have millions of small chunks, use sharding to group chunks into larger storage objects:```python-from zarr.codecs import ShardingCodec, BytesCodec-from zarr.codecs.blosc import BloscCodec+from zarr.codecs import BloscCodec, BytesCodec, ShardingCodec# Create array with shardingz = zarr.create_array(@@ -186,8 +193,7 @@ Zarr applies compression per chunk to reduce storage while maintaining fast acce### Configuring Compression```python-from zarr.codecs.blosc import BloscCodec-from zarr.codecs import GzipCodec, ZstdCodec+from zarr.codecs import BloscCodec, GzipCodec, ZstdCodec, BytesCodec# Default: Blosc with Zstandardz = zarr.zeros((1000, 1000), chunks=(100, 100)) # Uses default compression@@ -291,23 +297,37 @@ store.close()### Cloud Storage (S3, GCS)+Zarr 3 uses **fsspec** backends via URI strings or `FsspecStore` (preferred over legacy `S3Map`/`GCSMap`).+```python-import s3fsimport zarr-# S3 storage-s3 = s3fs.S3FileSystem(anon=False) # Use credentials-store = s3fs.S3Map(root='my-bucket/path/to/array.zarr', s3=s3)-z = zarr.open_array(store=store, mode='w', shape=(1000, 1000), chunks=(100, 100))+# S3 — credentials from standard AWS env vars (scope reads to these keys only)+# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION+z = zarr.create_array(+ store="s3://my-bucket/path/to/array.zarr",+ shape=(1000, 1000),+ chunks=(100, 100),+ dtype="f4",+ storage_options={"anon": False},+)z[:] = data-# Google Cloud Storage-import gcsfs-gcs = gcsfs.GCSFileSystem(project='my-project')-store = gcsfs.GCSMap(root='my-bucket/path/to/array.zarr', gcs=gcs)-z = zarr.open_array(store=store, mode='w', shape=(1000, 1000), chunks=(100, 100))+# GCS — GOOGLE_APPLICATION_CREDENTIALS or gcloud default credentials+z = zarr.open_array(+ "gs://my-bucket/path/to/array.zarr",+ mode="r",+ storage_options={"project": "my-project"},+)++# Explicit store (any fsspec filesystem)+from zarr.storage import FsspecStore+store = FsspecStore.from_url("s3://my-bucket/data.zarr", storage_options={"anon": False})+root = zarr.open_group(store=store, mode="r+")```+Cloud backends read credentials from provider environment variables locally via fsspec; they are not sent to third-party endpoints outside your configured bucket/project.+**Cloud Storage Best Practices**:- Use consolidated metadata to reduce latency: `zarr.consolidate_metadata(store)`- Align chunk sizes with cloud object sizing (typically 5-100 MB optimal)@@ -356,19 +376,16 @@ print(root.tree())# └── prcp (365, 720, 1440) f4```-### H5py-Compatible API+### Group API (v3)-Zarr provides an h5py-compatible interface for familiar HDF5 users:+Use `create_array` / `require_array` (h5py-style `create_dataset` / `require_dataset` were removed in v3):```python-# Create group with h5py-style methodsroot = zarr.group('data.zarr')-dataset = root.create_dataset('my_data', shape=(1000, 1000), chunks=(100, 100),- dtype='f4')+arr = root.create_array('my_data', shape=(1000, 1000), chunks=(100, 100), dtype='f4')-# Access like h5pygrp = root.require_group('subgroup')-arr = grp.require_dataset('array', shape=(500, 500), chunks=(50, 50), dtype='i4')+arr2 = grp.require_array('array', shape=(500, 500), chunks=(50, 50), dtype='i4')```## Attributes and Metadata@@ -490,41 +507,15 @@ ds.to_zarr('climate_data.zarr')- Integration with pandas for time series- NetCDF-like interface familiar to climate/geospatial scientists-## Parallel Computing and Synchronization+## Parallel Computing and Thread Safety-### Thread-Safe Operations+The `synchronizer` argument (`ThreadSynchronizer`, `ProcessSynchronizer`) is **not ported to Zarr-Python 3** yet. Use these patterns instead:-```python-from zarr import ThreadSynchronizer-import zarr+- **Reads:** always safe across threads/processes.+- **Writes:** safe when each worker writes to **non-overlapping chunks**; most stores support atomic chunk writes.+- **Overlapping writes:** coordinate externally (file locks, workflow design) until synchronizers return.-# For multi-threaded writes-synchronizer = ThreadSynchronizer()-z = zarr.open_array('data.zarr', mode='r+', shape=(10000, 10000),- chunks=(1000, 1000), synchronizer=synchronizer)--# Safe for concurrent writes from multiple threads-# (when writes don't span chunk boundaries)-```--### Process-Safe Operations--```python-from zarr import ProcessSynchronizer-import zarr--# For multi-process writes-synchronizer = ProcessSynchronizer('sync_data.sync')-z = zarr.open_array('data.zarr', mode='r+', shape=(10000, 10000),- chunks=(1000, 1000), synchronizer=synchronizer)--# Safe for concurrent writes from multiple processes-```--**Note**:-- Concurrent reads require no synchronization-- Synchronization only needed for writes that may span chunk boundaries-- Each process/thread writing to separate chunks needs no synchronization+For Dask-heavy workloads, tune Zarr async concurrency — see [Optimizing performance](https://zarr.readthedocs.io/en/stable/user-guide/performance/).## Consolidated Metadata@@ -581,7 +572,7 @@ root = zarr.open_consolidated('data.zarr')4. **Storage Backend**: Match to environment```python# Local: LocalStore (default)- # Cloud: S3Map/GCSMap with consolidated metadata+ # Cloud: fsspec URIs or FsspecStore + consolidated metadata# Temporary: MemoryStore```@@ -652,26 +643,20 @@ result = (dask_z @ dask_z.T).compute() # Parallel matrix multiply### Pattern: Cloud-Native Workflow```python-import s3fsimport zarr-# Write to S3-s3 = s3fs.S3FileSystem()-store = s3fs.S3Map(root='s3://my-bucket/data.zarr', s3=s3)--# Create array with appropriate chunking for cloud-z = zarr.open_array(store=store, mode='w',- shape=(10000, 10000),- chunks=(500, 500), # ~1MB chunks- dtype='f4')+path = "s3://my-bucket/data.zarr"+z = zarr.create_array(+ store=path,+ shape=(10000, 10000),+ chunks=(500, 500),+ dtype="f4",+ storage_options={"anon": False},+)z[:] = data-# Consolidate metadata for faster reads-zarr.consolidate_metadata(store)--# Read from S3 (anywhere, anytime)-store_read = s3fs.S3Map(root='s3://my-bucket/data.zarr', s3=s3)-z_read = zarr.open_consolidated(store_read)+zarr.consolidate_metadata(path)+z_read = zarr.open_consolidated(path, storage_options={"anon": False})subset = z_read[0:100, 0:100]```@@ -751,27 +736,25 @@ shards = (10000, 10000) # Groups many chunks### Issue: Concurrent Write Conflicts-**Solution**: Use synchronizers or ensure non-overlapping writes-```python-from zarr import ProcessSynchronizer+**Solution**: Design workflows so each process/thread writes to separate chunks. Zarr-Python 3 does not yet support `ThreadSynchronizer` / `ProcessSynchronizer`; see `references/v3_migration.md`.-sync = ProcessSynchronizer('sync.sync')-z = zarr.open_array('data.zarr', mode='r+', synchronizer=sync)+## Additional Resources-# Or design workflow so each process writes to separate chunks-```+### Bundled references-## Additional Resources+| File | Contents |+|------|----------|+| `references/api_reference.md` | Function signatures, stores, codecs, indexing |+| `references/v3_migration.md` | Zarr-Python 2→3 breaking changes and WIP features |-For detailed API documentation, advanced usage, and the latest updates:+### Official upstream-- **Official Documentation**: https://zarr.readthedocs.io/-- **Zarr Specifications**: https://zarr-specs.readthedocs.io/-- **GitHub Repository**: https://github.com/zarr-developers/zarr-python-- **Community Chat**: https://gitter.im/zarr-developers/community+- **Documentation**: https://zarr.readthedocs.io/en/stable/+- **3.0 migration guide**: https://zarr.readthedocs.io/en/stable/user-guide/v3_migration/+- **Storage backends**: https://zarr.readthedocs.io/en/stable/user-guide/storage/+- **Zarr specifications**: https://zarr-specs.readthedocs.io/+- **GitHub**: https://github.com/zarr-developers/zarr-python+- **Developer chat**: https://ossci.zulipchat.com/#narrow/channel/423692-Zarr-Python-**Related Libraries**:-- **Xarray**: https://docs.xarray.dev/ (labeled arrays)-- **Dask**: https://docs.dask.org/ (parallel computing)-- **NumCodecs**: https://numcodecs.readthedocs.io/ (compression codecs)+**Related libraries:** [Xarray](https://docs.xarray.dev/), [Dask](https://docs.dask.org/), [NumCodecs](https://numcodecs.readthedocs.io/)diff --git a/scientific-skills/zarr-python/references/api_reference.md b/scientific-skills/zarr-python/references/api_reference.mdindex 71f99577..0abbe4f1 100644--- a/scientific-skills/zarr-python/references/api_reference.md+++ b/scientific-skills/zarr-python/references/api_reference.md@@ -1,515 +1,159 @@# Zarr Python Quick Reference-This reference provides a concise overview of commonly used Zarr functions, parameters, and patterns for quick lookup during development.+Concise reference for **zarr 3.2.x**. See `references/v3_migration.md` for Zarr-Python 2→3 changes.-## Array Creation Functions+## Array Creation-### `zarr.zeros()` / `zarr.ones()` / `zarr.empty()`+### `zarr.zeros()` / `zarr.ones()` / `zarr.empty()` / `zarr.full()````python-zarr.zeros(shape, chunks=None, dtype='f8', store=None, compressor='default',- fill_value=0, order='C', filters=None)+zarr.zeros(shape, *, chunks=None, dtype='f8', store=None, compressors='default',+ fill_value=0, zarr_format=3)```-Create arrays filled with zeros, ones, or empty (uninitialized) values.-**Key parameters:**-- `shape`: Tuple defining array dimensions (e.g., `(1000, 1000)`)-- `chunks`: Tuple defining chunk dimensions (e.g., `(100, 100)`), or `None` for no chunking-- `dtype`: NumPy data type (e.g., `'f4'`, `'i8'`, `'bool'`)-- `store`: Storage location (string path, Store object, or `None` for memory)-- `compressor`: Compression codec or `None` for no compression--### `zarr.create_array()` / `zarr.create()`+### `zarr.create_array()````python-zarr.create_array(store, shape, chunks, dtype='f8', compressor='default',- fill_value=0, order='C', filters=None, overwrite=False)+zarr.create_array(store, *, shape, chunks, dtype='f8', compressors='default',+ filters=None, fill_value=0, zarr_format=3, storage_options=None,+ overwrite=False)```-Create a new array with explicit control over all parameters.### `zarr.array()````python-zarr.array(data, chunks=None, dtype=None, compressor='default', store=None)-```-Create array from existing data (NumPy array, list, etc.).--**Example:**-```python-import numpy as np-data = np.random.random((1000, 1000))-z = zarr.array(data, chunks=(100, 100), store='data.zarr')+zarr.array(data, *, chunks=None, dtype=None, store=None, compressors='default')```### `zarr.open_array()` / `zarr.open()````python-zarr.open_array(store, mode='a', shape=None, chunks=None, dtype=None,- compressor='default', fill_value=0)+zarr.open_array(store, mode='a', *, shape=None, chunks=None, dtype=None)+zarr.open(store, mode='r') # auto-detects Array or Group```-Open existing array or create new one.-**Mode options:**-- `'r'`: Read-only-- `'r+'`: Read-write, file must exist-- `'a'`: Read-write, create if doesn't exist (default)-- `'w'`: Create new, overwrite if exists-- `'w-'`: Create new, fail if exists+**Mode:** `'r'`, `'r+'`, `'a'` (default create-if-missing), `'w'` (overwrite), `'w-'` (create only).-## Storage Classes+## Storage (zarr.storage)++Built-in stores in v3: `LocalStore`, `MemoryStore`, `ZipStore`, `FsspecStore`, `ObjectStore`.-### LocalStore (Default)```python-from zarr.storage import LocalStore+from zarr.storage import LocalStore, MemoryStore, ZipStore, FsspecStore+# Local directory (default when passing a path string)store = LocalStore('path/to/data.zarr')-z = zarr.open_array(store=store, mode='w', shape=(1000, 1000), chunks=(100, 100))-```-### MemoryStore-```python-from zarr.storage import MemoryStore+# In-memory+store = MemoryStore()-store = MemoryStore() # Data only in memory-z = zarr.open_array(store=store, mode='w', shape=(1000, 1000), chunks=(100, 100))-```+# ZIP archive+store = ZipStore('data.zip', mode='w') # close when done writing-### ZipStore-```python-from zarr.storage import ZipStore--# Write-store = ZipStore('data.zip', mode='w')-z = zarr.open_array(store=store, mode='w', shape=(1000, 1000), chunks=(100, 100))-z[:] = data-store.close() # MUST close--# Read-store = ZipStore('data.zip', mode='r')-z = zarr.open_array(store=store)-data = z[:]-store.close()-```+# Cloud via fsspec URI (install zarr[remote] + s3fs/gcsfs)+store = FsspecStore.from_url('s3://bucket/path.zarr', storage_options={'anon': False})+group = zarr.open_group(store=store, mode='r')-### Cloud Storage (S3/GCS)-```python-# S3-import s3fs-s3 = s3fs.S3FileSystem(anon=False)-store = s3fs.S3Map(root='bucket/path/data.zarr', s3=s3)--# GCS-import gcsfs-gcs = gcsfs.GCSFileSystem(project='my-project')-store = gcsfs.GCSMap(root='bucket/path/data.zarr', gcs=gcs)+# Shorthand — pass URI directly to open/create+zarr.open_group('s3://bucket/data.zarr', mode='r', storage_options={'anon': True})```-## Compression Codecs--### Blosc Codec (Default)-```python-from zarr.codecs.blosc import BloscCodec--codec = BloscCodec(- cname='zstd', # Compressor: 'blosclz', 'lz4', 'lz4hc', 'snappy', 'zlib', 'zstd'- clevel=5, # Compression level: 0-9- shuffle='shuffle' # Shuffle filter: 'noshuffle', 'shuffle', 'bitshuffle'-)+**Removed in v3:** `DirectoryStore`, `FSStore`, `S3Map`, `GCSMap`, `DBMStore`, `LMDBStore`, `SQLiteStore`, `RedisStore`, `MongoDBStore`, `N5Store`.-z = zarr.create_array(store='data.zarr', shape=(1000, 1000), chunks=(100, 100),- dtype='f4', codecs=[codec])-```--**Blosc compressor characteristics:**-- `'lz4'`: Fastest compression, lower ratio-- `'zstd'`: Balanced (default), good ratio and speed-- `'zlib'`: Good compatibility, moderate performance-- `'lz4hc'`: Better ratio than lz4, slower-- `'snappy'`: Fast, moderate ratio-- `'blosclz'`: Blosc's default+## Compression (zarr.codecs)-### Other Codecs```python-from zarr.codecs import GzipCodec, ZstdCodec, BytesCodec+from zarr.codecs import BloscCodec, GzipCodec, ZstdCodec, BytesCodec-# Gzip compression (maximum ratio, slower)-GzipCodec(level=6) # Level 0-9--# Zstandard compression-ZstdCodec(level=3) # Level 1-22+# Default Blosc (zstd) is applied when compressors='default'+codec = BloscCodec(cname='zstd', clevel=5, shuffle='shuffle')+z = zarr.create_array('data.zarr', shape=(1000, 1000), chunks=(100, 100),+ dtype='f4', compressors=codec)# No compression-BytesCodec()+z = zarr.create_array('data.zarr', shape=(1000, 1000), chunks=(100, 100),+ dtype='f4', compressors=BytesCodec())```-## Array Indexing and Selection+For **Zarr format 2** arrays, import codecs from `numcodecs` instead of `zarr.codecs`.-### Basic Indexing (NumPy-style)-```python-z = zarr.zeros((1000, 1000), chunks=(100, 100))+## Indexing-# Read-row = z[0, :] # Single row-col = z[:, 0] # Single column-block = z[10:20, 50:60] # Slice-element = z[5, 10] # Single element--# Write-z[0, :] = 42+### Basic (NumPy-style)+```python+z[0:100, 0:100]z[10:20, 50:60] = np.random.random((10, 10))```-### Advanced Indexing+### Advanced (v3)```python-# Coordinate indexing (point selection)-z.vindex[[0, 5, 10], [2, 8, 15]] # Specific coordinates+z.vindex[[0, 5, 10], [2, 8, 15]] # coordinate (convenience)+z.get_coordinate_selection([0, 5, 10]) # explicit API-# Orthogonal indexing (outer product)-z.oindex[0:10, [5, 10, 15]] # Rows 0-9, columns 5, 10, 15+z.oindex[0:10, [5, 10, 15]] # orthogonal+z.get_orthogonal_selection((slice(0, 10), [5, 10, 15]))-# Block/chunk indexing-z.blocks[0, 0] # First chunk-z.blocks[0:2, 0:2] # First four chunks+z.blocks[0, 0] # chunk/block access```-## Groups and Hierarchies--### Creating Groups-```python-# Create root group-root = zarr.group(store='data.zarr')--# Create nested groups-grp1 = root.create_group('group1')-grp2 = grp1.create_group('subgroup')+## Groups-# Create arrays in groups-arr = grp1.create_array(name='data', shape=(1000, 1000),- chunks=(100, 100), dtype='f4')--# Access by path-arr2 = root['group1/data']-```--### Group Methods```pythonroot = zarr.group('data.zarr')+grp = root.create_group('temperature')+arr = grp.create_array('t2m', shape=(365, 720, 1440), chunks=(1, 720, 1440), dtype='f4')+sub = root['temperature/t2m']-# h5py-compatible methods-dataset = root.create_dataset('data', shape=(1000, 1000), chunks=(100, 100))-subgrp = root.require_group('subgroup') # Create if doesn't exist--# Visualize structure-print(root.tree())--# List contents-print(list(root.keys()))-print(list(root.groups()))-print(list(root.arrays()))+# v3 only — no create_dataset / require_dataset+arr2 = root.require_array('precip', shape=(100, 100), chunks=(10, 10), dtype='f4')```-## Array Attributes and Metadata+## Array properties and methods-### Working with Attributes```python-z = zarr.zeros((1000, 1000), chunks=(100, 100))--# Set attributes-z.attrs['units'] = 'meters'-z.attrs['description'] = 'Temperature data'-z.attrs['created'] = '2024-01-15'-z.attrs['version'] = 1.2-z.attrs['tags'] = ['climate', 'temperature']--# Read attributes-print(z.attrs['units'])-print(dict(z.attrs)) # All attributes as dict--# Update/delete-z.attrs['version'] = 2.0-del z.attrs['tags']+z.shape, z.chunks, z.dtype, z.size+z.nbytes # uncompressed logical size+z.nbytes_stored # stored (compressed) size+z.info # summary string+z.resize((1500, 1500)) # tuple shape, not separate args+z.append(new_data, axis=0)```-**Note:** Attributes must be JSON-serializable.--## Array Properties and Methods--### Properties-```python-z = zarr.zeros((1000, 1000), chunks=(100, 100), dtype='f4')--z.shape # (1000, 1000)-z.chunks # (100, 100)-z.dtype # dtype('float32')-z.size # 1000000-z.nbytes # 4000000 (uncompressed size in bytes)-z.nbytes_stored # Actual compressed size on disk-z.nchunks # 100 (number of chunks)-z.cdata_shape # Shape in terms of chunks: (10, 10)-```--### Methods-```python-# Information-print(z.info) # Detailed information about array-print(z.info_items()) # Info as list of tuples--# Resizing-z.resize(1500, 1500) # Change dimensions--# Appending-z.append(new_data, axis=0) # Add data along axis--# Copying-z2 = z.copy(store='new_location.zarr')-```--## Chunking Guidelines--### Chunk Size Calculation-```python-# For float32 (4 bytes per element):-# 1 MB = 262,144 elements-# 10 MB = 2,621,440 elements--# Examples for 1 MB chunks:-(512, 512) # For 2D: 512 × 512 × 4 = 1,048,576 bytes-(128, 128, 128) # For 3D: 128 × 128 × 128 × 4 = 8,388,608 bytes ≈ 8 MB-(64, 256, 256) # For 3D: 64 × 256 × 256 × 4 = 16,777,216 bytes ≈ 16 MB-```--### Chunking Strategies by Access Pattern--**Time series (sequential access along first dimension):**-```python-chunks=(1, 720, 1440) # One time step per chunk-```--**Row-wise access:**-```python-chunks=(10, 10000) # Small rows, span columns-```--**Column-wise access:**-```python-chunks=(10000, 10) # Span rows, small columns-```--**Random access:**-```python-chunks=(500, 500) # Balanced square chunks-```+## Metadata consolidation-**3D volumetric data:**```python-chunks=(64, 64, 64) # Cubic chunks for isotropic access+zarr.consolidate_metadata('data.zarr')+root = zarr.open_consolidated('data.zarr') # pass storage_options for cloud URIs```-## Integration APIs--### NumPy Integration-```python-import numpy as np--z = zarr.zeros((1000, 1000), chunks=(100, 100))--# Use NumPy functions-result = np.sum(z, axis=0)-mean = np.mean(z)-std = np.std(z)--# Convert to NumPy-arr = z[:] # Loads entire array into memory-```+## Integration-### Dask Integration```pythonimport dask.array as da+dask_arr = da.from_zarr('data.zarr')+da.to_zarr(dask_arr, 'output.zarr')-# Load Zarr as Dask array-dask_array = da.from_zarr('data.zarr')--# Compute operations in parallel-result = dask_array.mean(axis=0).compute()--# Write Dask array to Zarr-large_array = da.random.random((100000, 100000), chunks=(1000, 1000))-da.to_zarr(large_array, 'output.zarr')-```--### Xarray Integration-```pythonimport xarray as xr--# Open Zarr as Xarray Datasetds = xr.open_zarr('data.zarr')--# Write Xarray to Zarrds.to_zarr('output.zarr')--# Create with coordinates-ds = xr.Dataset(- {'temperature': (['time', 'lat', 'lon'], data)},- coords={- 'time': pd.date_range('2024-01-01', periods=365),- 'lat': np.arange(-90, 91, 1),- 'lon': np.arange(-180, 180, 1)- }-)-ds.to_zarr('climate.zarr')-```--## Parallel Computing--### Synchronizers-```python-from zarr import ThreadSynchronizer, ProcessSynchronizer--# Multi-threaded writes-sync = ThreadSynchronizer()-z = zarr.open_array('data.zarr', mode='r+', synchronizer=sync)--# Multi-process writes-sync = ProcessSynchronizer('sync.sync')-z = zarr.open_array('data.zarr', mode='r+', synchronizer=sync)-```--**Note:** Synchronization only needed for:-- Concurrent writes that may span chunk boundaries-- Not needed for reads (always safe)-- Not needed if each process writes to separate chunks--## Metadata Consolidation--```python-# Consolidate metadata (after creating all arrays/groups)-zarr.consolidate_metadata('data.zarr')--# Open with consolidated metadata (faster, especially on cloud)-root = zarr.open_consolidated('data.zarr')```-**Benefits:**-- Reduces I/O from N operations to 1-- Critical for cloud storage (reduces latency)-- Speeds up hierarchy traversal--**Cautions:**-- Can become stale if data updates-- Re-consolidate after modifications-- Not for frequently-updated datasets+## Thread / process safety (v3)-## Common Patterns--### Time Series with Growing Data-```python-# Start with empty first dimension-z = zarr.open('timeseries.zarr', mode='a',- shape=(0, 720, 1440),- chunks=(1, 720, 1440),- dtype='f4')--# Append new time steps-for new_timestep in data_stream:- z.append(new_timestep, axis=0)-```--### Processing Large Arrays in Chunks-```python-z = zarr.open('large_data.zarr', mode='r')+- Reads: safe without coordination.+- Writes: safe across workers when chunks do not overlap.+- `synchronizer=` / `ThreadSynchronizer` / `ProcessSynchronizer`: **not available in v3** (see migration reference).-# Process without loading entire array-for i in range(0, z.shape[0], 1000):- chunk = z[i:i+1000, :]- result = process(chunk)- save(result)-```+## Format versions-### Format Conversion Pipeline```python-# HDF5 → Zarr-import h5py-with h5py.File('data.h5', 'r') as h5:- z = zarr.array(h5['dataset'][:], chunks=(1000, 1000), store='data.zarr')--# Zarr → NumPy file-z = zarr.open('data.zarr', mode='r')-np.save('data.npy', z[:])--# Zarr → NetCDF (via Xarray)-ds = xr.open_zarr('data.zarr')-ds.to_netcdf('data.nc')+z = zarr.create_array(..., zarr_format=3) # default+z = zarr.create_array(..., zarr_format=2) # legacy interop```-## Performance Optimization Quick Checklist+## Common dtypes-1. **Chunk size**: 1-10 MB per chunk-2. **Chunk shape**: Align with access pattern-3. **Compression**:- - Fast: `BloscCodec(cname='lz4', clevel=1)`- - Balanced: `BloscCodec(cname='zstd', clevel=5)`- - Maximum: `GzipCodec(level=9)`-4. **Cloud storage**:- - Larger chunks (5-100 MB)- - Consolidate metadata- - Consider sharding-5. **Parallel I/O**: Use Dask for large operations-6. **Memory**: Process in chunks, don't load entire arrays--## Debugging and Profiling--```python-z = zarr.open('data.zarr', mode='r')--# Detailed information-print(z.info)--# Size statistics-print(f"Uncompressed: {z.nbytes / 1e6:.2f} MB")-print(f"Compressed: {z.nbytes_stored / 1e6:.2f} MB")-print(f"Ratio: {z.nbytes / z.nbytes_stored:.1f}x")--# Chunk information-print(f"Chunks: {z.chunks}")-print(f"Number of chunks: {z.nchunks}")-print(f"Chunk grid: {z.cdata_shape}")-```--## Common Data Types--```python-# Integers-'i1', 'i2', 'i4', 'i8' # Signed: 8, 16, 32, 64-bit-'u1', 'u2', 'u4', 'u8' # Unsigned: 8, 16, 32, 64-bit--# Floats-'f2', 'f4', 'f8' # 16, 32, 64-bit (half, single, double precision)--# Others-'bool' # Boolean-'c8', 'c16' # Complex: 64, 128-bit-'S10' # Fixed-length string (10 bytes)-'U10' # Unicode string (10 characters)-```--## Version Compatibility--Zarr-Python version 3.x supports both:-- **Zarr v2 format**: Legacy format, widely compatible-- **Zarr v3 format**: New format with sharding, improved metadata--Check format version:-```python-# Zarr automatically detects format version-z = zarr.open('data.zarr', mode='r')-# Format info available in metadata-```+`'f4'`, `'f8'`, `'i4'`, `'i8'`, `'u4'`, `'u8'`, `'bool'`, `'c8'`, `'c16'`-## Error Handling+## Errors```python-try:- z = zarr.open_array('data.zarr', mode='r')-except zarr.errors.PathNotFoundError:- print("Array does not exist")-except zarr.errors.ReadOnlyError:- print("Cannot write to read-only array")-except Exception as e:- print(f"Unexpected error: {e}")+import zarr.errors+# PathNotFoundError, ReadOnlyError, GroupNotFoundError — see zarr.errors module```diff --git a/scientific-skills/zarr-python/references/v3_migration.md b/scientific-skills/zarr-python/references/v3_migration.mdnew file mode 100644index 00000000..5aabc57b--- /dev/null+++ b/scientific-skills/zarr-python/references/v3_migration.md@@ -0,0 +1,97 @@+# Zarr-Python 3 Migration Quick Reference++Targets **zarr 3.2.x** (PyPI stable, May 2026). Official guide: [3.0 Migration Guide](https://zarr.readthedocs.io/en/stable/user-guide/v3_migration/).++## Version and format defaults++| Topic | Zarr-Python 2 | Zarr-Python 3 |+|-------|---------------|---------------|+| Pin while migrating downstream | `zarr>=2,<3` | `zarr>=3,<4` |+| Default on-disk format | Zarr v2 | Zarr v3 (`zarr_format=3`) |+| Write v2-compatible data | default | `zarr_format=2` on create/open |+| Python requirement | 3.9–3.11 (late 2.x) | **3.12+** (3.2.1 on PyPI) |++```python+# Keep writing Zarr format 2 arrays (interop with older tools)+z = zarr.create_array(store="data.zarr", shape=(1000, 1000), chunks=(100, 100),+ dtype="f4", zarr_format=2)+```++## Store imports and backends++```python+# v3 — stores live under zarr.storage+from zarr.storage import LocalStore, MemoryStore, ZipStore, FsspecStore+```++| v2 | v3 |+|----|-----|+| `DirectoryStore` | `LocalStore` |+| `FSStore` | `FsspecStore` |+| `TempStore` | `tempfile.TemporaryDirectory` + `LocalStore` |+| `S3Map` / `GCSMap` (s3fs/gcsfs) | Prefer `FsspecStore` or URI strings (see below) |+| `DBMStore`, `LMDBStore`, `SQLiteStore`, `RedisStore`, `MongoDBStore` | Removed — use `FsspecStore` or custom store |++### Cloud storage (recommended v3 pattern)++```python+import zarr++# URI + storage_options (requires s3fs for S3)+root = zarr.open_group(+ store="s3://my-bucket/path/data.zarr",+ mode="r",+ storage_options={"anon": False}, # uses AWS_* env vars via fsspec+)++# Explicit FsspecStore+from zarr.storage import FsspecStore+store = FsspecStore.from_url("s3://my-bucket/path/data.zarr", storage_options={"anon": False})+root = zarr.open_group(store=store, mode="r")+```++Install remote I/O extras: `uv pip install "zarr[remote]"` (pulls fsspec). Add `s3fs` or `gcsfs` for the target protocol.++## Codecs and compression++- Zarr v3 arrays: use `zarr.codecs.*` (e.g. `BloscCodec`, `GzipCodec`, `BytesCodec`) via `compressors=` on `create_array`.+- Zarr v2 arrays: `numcodecs` codecs still work; import from `numcodecs`, not `zarr.*`.+- `compressor=` kwarg on creation functions → use `compressors=` in v3.++```python+from zarr.codecs import BloscCodec++z = zarr.create_array(+ store="data.zarr", shape=(1000, 1000), chunks=(100, 100), dtype="f4",+ compressors=BloscCodec(cname="zstd", clevel=5, shuffle="shuffle"),+)+```++## Groups and h5py-style API++| v2 (removed in v3) | v3 replacement |+|--------------------|----------------|+| `group.create_dataset(...)` | `group.create_array(...)` |+| `group.require_dataset(...)` | `group.require_array(...)` |+| `group.foo` attribute access | `group["foo"]` only |++## Array operations++```python+# resize — pass a shape tuple, not separate dimension args+z.resize((15000, 15000)) # not z.resize(15000, 15000)+```++Advanced indexing: `vindex`, `oindex`, and `blocks` remain as convenience properties; equivalent methods are `get_coordinate_selection`, `get_orthogonal_selection`, etc.++## Not yet ported to v3 (avoid or expect errors)++From the [migration guide WIP list](https://zarr.readthedocs.io/en/stable/user-guide/v3_migration/#work-in-progress):++- `synchronizer` argument (`ThreadSynchronizer`, `ProcessSynchronizer`) — use separate chunks per writer or external coordination; see [performance guide — thread safety](https://zarr.readthedocs.io/en/stable/user-guide/performance/).+- `zarr.copy`, `zarr.copy_all`, `zarr.copy_store`, `Group.move`+- Object dtypes, ragged arrays, `cache_attrs`, `cache_metadata`, `chunk_store`++## Zarr-Python 2 support++Install last 2.x: `uv pip install "zarr==2.*"`. Maintenance lives on the `support/v2` branch (security fixes for ~6 months after 3.0).