Function "addcyclic": IndexError
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- numpy, python
调研方向
首先,在 Python 3.8.8、numpy 1.23.5 和 Basemap 1.2.2 环境下,使用链接的 psi_p 和 lon 数据复现报告中的调用。然后检查 mpl_toolkits/basemap/init.py 中 addcyclic 和 _addcyclic 附近的代码,尤其是失败的数组索引操作。完成的标准是确定一个兼容的修复方案,或记录能够避免 IndexError 所需的输入条件或版本条件。
由索引模型根据 Issue 内容生成。
描述
Hi, I am using "addcyclic" function and encounter the Index Error. Error details are:
IndexError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11852/1134487354.py in
6 m.drawmeridians(np.arange(0.,360.,90.),linewidth=0.4,color='gray',labels=[True,True,True,True])
7 #在Py3.7下使用basemap==1.2.0,在循环填白addcyclic时可能会报错
----> 8 psi_p1,lon1=addcyclic(np.array(psi_p),np.array(lon))
9 lonsn, latsn = np.meshgrid(lon1, lat)
10 x_cyc,y_cyc=m(lonsn,latsn) #建立投影坐标映射D:\AnacondaSoftware\lib\site-packages\mpl_toolkits\basemap_init_.py in addcyclic(*arr, **kwargs)
5101 return _addcyclic_lon(arr[-1])
5102 else:
-> 5103 return list(map(_addcyclic,arr[:-1])) + [_addcyclic_lon(arr[-1])]
5104
5105 def _choosecorners(width,height,**kwargs):D:\AnacondaSoftware\lib\site-packages\mpl_toolkits\basemap_init_.py in _addcyclic(a)
5086 raise ValueError('The specified axis does not correspond to an '
5087 'array dimension.')
-> 5088 return npsel.concatenate((a,a[slicer]),axis=axis)
5089 def _addcyclic_lon(a):
5090 """addcyclic function for a single longitude array"""IndexError: only integers, slices (
:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices
The code is:
psi_p1,lon1=addcyclic(np.array(psi_p),np.array(lon))
Here is the variable psi_p: https://box.nju.edu.cn/f/64583aedd0c24eae909d/
lon: https://box.nju.edu.cn/f/a273d137b454468c8007/
Software and module versions are: Python 3.8.8, numpy 1.23.5, basemap: 1.2.2
I am wondering whether it is due to inconsistency of package version? Is it possible to fix the bug without reinstall python or modules due to interdependence of a lot of my other modules. Thanks a lot!!
- 主要语言
- Python
- 星标
- 817
- 派生
- 395
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matplotlib/basemap 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
matplotlib/basemap#368 ·
-
难度 4/5 3-5 天 新手友好度 48/100
matplotlib/basemap#652 · 2 条评论 · 5 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 45/100
matplotlib/basemap#649 · 2 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
matplotlib/basemap#646 ·
-
难度 2/5 1-3 小时 新手友好度 48/100
matplotlib/basemap#645 · 2 条评论 ·
查看 matplotlib/basemap 的全部 Issue
相似的 Issue
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100