matplotlib / matplotlib/basemap

nan causes segfaults in merc projection

オープン
#262 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue に示されているように、Mercator 投影と 4 つすべての境界に NaN 値を指定して Basemap コンストラクターを実行することから始めてください。これらの投影引数の検証経路を追跡し、最終的な動作が Python のクラッシュや segmentation fault ではなく、明確な ValueError になるようにしてください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
numpy, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。