basemap icon indicating copy to clipboard operation
basemap copied to clipboard

nan causes segfaults in merc projection

Open tacaswell opened this issue 9 years ago • 0 comments

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

tacaswell avatar Feb 12 '16 22:02 tacaswell