cmipget 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. cmipget-0.1.0/.github/workflows/ci.yml +37 -0
  2. cmipget-0.1.0/.github/workflows/release.yml +96 -0
  3. cmipget-0.1.0/.gitignore +29 -0
  4. cmipget-0.1.0/AGENTS.md +14 -0
  5. cmipget-0.1.0/CHANGELOG.md +14 -0
  6. cmipget-0.1.0/CITATION.cff +39 -0
  7. cmipget-0.1.0/LICENSE +21 -0
  8. cmipget-0.1.0/PKG-INFO +198 -0
  9. cmipget-0.1.0/README.md +147 -0
  10. cmipget-0.1.0/README_zh.md +147 -0
  11. cmipget-0.1.0/llms.txt +11 -0
  12. cmipget-0.1.0/pyproject.toml +78 -0
  13. cmipget-0.1.0/skills/cmipget-agent/SKILL.md +75 -0
  14. cmipget-0.1.0/skills/cmipget-agent/references/cmip7-vs-cmip6.md +41 -0
  15. cmipget-0.1.0/src/cmipget/__init__.py +84 -0
  16. cmipget-0.1.0/src/cmipget/_job_worker.py +170 -0
  17. cmipget-0.1.0/src/cmipget/cli.py +924 -0
  18. cmipget-0.1.0/src/cmipget/client.py +340 -0
  19. cmipget-0.1.0/src/cmipget/cloud.py +528 -0
  20. cmipget-0.1.0/src/cmipget/downloader.py +933 -0
  21. cmipget-0.1.0/src/cmipget/exporter.py +154 -0
  22. cmipget-0.1.0/src/cmipget/jobs.py +333 -0
  23. cmipget-0.1.0/src/cmipget/mcp_server.py +729 -0
  24. cmipget-0.1.0/src/cmipget/models.py +396 -0
  25. cmipget-0.1.0/src/cmipget/planner.py +626 -0
  26. cmipget-0.1.0/src/cmipget/postprocess.py +16 -0
  27. cmipget-0.1.0/src/cmipget/prober.py +456 -0
  28. cmipget-0.1.0/src/cmipget/semantics.py +656 -0
  29. cmipget-0.1.0/src/cmipget/skill_helper.py +69 -0
  30. cmipget-0.1.0/src/cmipget/sources.py +729 -0
  31. cmipget-0.1.0/src/cmipget/stac.py +1274 -0
  32. cmipget-0.1.0/tests/test_cli_and_mcp.py +491 -0
  33. cmipget-0.1.0/tests/test_downloader_and_jobs.py +606 -0
  34. cmipget-0.1.0/tests/test_live_esgf.py +81 -0
  35. cmipget-0.1.0/tests/test_semantics.py +137 -0
  36. cmipget-0.1.0/tests/test_sources_prober_cloud.py +1099 -0
  37. cmipget-0.1.0/tests/test_stac.py +218 -0
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: Build and install wheel
24
+ run: |
25
+ python -m pip install --upgrade pip build
26
+ python -m build
27
+ WHEEL=$(ls dist/cmipget-*.whl)
28
+ python -m pip install "${WHEEL}[dev]"
29
+ - name: Lint with ruff
30
+ run: ruff check src tests
31
+ - name: Run offline test suite
32
+ run: pytest -v -m "not live"
33
+ - name: Smoke test CLI and bundled skill
34
+ run: |
35
+ cmipget --version
36
+ cmipget skill show --json >/dev/null
37
+ python -c "from cmipget.skill_helper import skill_source_dir; assert (skill_source_dir() / 'SKILL.md').is_file()"
@@ -0,0 +1,96 @@
1
+ name: Release & Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ publish_to_pypi:
9
+ description: "Publish built wheel and sdist to PyPI via Trusted Publisher"
10
+ type: boolean
11
+ default: false
12
+ release_tag:
13
+ description: "Optional existing GitHub Release tag (e.g. v0.1.0) to attach built assets"
14
+ type: string
15
+ default: ""
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+ - name: Check version matches release tag
29
+ if: github.event_name == 'release' || inputs.release_tag != ''
30
+ env:
31
+ RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.release_tag }}
32
+ run: |
33
+ python - <<'PY'
34
+ import os, tomllib
35
+ tag = os.environ["RELEASE_TAG"].lstrip("v")
36
+ py_ver = tomllib.load(open("pyproject.toml", "rb"))["project"]["version"]
37
+ print(f"tag={tag}, pyproject={py_ver}")
38
+ assert tag == py_ver, f"Version mismatch: tag={tag}, pyproject={py_ver}"
39
+ PY
40
+ - name: Build wheel and sdist
41
+ run: |
42
+ python -m pip install --upgrade pip build twine
43
+ python -m build
44
+ twine check --strict dist/*
45
+ - name: Verify built wheel
46
+ run: |
47
+ WHEEL=$(ls dist/cmipget-*.whl)
48
+ python -m pip install "${WHEEL}[dev]"
49
+ python - <<'PY'
50
+ import tomllib, cmipget
51
+ py_ver = tomllib.load(open("pyproject.toml", "rb"))["project"]["version"]
52
+ assert cmipget.__version__ == py_ver, f"{cmipget.__version__} != {py_ver}"
53
+ PY
54
+ ruff check src tests
55
+ pytest -v -m "not live"
56
+ cmipget --version
57
+ cmipget skill show --json >/dev/null
58
+ python -c "from cmipget.skill_helper import skill_source_dir; assert (skill_source_dir() / 'SKILL.md').is_file()"
59
+ - uses: actions/upload-artifact@v4
60
+ with:
61
+ name: dist
62
+ path: dist/*
63
+
64
+ publish:
65
+ needs: [build]
66
+ if: github.event_name == 'release' || inputs.publish_to_pypi
67
+ runs-on: ubuntu-latest
68
+ environment:
69
+ name: pypi
70
+ url: https://pypi.org/p/cmipget
71
+ permissions:
72
+ id-token: write
73
+ contents: write
74
+ steps:
75
+ - uses: actions/download-artifact@v4
76
+ with:
77
+ name: dist
78
+ path: dist
79
+ - uses: actions/setup-python@v5
80
+ with:
81
+ python-version: "3.12"
82
+ - name: Verify distributions with twine
83
+ run: |
84
+ python -m pip install --upgrade twine
85
+ ls -lh dist/
86
+ twine check --strict dist/*
87
+ - name: Publish to PyPI via Trusted Publisher
88
+ uses: pypa/gh-action-pypi-publish@release/v1
89
+ with:
90
+ packages-dir: dist/
91
+ - name: Attach wheel and sdist to GitHub Release
92
+ if: github.event_name == 'release' || inputs.release_tag != ''
93
+ uses: softprops/action-gh-release@v2
94
+ with:
95
+ tag_name: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.release_tag }}
96
+ files: dist/*
@@ -0,0 +1,29 @@
1
+ # Engramory local memory store
2
+ .engramory-memory/
3
+
4
+ # Python artifacts
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.egg-info/
8
+ .eggs/
9
+ build/
10
+ dist/
11
+ .venv/
12
+ venv/
13
+
14
+ # Testing and tooling caches
15
+ .pytest_cache/
16
+ .ruff_cache/
17
+ .mypy_cache/
18
+ .coverage
19
+ htmlcov/
20
+
21
+ # Local secrets, downloads, and temporary job state
22
+ .env
23
+ .env.*
24
+ *.part
25
+ .cmipget-jobs/
26
+
27
+ # OS and editor noise
28
+ .DS_Store
29
+ Thumbs.db
@@ -0,0 +1,14 @@
1
+ # AGENTS.md — Instructions for AI Agents
2
+
3
+ This repository provides **cmipget** (`cmip7` & `cmip6` ESGF-NG STAC downloader) and its Agent Skill **cmipget-agent**.
4
+
5
+ ## If a user asks you to download CMIP7 / CMIP6 data
6
+
7
+ 1. Read [skills/cmipget-agent/SKILL.md](skills/cmipget-agent/SKILL.md) and follow its 5-step workflow.
8
+ 2. Prefer **MCP tools** if configured (`cmipget mcp`), or run **CLI with `--json`** (`uvx cmipget ... --json` or `pip install cmipget` -> `cmipget ... --json`).
9
+ 3. Always inspect `plan --json` (`bytes_to_download`, `warnings`, `hints`) before downloading, confirm large batches (`>10 GB`) or ambiguous variants with the user, and run `verify --json` after download.
10
+
11
+ ## If you are developing this repository
12
+
13
+ - Keep code changes minimal, direct, and well-tested (`ruff check src tests` and `pytest -m "not live"`).
14
+ - Avoid speculative abstractions or unrequested options.
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to `cmipget` will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-11-28
6
+
7
+ ### Added
8
+ - Unified CMIP7 and CMIP6 data discovery and download engine on ESGF-NG STAC APIs (`discovery.west.esgf.io` and `discovery.east.esgf.io`).
9
+ - Four entrypoints sharing one Pydantic schema and safety guardrails: Python SDK (`CMIPClient`), CLI (`cmipget ... --json` with `acccmip6`-style aliases), MCP stdio server (`cmipget mcp`), and bundled Agent Skill (`cmipget-agent`).
10
+ - Cross-generation CMIP6↔CMIP7 semantic hints and CN/EN climate term resolution (`cmipget check`).
11
+ - Two-phase safe planning (`plan` -> `download`) with ambiguity warnings, `--one-member`, `--complete`, `--with-cell-measures`, year-range filtering, and 10 GB large-batch confirmation guard.
12
+ - Resilient async downloader with `.part` HTTP Range resume, toggleable multi-segment Range acceleration (`--segmented`), SHA-256 checksum verification, cross-node and checksum-verified CMIP6 Solr replica fallback, persistent host health/EWMA ranking, custom mirrors (`--mirror`), read-only local pool reuse (`--local-root`), and detached background jobs (`--background`).
13
+ - Opt-in THREDDS/time-gap probing (`--probe-missing`), offline manifest verification (`cmipget verify`), online retraction/update auditing (`cmipget audit`), external list exports (`urls`, `aria2c`, `wget`, `globus`, `opendap`, `kerchunk`), and Pangeo GCS/AWS CMIP6 cloud Zarr search/materialization (`cmipget cloud`, optional `cmipget[cloud]`).
14
+ - Security and portability hardening: SSRF guards on untrusted discovery endpoints, same-origin redirects and response caps, per-component symlink containment, cross-process file locks, portable relative paths in `manifest.json`, and environment-isolated proxy passing for background workers.
@@ -0,0 +1,39 @@
1
+ cff-version: 1.2.0
2
+ title: "cmipget: Agent-ready CMIP7 and CMIP6 climate model data downloader"
3
+ message: "If you use this software, please cite it using the metadata from this file."
4
+ type: software
5
+ authors:
6
+ - family-names: "Ren"
7
+ given-names: "Jie"
8
+ email: "renjie22@mails.ucas.ac.cn"
9
+ affiliation: "South China Sea Institute of Oceanology, Chinese Academy of Sciences; University of Chinese Academy of Sciences"
10
+ orcid: "https://orcid.org/0009-0000-2806-6771"
11
+ website: "https://www.researchgate.net/profile/Jie-Ren-126"
12
+ repository-code: "https://github.com/Radianjayjay/cmipget"
13
+ url: "https://github.com/Radianjayjay/cmipget"
14
+ abstract: >-
15
+ Agent-ready CMIP7 and CMIP6 climate model data downloader built directly on
16
+ the ESGF-NG STAC API. Provides a unified Python SDK, JSON-capable CLI,
17
+ Model Context Protocol (MCP) server, and Agent Skill with SHA-256
18
+ verification, resumable multi-segment Range downloads, multi-source
19
+ fallback, local pool reuse, retraction auditing, and Pangeo cloud Zarr
20
+ mirror support.
21
+ keywords:
22
+ - cmip7
23
+ - cmip6
24
+ - esgf
25
+ - stac
26
+ - climate
27
+ - netcdf
28
+ - mcp
29
+ - python
30
+ license: MIT
31
+ version: "0.1.0"
32
+ date-released: "2026-11-28"
33
+ contact:
34
+ - family-names: "Ren"
35
+ given-names: "Jie"
36
+ email: "renjie22@mails.ucas.ac.cn"
37
+ affiliation: "South China Sea Institute of Oceanology, Chinese Academy of Sciences; University of Chinese Academy of Sciences"
38
+ orcid: "https://orcid.org/0009-0000-2806-6771"
39
+ website: "https://www.researchgate.net/profile/Jie-Ren-126"
cmipget-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jie Ren (cmipget contributors)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cmipget-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.5
2
+ Name: cmipget
3
+ Version: 0.1.0
4
+ Summary: Agent-ready CMIP7 & CMIP6 data downloader (Python SDK, CLI, MCP server, and Agent Skill)
5
+ Project-URL: Homepage, https://github.com/Radianjayjay/cmipget
6
+ Project-URL: Repository, https://github.com/Radianjayjay/cmipget
7
+ Project-URL: Issues, https://github.com/Radianjayjay/cmipget/issues
8
+ Project-URL: Changelog, https://github.com/Radianjayjay/cmipget/blob/main/CHANGELOG.md
9
+ Project-URL: ORCID, https://orcid.org/0009-0000-2806-6771
10
+ Project-URL: ResearchGate, https://www.researchgate.net/profile/Jie-Ren-126
11
+ Author-email: Jie Ren <renjie22@mails.ucas.ac.cn>
12
+ License: MIT
13
+ License-File: LICENSE
14
+ Keywords: climate,cmip6,cmip7,esgf,mcp,netcdf,stac
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: httpx>=0.27
28
+ Requires-Dist: mcp<3,>=1.10
29
+ Requires-Dist: pydantic>=2.0
30
+ Requires-Dist: rich>=13.0
31
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
32
+ Requires-Dist: typer>=0.19
33
+ Provides-Extra: cloud
34
+ Requires-Dist: aiohttp>=3.11; extra == 'cloud'
35
+ Requires-Dist: cftime>=1.6; extra == 'cloud'
36
+ Requires-Dist: fsspec>=2024.1; extra == 'cloud'
37
+ Requires-Dist: gcsfs>=2024.1; extra == 'cloud'
38
+ Requires-Dist: h5netcdf>=1.3; extra == 'cloud'
39
+ Requires-Dist: s3fs>=2024.1; extra == 'cloud'
40
+ Requires-Dist: xarray>=2025.1; extra == 'cloud'
41
+ Requires-Dist: zarr>=2.16; extra == 'cloud'
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
44
+ Requires-Dist: pytest>=8.0; extra == 'dev'
45
+ Requires-Dist: ruff>=0.6; extra == 'dev'
46
+ Provides-Extra: subset
47
+ Requires-Dist: cftime>=1.6; extra == 'subset'
48
+ Requires-Dist: h5netcdf>=1.3; extra == 'subset'
49
+ Requires-Dist: xarray>=2024.1; extra == 'subset'
50
+ Description-Content-Type: text/markdown
51
+
52
+ # cmipget
53
+
54
+ [![CI](https://github.com/Radianjayjay/cmipget/actions/workflows/ci.yml/badge.svg)](https://github.com/Radianjayjay/cmipget/actions/workflows/ci.yml)
55
+ [![PyPI](https://img.shields.io/pypi/v/cmipget.svg)](https://pypi.org/project/cmipget/)
56
+ [![Python](https://img.shields.io/pypi/pyversions/cmipget.svg)](https://pypi.org/project/cmipget/)
57
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
58
+
59
+ **Agent-ready CMIP7 & CMIP6 climate model data downloader** — one core engine with four entrypoints: **Python SDK**, **CLI**, **MCP Server**, and **Agent Skill (`cmipget-agent`)**.
60
+
61
+ Built directly on the modern **ESGF-NG STAC API** (`discovery.west.esgf.io` & `discovery.east.esgf.io`) to succeed legacy `acccmip6` / Solr workflows for both **CMIP7** and **CMIP6**.
62
+
63
+ [中文文档 (README_zh.md)](README_zh.md)
64
+
65
+ ---
66
+
67
+ ## Use with AI Agents (No Coding Required)
68
+
69
+ Even if you do not write code, you can paste this repository URL (or `cmipget`) to an AI coding/desktop agent (Claude Code, Codex, Cursor, Antigravity, Cherry Studio, etc.) and describe what data you want in plain English or Chinese:
70
+
71
+ > *"Use https://github.com/Radianjayjay/cmipget (or `uvx cmipget`) and follow `skills/cmipget-agent/SKILL.md` to check available CMIP7 monthly near-surface air temperature (`tas`) for `historical`, show me the size first, and download one member per model into `./data`."*
72
+
73
+ - **Terminal Agents**: zero-install via `uvx cmipget ... --json`, or install the bundled skill:
74
+ ```bash
75
+ pip install cmipget
76
+ cmipget skill install --target agents # or: claude | codex | cursor | antigravity
77
+ ```
78
+ - **MCP Clients**: print ready-to-paste MCP server config:
79
+ ```bash
80
+ cmipget mcp config
81
+ ```
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "cmipget": {
86
+ "command": "uvx",
87
+ "args": ["cmipget", "mcp"]
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Key Features
96
+
97
+ - **CMIP7 + CMIP6 Unified Engine**: defaults to `cmip7` (`MIP-DRS7`, `branding_suffix`, `region`) and seamlessly supports `-p cmip6` (`table_id`) or `-p all` cross-generation search.
98
+ - **Cross-Generation Hints & CN/EN Term Resolution**: detects legacy CMIP6 habits (`ssp245`, `Amon`) in CMIP7 queries and suggests exact replacements (`scen7-m`, `frequency=mon + realm=atmos`) without silent guessing; resolves Chinese/English climate terms (`地表气温` -> `tas`, `高排放` -> `scen7-h` / `ssp585`).
99
+ - **Two-Phase Safe Planning (`plan` -> `download`)**: estimates file counts, total GB, free disk space, and flags variant/branding/grid ambiguities (`--one-member` picks `r1i1p1f1` / lowest member). MCP and CLI enforce a `10 GB` confirmation guard by default.
100
+ - **Resilient Download Engine**:
101
+ - Async concurrency, `.part` HTTP `Range` resume, atomic commit, and **automatic SHA-256 verification** (`file:checksum` multihash).
102
+ - **Toggleable multi-segment Range parallel download (`--segmented`)** to accelerate throttled ESGF single-stream servers on large `.nc` files.
103
+ - **Multi-Source Resilience & Provenance**: persistent host health & EWMA speed ranking (`host_stats.json`), cross-node STAC + CMIP6 legacy ESGF Solr checksum-verified replica fallback (`--solr-fallback`), user-configurable mirrors (`--mirror` / `~/.config/cmipget/mirrors.toml`), shared read-only pool reuse (`--local-root`), `--complete` multi-experiment/variable filtering, `--with-cell-measures` (`areacello`/`areacella`), opt-in `--probe-missing` (THREDDS `catalog.xml` + time-gap URL probing marked unverified), `cmipget audit` retraction/update checks, and Pangeo GCS/AWS CMIP6 cloud Zarr search & NetCDF export (`cmipget cloud search` / `cmipget cloud download` via `cmipget[cloud]`).
104
+ - Directory-locked `manifest.json` + offline `cmipget verify`, detached background jobs (`--background`), and exports to `urls`, `aria2c`, `wget`, `globus`, `opendap`, and `kerchunk`.
105
+
106
+ ---
107
+
108
+ ## Installation
109
+
110
+ ```bash
111
+ pip install cmipget
112
+ # Optional third-party Pangeo GCS/AWS cloud Zarr NetCDF export:
113
+ pip install "cmipget[cloud]"
114
+ # or run without global install:
115
+ uvx cmipget --help
116
+ ```
117
+
118
+ ---
119
+
120
+ ## CLI Quickstart
121
+
122
+ `cmipget` supports both explicit flags and `acccmip6`-style short flags (`-m`, `-e`, `-v`, `-f`, `-r`, `-yr`, `-rlzn`), and every command accepts `--json`:
123
+
124
+ ```bash
125
+ # 1. Resolve Chinese/English terms or validate query flags
126
+ cmipget check "地表气温" "高排放" -p cmip7
127
+
128
+ # 2. Explore live models/experiments/variables on ESGF-NG
129
+ cmipget facets -p cmip7 -v tas
130
+
131
+ # 3. Search datasets
132
+ cmipget search -p cmip7 -e historical -v tas -f mon --one-member
133
+
134
+ # 4. Preview download size, disk check, and warnings
135
+ cmipget plan -o ./cmip_data -p cmip7 -m ACCESS-ESM1-6 -e historical -v tas -f mon -yr 1990-2014
136
+
137
+ # 5. Download (add --segmented for multi-segment Range acceleration on large files)
138
+ cmipget download -o ./cmip_data -p cmip7 -m ACCESS-ESM1-6 -e historical -v tas -f mon --one-member --segmented
139
+
140
+ # 6. Background job for multi-GB batches
141
+ cmipget download -o ./cmip_data -p cmip6 -e ssp245 -v tas -t Amon --one-member --yes --background
142
+ cmipget jobs list
143
+
144
+ # 7. Verify local files against manifest.json, audit for retractions/updates, & export external lists
145
+ cmipget verify ./cmip_data
146
+ cmipget audit ./cmip_data
147
+ cmipget export --format aria2c --out-file cmip.aria2 -p cmip7 -e historical -v tas -f mon
148
+
149
+ # 8. Third-party Pangeo GCS/AWS CMIP6 cloud Zarr mirrors
150
+ cmipget cloud search -v tos -e historical -t Omon --one-member
151
+ cmipget cloud download -v tos -e historical -t Omon -m CanESM5 -yr 2000-2014 --provider gcs --max-stores 1 -o ./cmip_data
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Python SDK Quickstart
157
+
158
+ ```python
159
+ from cmipget import CMIPClient, DownloadConfig, Query
160
+
161
+ client = CMIPClient()
162
+ query = Query(
163
+ project="cmip7",
164
+ source_id=["ACCESS-ESM1-6"],
165
+ experiment_id=["historical"],
166
+ variable_id=["tas"],
167
+ frequency=["mon"],
168
+ years="2000-2014",
169
+ one_member=True,
170
+ )
171
+
172
+ plan = client.plan_sync(query, output_dir="./cmip_data", layout="compact")
173
+ print(f"Files: {plan.files_to_download}, Bytes: {plan.bytes_to_download}")
174
+
175
+ report = client.download_sync(
176
+ plan,
177
+ config=DownloadConfig(concurrency=4, segmented=True, segment_count=4),
178
+ )
179
+ print(client.verify("./cmip_data"))
180
+ ```
181
+
182
+ ## Citation
183
+
184
+ If you use `cmipget` in research, please cite this software (metadata in [CITATION.cff](CITATION.cff)):
185
+
186
+ > Ren, J. (2026). *cmipget: Agent-ready CMIP7 and CMIP6 climate model data downloader* (Version 0.1.0) [Computer software]. GitHub. https://github.com/Radianjayjay/cmipget
187
+
188
+ ## Author
189
+
190
+ Jie Ren, South China Sea Institute of Oceanology, Chinese Academy of Sciences / University of Chinese Academy of Sciences.
191
+
192
+ - Email: `renjie22@mails.ucas.ac.cn`
193
+ - ORCID: [0009-0000-2806-6771](https://orcid.org/0009-0000-2806-6771)
194
+ - ResearchGate: [Jie Ren](https://www.researchgate.net/profile/Jie-Ren-126)
195
+
196
+ ## License
197
+
198
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,147 @@
1
+ # cmipget
2
+
3
+ [![CI](https://github.com/Radianjayjay/cmipget/actions/workflows/ci.yml/badge.svg)](https://github.com/Radianjayjay/cmipget/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/cmipget.svg)](https://pypi.org/project/cmipget/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/cmipget.svg)](https://pypi.org/project/cmipget/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+
8
+ **Agent-ready CMIP7 & CMIP6 climate model data downloader** — one core engine with four entrypoints: **Python SDK**, **CLI**, **MCP Server**, and **Agent Skill (`cmipget-agent`)**.
9
+
10
+ Built directly on the modern **ESGF-NG STAC API** (`discovery.west.esgf.io` & `discovery.east.esgf.io`) to succeed legacy `acccmip6` / Solr workflows for both **CMIP7** and **CMIP6**.
11
+
12
+ [中文文档 (README_zh.md)](README_zh.md)
13
+
14
+ ---
15
+
16
+ ## Use with AI Agents (No Coding Required)
17
+
18
+ Even if you do not write code, you can paste this repository URL (or `cmipget`) to an AI coding/desktop agent (Claude Code, Codex, Cursor, Antigravity, Cherry Studio, etc.) and describe what data you want in plain English or Chinese:
19
+
20
+ > *"Use https://github.com/Radianjayjay/cmipget (or `uvx cmipget`) and follow `skills/cmipget-agent/SKILL.md` to check available CMIP7 monthly near-surface air temperature (`tas`) for `historical`, show me the size first, and download one member per model into `./data`."*
21
+
22
+ - **Terminal Agents**: zero-install via `uvx cmipget ... --json`, or install the bundled skill:
23
+ ```bash
24
+ pip install cmipget
25
+ cmipget skill install --target agents # or: claude | codex | cursor | antigravity
26
+ ```
27
+ - **MCP Clients**: print ready-to-paste MCP server config:
28
+ ```bash
29
+ cmipget mcp config
30
+ ```
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "cmipget": {
35
+ "command": "uvx",
36
+ "args": ["cmipget", "mcp"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Key Features
45
+
46
+ - **CMIP7 + CMIP6 Unified Engine**: defaults to `cmip7` (`MIP-DRS7`, `branding_suffix`, `region`) and seamlessly supports `-p cmip6` (`table_id`) or `-p all` cross-generation search.
47
+ - **Cross-Generation Hints & CN/EN Term Resolution**: detects legacy CMIP6 habits (`ssp245`, `Amon`) in CMIP7 queries and suggests exact replacements (`scen7-m`, `frequency=mon + realm=atmos`) without silent guessing; resolves Chinese/English climate terms (`地表气温` -> `tas`, `高排放` -> `scen7-h` / `ssp585`).
48
+ - **Two-Phase Safe Planning (`plan` -> `download`)**: estimates file counts, total GB, free disk space, and flags variant/branding/grid ambiguities (`--one-member` picks `r1i1p1f1` / lowest member). MCP and CLI enforce a `10 GB` confirmation guard by default.
49
+ - **Resilient Download Engine**:
50
+ - Async concurrency, `.part` HTTP `Range` resume, atomic commit, and **automatic SHA-256 verification** (`file:checksum` multihash).
51
+ - **Toggleable multi-segment Range parallel download (`--segmented`)** to accelerate throttled ESGF single-stream servers on large `.nc` files.
52
+ - **Multi-Source Resilience & Provenance**: persistent host health & EWMA speed ranking (`host_stats.json`), cross-node STAC + CMIP6 legacy ESGF Solr checksum-verified replica fallback (`--solr-fallback`), user-configurable mirrors (`--mirror` / `~/.config/cmipget/mirrors.toml`), shared read-only pool reuse (`--local-root`), `--complete` multi-experiment/variable filtering, `--with-cell-measures` (`areacello`/`areacella`), opt-in `--probe-missing` (THREDDS `catalog.xml` + time-gap URL probing marked unverified), `cmipget audit` retraction/update checks, and Pangeo GCS/AWS CMIP6 cloud Zarr search & NetCDF export (`cmipget cloud search` / `cmipget cloud download` via `cmipget[cloud]`).
53
+ - Directory-locked `manifest.json` + offline `cmipget verify`, detached background jobs (`--background`), and exports to `urls`, `aria2c`, `wget`, `globus`, `opendap`, and `kerchunk`.
54
+
55
+ ---
56
+
57
+ ## Installation
58
+
59
+ ```bash
60
+ pip install cmipget
61
+ # Optional third-party Pangeo GCS/AWS cloud Zarr NetCDF export:
62
+ pip install "cmipget[cloud]"
63
+ # or run without global install:
64
+ uvx cmipget --help
65
+ ```
66
+
67
+ ---
68
+
69
+ ## CLI Quickstart
70
+
71
+ `cmipget` supports both explicit flags and `acccmip6`-style short flags (`-m`, `-e`, `-v`, `-f`, `-r`, `-yr`, `-rlzn`), and every command accepts `--json`:
72
+
73
+ ```bash
74
+ # 1. Resolve Chinese/English terms or validate query flags
75
+ cmipget check "地表气温" "高排放" -p cmip7
76
+
77
+ # 2. Explore live models/experiments/variables on ESGF-NG
78
+ cmipget facets -p cmip7 -v tas
79
+
80
+ # 3. Search datasets
81
+ cmipget search -p cmip7 -e historical -v tas -f mon --one-member
82
+
83
+ # 4. Preview download size, disk check, and warnings
84
+ cmipget plan -o ./cmip_data -p cmip7 -m ACCESS-ESM1-6 -e historical -v tas -f mon -yr 1990-2014
85
+
86
+ # 5. Download (add --segmented for multi-segment Range acceleration on large files)
87
+ cmipget download -o ./cmip_data -p cmip7 -m ACCESS-ESM1-6 -e historical -v tas -f mon --one-member --segmented
88
+
89
+ # 6. Background job for multi-GB batches
90
+ cmipget download -o ./cmip_data -p cmip6 -e ssp245 -v tas -t Amon --one-member --yes --background
91
+ cmipget jobs list
92
+
93
+ # 7. Verify local files against manifest.json, audit for retractions/updates, & export external lists
94
+ cmipget verify ./cmip_data
95
+ cmipget audit ./cmip_data
96
+ cmipget export --format aria2c --out-file cmip.aria2 -p cmip7 -e historical -v tas -f mon
97
+
98
+ # 8. Third-party Pangeo GCS/AWS CMIP6 cloud Zarr mirrors
99
+ cmipget cloud search -v tos -e historical -t Omon --one-member
100
+ cmipget cloud download -v tos -e historical -t Omon -m CanESM5 -yr 2000-2014 --provider gcs --max-stores 1 -o ./cmip_data
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Python SDK Quickstart
106
+
107
+ ```python
108
+ from cmipget import CMIPClient, DownloadConfig, Query
109
+
110
+ client = CMIPClient()
111
+ query = Query(
112
+ project="cmip7",
113
+ source_id=["ACCESS-ESM1-6"],
114
+ experiment_id=["historical"],
115
+ variable_id=["tas"],
116
+ frequency=["mon"],
117
+ years="2000-2014",
118
+ one_member=True,
119
+ )
120
+
121
+ plan = client.plan_sync(query, output_dir="./cmip_data", layout="compact")
122
+ print(f"Files: {plan.files_to_download}, Bytes: {plan.bytes_to_download}")
123
+
124
+ report = client.download_sync(
125
+ plan,
126
+ config=DownloadConfig(concurrency=4, segmented=True, segment_count=4),
127
+ )
128
+ print(client.verify("./cmip_data"))
129
+ ```
130
+
131
+ ## Citation
132
+
133
+ If you use `cmipget` in research, please cite this software (metadata in [CITATION.cff](CITATION.cff)):
134
+
135
+ > Ren, J. (2026). *cmipget: Agent-ready CMIP7 and CMIP6 climate model data downloader* (Version 0.1.0) [Computer software]. GitHub. https://github.com/Radianjayjay/cmipget
136
+
137
+ ## Author
138
+
139
+ Jie Ren, South China Sea Institute of Oceanology, Chinese Academy of Sciences / University of Chinese Academy of Sciences.
140
+
141
+ - Email: `renjie22@mails.ucas.ac.cn`
142
+ - ORCID: [0009-0000-2806-6771](https://orcid.org/0009-0000-2806-6771)
143
+ - ResearchGate: [Jie Ren](https://www.researchgate.net/profile/Jie-Ren-126)
144
+
145
+ ## License
146
+
147
+ MIT — see [LICENSE](LICENSE).