Consider adding opt-in support for circular axes when calling `bounds_to_vertices` (related to #594)
还没有人认领这个 Issue。
评估
调研方向
Start by reading the bounds_to_vertices implementation and the context in issues #594 and #595. Define the expected behavior for circular_period and start, including seam rotation and periodic axes beyond longitude. Done means an opt-in API handles mixed circular coordinates without NotImplementedError while preserving existing ascending and descending behavior.
由索引模型根据 Issue 内容生成。
描述
Description
The latest bounds_to_vertices() function in cf-xarray v0.10.7+ only handles core dimensions that are in ascending or descending order. Core dims that are in mixed order instead raise a NotImplementedError #595 with a message for the user to normalize coordinates to a monotonic convention (related comment).
Examples
-
Ascending
[0, 1, 2, ..., 357, 358, 359] -
Descending
[359, 358, 357, ..., 2, 1, 0] -
Mixed (wraps at seam)
[0, 1, 2, ..., 179, -180, -179, ..., -1]
bounds_to_vertices() works in the first two cases but fails in the third.
Proposed solution
For a long-term solution, it might be worth considering opt-in support for circular axes, e.g.:
bounds_to_vertices(..., circular_period=360.0, start=None)
With circular_period set, cf-xarray could:
- Detect circular monotonicity
- Rotate away from the seam
- Proceed safely as if the dimension were monotonic
While longitude (circular_period=360.0) is the most common use case, the same approach could generalize to other periodic axes (e.g. angles, phases).
Why it is useful
- Users working with model output that mixes
0–360and−180–180conventions may encounterNotImplementedErrortoday and must manually normalize coordinates before downstream operations. - This affects packages such as xESMF, which rely on
bounds_to_vertices()but do not implement detection/normalization for circular axes. - I’ve opened a related xESMF issue for visibility: https://github.com/pangeo-data/xESMF/issues/454
- 主要语言
- Python
- 星标
- 181
- 派生
- 49
- 平均合并
- 43 分钟
- 30 天内合并 PR
- 1
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xarray-contrib/cf-xarray 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
xarray-contrib/cf-xarray#623 ·
-
难度 3/5 1-2 天 新手友好度 25/100
xarray-contrib/cf-xarray#570 ·
-
难度 4/5 3-5 天 新手友好度 15/100
xarray-contrib/cf-xarray#568 ·
-
难度 3/5 1-2 天 新手友好度 35/100
xarray-contrib/cf-xarray#566 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
xarray-contrib/cf-xarray#543 · 14 条评论 ·
查看 xarray-contrib/cf-xarray 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
gradio-app/gradio#13895 ·
维护者通常 1 天内回复
-
build-error
难度 2/5 1-3 小时 新手友好度 76/100
spack/spack-packages#6713 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
ActivityWatch/activitywatch#1464 · 1 个 reaction ·
维护者通常 1 天内回复
-
[Bug]: The ckg tool drops the return type of every decorated Python method in class search results 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
bytedance/trae-agent#483 ·
维护者通常 1 天内回复