Skip to main content

cedar-graph

Maturity-Sandbox GitHub Release PyPI - Version GitHub License GitHub Action Workflow Status

cedar-graph 为 CEMC 数值预报产品提供数据请求、诊断计算和绘图产品定义, 支持 CMA-GFS、CMA-MESO、CMA-TYM 和 CMA-GEPS 等来源。它基于 reki、 cedarkit-comp 与 cedarkit-plots:产品通过单一 workflow 编译字段请求, 执行后创建 Panel/Chart/PlotLayer,最终使用 cedarkit-plots 渲染。

本项目处于 Sandbox 阶段,产品、recipe 和公共 API 仍可能演进。当前产品不保留 旧 load_data/plot adapter 或旧引擎执行链。

安装与开发

pip install cedar-graph

cd repo/cedar-graph
uv sync --extra test
MPLBACKEND=Agg uv run pytest tests/mock

读取真实 GRIB2 需要匹配的 ecCodes 库和 reki 数据源配置。合成数据示例不需要 业务文件或 CMADaaS 服务;安装与配置见 docs/getting_started/install.md。

快速绘图:读取 CMADaaS 挂载目录

quick_plot() 依据产品 ID 选择 workflow 产品,从 reki catalog 解析系统数据集, 并在本地挂载目录中查找文件。示例中的参数显式使用 pandas 时间值:

import pandas as pd
from cedar_graph.quickplot import quick_plot

quick_plot(
    plot_type="cn.t2m",
    system_name="CMA-GFS",
    start_time=pd.Timestamp("2026-09-22 00:00:00"),
    forecast_time=pd.Timedelta("24h"),
    data_class="cmadaas",
    storage_base="/CMADAAS",
)

这是通过本地文件访问 CMADaaS 挂载目录,不会连接 CMADaaS 在线服务,也不需要 该服务的凭据。目录布局必须符合 reki 对所选系统的路径模板。quick_plot() 会 显示产品图,并在显示结束后关闭它所创建的 Panel/provider。

使用合成 provider 执行产品

所有内置 CEMC 图种和已迁移的诊断图产品都编译到 cedarkit.plots/v3 workflow。 MockDataSource 实现相同的 provider 接口,使用固定解析式字段运行同一产品链:

from cedar_graph.recipes.workflow_product import select_workflow_product
from cedar_graph.testing import MockDataSource
from cedarkit.plots.workflow.plan import CompileContext

product = select_workflow_product("cn.t2m")
context = CompileContext(
    start_time="2024-07-01",
    forecast_time="24h",
    params={"style_variant": "cn_summer"},
)
panel = product.run(MockDataSource(resolution=2), context)
try:
    panel.save("cn-t2m-mock.png")
finally:
    panel.close()

workflow 编译计划不含数据源路径或凭据。单位准备和诊断计算由 workflow 数据节点 完成,展示则交由 plots 的新内容模型;模板切换和重复渲染不会重新执行数据读取。 集合产品 cn.ens_t2m 由调用方提供实际成员 ID,MAX 输入及缺测策略显式配置。

产品和文档

内置产品涵盖地面场、高空形势、降水、对流诊断、风切变和集合温度。主要产品 ID 包括 cn.t2m、cn.wind_10m、cn.h_500_psl、cn.rain_24h、 cn.cape_wind、cn.shr.default 与 cn.ens_t2m。完整列表与合成输出见 docs/gallery/index.md。

代表产品页中的 cn.t2m 和 cn.ens_t2m 图像由 MyST-NB 在 Sphinx 构建时动态生成并 随 HTML 站点作为构建产物输出。固定日期、成员、DejaVu Sans 和 mock 分辨率下的独立 PNG 导出脚本可由 docs/examples/render_mock_products.py 运行;默认输出到仓库外的临时目录:

uv sync --extra test
MPLBACKEND=Agg MPLCONFIGDIR=/tmp/cedar-graph-docs-mpl \
  uv run python docs/examples/render_mock_products.py /tmp/cedar-graph-docs

许可

版权所有 © 2021-2026, cemc-oper 开发者。本项目采用 Apache License 2.0。

Metadata

Release files for cedar-graph 2026.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cedar-graph 2026.11.0
File Size Uploaded Provenance Actions
cedar_graph-2026.11.0.tar.gz 249.4 kB With provenance Details for cedar_graph-2026.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cedar-graph 2026.11.0
File Interpreter ABI Platform Actions
cedar_graph-2026.11.0-py3-none-any.whl Python 3 none any Details for cedar_graph-2026.11.0-py3-none-any.whl

Total release size: 295.2 kB

Release files / cedar_graph-2026.11.0.tar.gz

Download URL cedar_graph-2026.11.0.tar.gz
Size 249.4 kB
Tags Source
SHA-256 checksum
How to use checksums
35c6a67bd52c3264bfc83f067e1641916e144e87524958405e846e7f8fe35604
BLAKE2b-256 checksum
How to use checksums
6df68e4f3f50629b2c171831f90608a1022b17559fb7aed3dfc5f9df8d614e80
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 log

Release files / cedar_graph-2026.11.0-py3-none-any.whl

Download URL cedar_graph-2026.11.0-py3-none-any.whl
Size 45.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33e0701dcdd82405cdcdafc9d58ceea7180b1851267c06e2e84224753ecf6c0b
BLAKE2b-256 checksum
How to use checksums
bbae3f3f460f173b8c821b25517846b8cb6beda354e199f63cdbbf0cbb16c16b
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 log

Security for cedar-graph 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.

Select from 2 files

Attestation for cedar_graph-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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page