matplotlib / matplotlib/basemap

nan causes segfaults in merc projection

Offen
#262 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
817
Forks
395
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Basemap-Konstruktor mit der Mercator-Projektion und NaN-Werten für alle vier Grenzen auszuführen, wie im Issue gezeigt. Verfolge den Validierungspfad für diese Projektionsargumente und sorge dafür, dass das abgeschlossene Verhalten ein eindeutiger ValueError ist und kein Python-Absturz oder Segmentation Fault.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
numpy, python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.