Skip to main content

cedarkit-plots

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

cedarkit-plots 是构建在 Matplotlib 和 Cartopy 之上的气象绘图库。核心由 稳定的逻辑内容句柄 Panel、Chart、PlotLayer 及整图渲染器组成。调用方 可以直接配置布局、XY/地图子图、样式与装饰;PanelTemplate、ChartTemplate 只提供可复用的展示预设,不创建数据或图层。

本项目处于 Sandbox 阶段,公开 API 和 workflow recipe 仍可能调整。新绘图模型 不提供旧 Panel/domain 或旧绘图引擎的兼容层。

能力

  • 构造 XY、多行多列及跨格布局,显式叠加填色、等值线和风羽图层。
  • 使用地图主图/附图及 EastAsia、EuropeAsia、Global、NorthPolar 和集合展示预设。
  • 使用内置 CEMC 样式、显式通用样式、原生色表与随数据范围计算的等级。
  • 通过 quickplot.plot()、quickplot.barbs() 和 quickplot.facet() 快速绘图。
  • 通过可选 workflow extra 加载 cedarkit.plots/v3 recipe、静态编译计划并执行数据请求。
  • 将中国地图 shapefile 与 palette 资源随包分发。

安装与开发

从 PyPI 安装:

pip install cedarkit-plots

直接使用 Panel/Chart 不需要 workflow extra。运行 workflow recipe 和相关 CLI 时安装该 extra;开发与运行测试:

cd repo/cedarkit-plots
uv sync --extra test --extra workflow
MPLBACKEND=Agg uv run pytest tests

安装选项、Cartopy 数据缓存和源码开发见 docs/getting_started/install.md。

快速示例

以下例子用固定合成温度场显式准备 K→°C,再匹配内置 CEMC 样式;不需要业务 数据:

import numpy as np
import xarray as xr

from cedarkit.plots import quickplot

x, y = np.meshgrid(np.linspace(-1, 1, 30), np.linspace(-1, 1, 24))
temperature = xr.DataArray(
    273.15 + 15 + 20*x + 8*np.sin(3*y), dims=("y", "x"),
    attrs={"units": "K", "temperature_kind": "absolute",
           "cemc_name": "t2m", "standard_name": "air_temperature"},
)
with quickplot.plot(
    temperature,
    units="degC",
    title="2 m temperature",
    colorbar_label="°C",
    output="temperature.png",
) as result:
    print(result.conversions[0][0])

不使用快绘封装时,可直接创建 Panel、添加 Chart、登记 PlotLayer 并调用 render() / save()。完整的内容模型、主附图、模板切换和关闭语义见 docs/tutorials/templates.md。

文档

文档页中的代表图由 MyST-NB 在 Sphinx 构建时动态生成,并随 HTML 站点作为构建产物输出。固定合成数据、 字体及独立 PNG 导出辅助脚本位于 docs/examples/render_plot_examples.py ;脚本默认将图像写入仓库外的临时目录。使用仓库锁文件运行:

uv sync --extra test --extra workflow
MPLBACKEND=Agg MPLCONFIGDIR=/tmp/cedarkit-plots-docs-mpl \
  uv run python docs/examples/render_plot_examples.py /tmp/cedarkit-plots-docs

许可与第三方资源

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

  • cedarkit/plots/resources/map/china-shapefiles 来源于 dongli/china-shapefiles。
  • 原生 palette 中保留的颜色及许可来源、校验和记录在 tools/palette_sources.json 与 cedarkit/plots/resources/palettes/;原始 NCL 表格和解析器不随运行包分发。

Metadata

Release files for cedarkit-plots 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 cedarkit-plots 2026.11.0
File Size Uploaded Provenance Actions
cedarkit_plots-2026.11.0.tar.gz 2.4 MB Without provenance Details for cedarkit_plots-2026.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cedarkit-plots 2026.11.0
File Interpreter ABI Platform Actions
cedarkit_plots-2026.11.0-py3-none-any.whl Python 3 none any Details for cedarkit_plots-2026.11.0-py3-none-any.whl

Total release size: 4.6 MB

Release files / cedarkit_plots-2026.11.0.tar.gz

Download URL cedarkit_plots-2026.11.0.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ebe80df1b152b9549e645c3479fdf76370c28575a66c8614f4d183273fb32d6b
BLAKE2b-256 checksum
How to use checksums
7f34c5e62a6df5e67e4613713aa9dcdbc4c7b01182b614e0d7a1a0cf4c701aa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL cedarkit_plots-2026.11.0-py3-none-any.whl
Size 2.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9942fcba551e4586619bdf2bcbcee9e84e1c33427a3ad26f7eb98b70d6ae2617
BLAKE2b-256 checksum
How to use checksums
5640f8a6a9fe82cab50d16a838be1107b21a70bad803bbda43ec33585e7ef2cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for cedarkit-plots 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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