Support `cf.Data` (consistently) for numeric array inputs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
Start with cfplot/stipple.py at the failing call shown in the traceback, then search the plotting functions for numeric array inputs that handle cf.Data inconsistently. Compare how those functions accept array-like values and identify where cf.Data needs to be accepted directly. Done when numeric inputs consistently accept cf.Data without requiring callers to use .array or .datum(), and Example 17 no longer needs that conversion.
由索引模型根据 Issue 内容生成。
描述
There are places in cf-plot where one can input a numeric value or array. In all such cases we should support a cf.Data object input - in fact this should generally be our preferred object, at least in terms of being top to encourage this in the docs, though under-the-hood support should be 'equal' in terms of allowed any array with a numpy-like interface. At present there is patchy support for this, but we should consistently accept cf.Data and extract the underlying array (only) when necessary from this, rather than requiring the user to ever call .array etc. to then input that.
MRE of a case without support at present
One example, that I doubt is a lone case, where cf.Data input fails:
>>> f = cf.read("docs/source/example-datasets/tas_A1.nc")
>>> g = f[0][-1, :, :]
>>> g
<CF Field: air_temperature(time(1), latitude(73), longitude(96)) K>
>>> minim = g.min().datum() # this works, with .datum() conversion
>>> cfp.gopen()
>>> cfp.con(g, lines=False) # need this for now to not run into Issue #151
>>> cfp.stipple(g, min=minim, max=400)
>>> cfp.gclose()
>>>
>>> minim = g.min() # this does not work, without .datum() conversion
>>> cfp.stipple(g, min=minim, max=400) # otherwise the same call, hangs for ~10s then errors
Traceback (most recent call last):
File "<python-input-24>", line 1, in <module>
cfp.stipple(g, min=minim, max=400)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/home/slb93/git-repos/cf-plot/cfplot/stipple.py", line 169, in stipple
plotvars.mymap.scatter(
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'scatter'
See also Example 17 which shows datum() having to be called, where resolution of this Issue would make it unnecessary: https://github.com/NCAS-CMS/cf-plot/blob/main/docs/source/examples/example_17.rst#example-17-basic-stipple-plot
- 主要语言
- Python
- 星标
- 21
- 派生
- 11
- 平均合并
- 3 小时 7 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NCAS-CMS/cf-plot 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
docs enhancement
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
dependencies infrastructure installation testing
难度 1/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
docs enhancement
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
eegprep-lean: set channel types from the Zarr group's channel_type可能已有人在做 @claude 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
blacklanternsecurity/bbot#3679 ·
维护者通常 2 天内回复
-
Bot Type: Bug Type: Documentation
难度 1/5 1 小时以内 新手友好度 85/100
-
难度 2/5 1-3 小时 新手友好度 80/100
speakeasy-api/speakeasy#2159 ·
维护者通常 1 天内回复