matplotlib / matplotlib/basemap
nan causes segfaults in merc projection
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 817
- 派生
- 395
- PR 合并指标
- 30 天内没有已合并 PR
描述
Moving issue from matplotlib https://github.com/matplotlib/matplotlib/issues/5991
---
@mnky9800n commented 12 hours ago
When passing a value when creating the Basemap object, if that value is a numpy.nan then python 2.x crashes on windows.
This example code crashes in an ipython 2.7 notebook.
minlat = np.nan
maxlat = np.nan
minlon = np.nan
maxlon = np.nan
m = Basemap(projection='merc'
, llcrnrlat=minlat
, urcrnrlat=maxlat
, llcrnrlon=minlon
, urcrnrlon=maxlon)
I think the expected behavior would be a ValueError or something like that so that it is easier to debug. Instead of a message like this:
---
You get that windows message because python is segfaulting. If executed in
the terminal, you get the following:
```
ben@tigger:~$ python
Python 2.7.10 |Continuum Analytics, Inc.| (default, May 28 2015, 17:02:03)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>> import numpy as np
>> from mpl_toolkits.basemap import Basemap
>> minlat = np.nan
>> maxlat = np.nan
>> minlon = np.nan
>> maxlon = np.nan
>> m = Basemap(projection='merc'
... , llcrnrlat=minlat
... , urcrnrlat=maxlat
... , llcrnrlon=minlon
... , urcrnrlon=maxlon)
GEOS_ERROR: IllegalArgumentException: Points of LinearRing do not form a
closed linestring
Segmentation fault (core dumped)
```
---
Possibly closed by #261
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先按照 issue 中的示例,使用 Mercator 投影以及四个边界均为 NaN 的值运行 Basemap 构造函数。跟踪这些投影参数的验证路径,并使最终行为明确抛出 ValueError,而不是 Python 崩溃或 segmentation fault。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- numpy, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100