cemc-plots-kit
cemc-plots-kit 是面向 CEMC 数值预报业务绘图任务的命令行工具。它负责
任务配置、数据源选择、时间调度、并发执行和产物管理;具体的业务图种由
cedar-graph 提供,底层绘制由
cedarkit-plots 完成。
当前开发版变更见 CHANGELOG.md。
任务中的图种 ID 选择 cedar-graph workflow 产品;外部 YAML 路径必须是
cedarkit.plots/v3 workflow recipe。产品编译、provider 请求和绘图都经过同一条
新链,不再加载独立 Python load_data/plot 模块。
注意两个版本字段描述不同对象:任务文件使用 cemc.plots/v2,其内部引用的产品
配方使用 cedarkit.plots/v3。这两个版本号互不对应,也不能互换。
适用场景
- 从
/CMADAAS等 CMADaaS 挂载目录批量生成业务预报图; - 按起报时间、预报时效和间隔调度多个图种;
- 在同一任务中使用内置图种与本地自定义 YAML 配方;
- 预先校验、查看和解释任务计划,再执行实际绘图;
- 生成可追溯的
task-manifest.json,记录任务和每个作业的结果。
当前项目处于 Sandbox 阶段,任务规范、公共接口和支持的图种仍可能演进。
安装
要求 Python 3.11 或更高版本。使用 uv 安装命令行工具:
uv tool install cemc-plots-kit
在本开发工作区中进行开发和测试:
cd app/cemc-plots-kit
uv sync --extra test
pytest
读取真实 GRIB2 数据还需要系统已安装 ecCodes,并且运行环境能够访问 CMADaaS 挂载目录。
快速开始:运行 CMADaaS 挂载目录任务
项目提供了可部署的 cemc.plots/v2 任务模板
examples/task-v2-cmadaas-mount.yaml。
它使用内置的 CMADaaS 挂载目录数据集,并将机器相关的挂载点保留在任务文件中:
api_version: cemc.plots/v2
kind: PlotTask
source:
dataset: cma_gfs_gmf_cmadaas_mount
overrides:
storage_base: /CMADAAS
time:
start_time: 2026092200
forecast_time: 24h
forecast_interval: 24h
runtime:
work_dir: ./work
output_dir: ./output
missing: skip
plots:
cn.t2m: true
先执行不会读取数据或写入文件的检查命令:
cemc-plots validate examples/task-v2-cmadaas-mount.yaml
cemc-plots plan examples/task-v2-cmadaas-mount.yaml
cemc-plots explain examples/task-v2-cmadaas-mount.yaml \
--plot cn.t2m --forecast-time 24h
确认计划无误后执行绘图:
cemc-plots run examples/task-v2-cmadaas-mount.yaml
validate、plan 和 explain 是离线操作:不会创建数据 reader、读取或解码
数据、请求 CMADaaS 服务、渲染图形或写入输出。run 会在 output_dir 中原子地
写入图像与 task-manifest.json。
字段含义、参数形式、manifest 状态以及 worker/provider 生命周期见
docs/task-workflow.md。
CMADaaS 挂载目录属于本地文件数据源,而非 CMADaaS 在线服务;上述用法不需要
CMADaaS 服务凭据。挂载目录布局需与 reki 中对应系统的 cmadaas 路径模板一致。
数据源
包内 catalog 已提供以下挂载目录数据集:
| 数据集 ID | 别名 | 适用系统 |
|---|---|---|
cma_gfs_gmf_cmadaas_mount |
CMA-GFS-CMADAAS-MOUNT |
CMA-GFS |
cma_meso_3km_cmadaas_mount |
CMA-MESO-3KM-CMADAAS-MOUNT |
CMA-MESO 3 km |
cma_tym_cmadaas_mount |
CMA-TYM-CMADAAS-MOUNT |
CMA-TYM |
cma_geps_perturbation_cmadaas_mount |
CMA-GEPS-PERTURBATION-CMADAAS-MOUNT |
CMA-GEPS 扰动成员 |
在任务的 source.dataset 中选择数据集,并通过
source.overrides.storage_base 指定当前机器的挂载根目录。不要把特定机器的
挂载路径写入包内 catalog。
上述挂载别名由应用映射到公共来源声明,例如
{kind: local, dataset: cma_gfs_gmf, root: /CMADAAS}。也可以直接在任务中使用
source.dataset: cma_gfs_gmf。产品解释、布局和参数映射由 reki 的版本化资源负责;
应用只保留部署别名,不使用旧 Catalog.resolve()。
复跑指定单一时效时,可把 time.forecast_start、forecast_time 和
forecast_interval 都设成 6h;省略 forecast_start 时仍从 0 小时开始。
examples/task-v2-gfs-t2m.yaml 固定了首链的
2026-11-02 12 UTC、+6h 原场及 cn_summer 样式。
同一起报和时效的 10 m 风任务见
examples/task-v2-gfs-wind-10m.yaml。
该产品使用具名的 10 m 风分量,物理分量和风速保持 m/s;专用风羽样式明确采用
半羽 2、全羽 4、旗标 20 m/s,标题显示实际数据集、起报、有效时间和时效。
图种与参数
plots 的每个键可以是内置图种名,也可以是外部 .yaml / .yml 配方路径。
值可使用以下三种形式:
plots:
# 无参数图种
cn.t2m: true
# 一组图种参数
cn.rain_wind_10m:
interval: 3h
# 同一图种生成多组参数结果
cn.rain_wind_10m:
- { interval: 1h }
- { interval: 3h }
# 外部配方;相对路径以任务文件所在目录为基准
recipes/t2m_custom.yaml: true
常用内置图种包括:
plot_type |
产品 |
|---|---|
cn.t2m |
2 米气温 |
cn.rh2m |
2 米相对湿度 |
cn.h_500_psl |
500 hPa 位势高度与海平面气压 |
cn.h_500_wind_850 |
500 hPa 位势高度与 850 hPa 风场 |
cn.wind_10m |
10 米风场 |
cn.rain_24h |
24 小时累计降水 |
cn.rain_wind_10m |
分时段降水与 10 米风场,需 interval 参数 |
cn.prep_24h |
24 小时降水相态 |
cn.kidx_wind、cn.bli_wind、cn.cape_wind、cn.cin_wind |
对流指数与风场,需 wind_level 参数 |
诊断产品也以 workflow 产品 ID 提供,例如 cn.shr.default 和
cn.t_dew_t.default。产品 ID 与 v3 配方目录见 cedar-graph 文档。
运行行为与产物
runtime.workers: 1是确定性的参考执行方式;大于 1 时,各 worker 使用 独立进程和数据 provider。runtime.shared_reads: true会在单个任务内共享数据 provider;设为false可改为每个作业独立读取。runtime.missing: skip会跳过不可用数据对应的作业。例如 24 小时累计降水在 0 小时时效通常不可用。- 输出文件会按图种、参数、起报时间和时效命名;参数化图种的名称包含参数后缀。
task-manifest.json记录任务计划标识、作业结果、数据源标识和任务级共享读取 统计。每个实际读取保留 provider trace、公共 QueryReport、字段身份和原文件引用, 包含实际资源版本和摘要;包装后的读取错误仍保留公共错误码及 workflow 节点位置。 不会记录凭据或完整环境变量值。- 运行开始及作业结果返回时原子更新 manifest,单 worker 还记录作业开始及
SIGINT/SIGTERM 中断。单 worker 可用
cemc-plots run task.yaml --resume,在核对任务、软件资源、 输入指纹和输出摘要后复用成功作业,重试其余作业。恢复边界及阶段计时见 任务执行说明。
外部 v3 配方与示例
外部配方可让业务开发在不等待 cedar-graph 发布新版本的情况下新增或修改图种。
复制 cedar_graph/recipes/workflow/cn/ 中的 v3 配方后按需修改,再在任务文件的 plots
中引用即可。相对路径以任务文件所在目录为基准。仓库中的 examples/ 包含任务文件和
recipes/t2m_custom.yaml 示例。
许可证
Copyright © 2024-2026, developers at cemc-oper.
cemc-plots-kit 采用 Apache License 2.0。
Metadata
Release files for cemc-plots-kit 2026.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cemc_plots_kit-2026.11.0.tar.gz | 243.4 kB | With provenance | Details for cemc_plots_kit-2026.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cemc_plots_kit-2026.11.0-py3-none-any.whl | Python 3 | none | any | Details for cemc_plots_kit-2026.11.0-py3-none-any.whl |
Total release size: 276.2 kB
Release files / cemc_plots_kit-2026.11.0.tar.gz
| Download URL | cemc_plots_kit-2026.11.0.tar.gz |
|---|---|
| Size | 243.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16e57dcf2f20e485a348d2a05c78d9e75a5582b1bba7a146dccf4050c6f310cf
|
|
BLAKE2b-256 checksum How to use checksums |
869d28d532f698462eb6b7f19aa7b02fe11b4ddf9a867cc54d54624cd17e5e8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / cemc_plots_kit-2026.11.0-py3-none-any.whl
| Download URL | cemc_plots_kit-2026.11.0-py3-none-any.whl |
|---|---|
| Size | 32.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e80371f8f16921481c75ea8bb57a93a290e443aa82d551a24095e0b842310f7
|
|
BLAKE2b-256 checksum How to use checksums |
6f0e6c76a59fc979be926ed029a71fa4ef7b3b8cde1665d7c2c8ae485556ffde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for cemc-plots-kit 2026.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cemc_plots_kit-2026.11.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.