matplotlib / matplotlib/basemap

nan causes segfaults in merc projection

Ouverte
#262 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
817
Forks
395
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter le constructeur de Basemap avec la projection Mercator et des valeurs NaN pour les quatre limites, comme indiqué dans l’issue. Suivez le chemin de validation de ces arguments de projection et faites en sorte que le comportement final soit un ValueError explicite plutôt qu’un plantage de Python ou un segmentation fault.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
numpy, python
Domaine
data-visualization
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.