Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basemap crashes with no error message when passed numpy nan's #5991

Closed
mnky9800n opened this issue Feb 12, 2016 · 3 comments
Closed

basemap crashes with no error message when passed numpy nan's #5991

mnky9800n opened this issue Feb 12, 2016 · 3 comments

Comments

@mnky9800n
Copy link

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:

image

@WeatherGod
Copy link
Member

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)

@WeatherGod
Copy link
Member

In any case, I think this is inadvertently fixed by matplotlib/basemap#261. Passing nans in for those parameters will raise a ValueError, regardless of the projection (before, those parameters were only validated for certain projections like lcc and such).

@tacaswell
Copy link
Member

Closing this as it is really a basemap bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants