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

Problems with Basemap.scatter #191

Open
bjornaa opened this issue Jul 7, 2015 · 5 comments
Open

Problems with Basemap.scatter #191

bjornaa opened this issue Jul 7, 2015 · 5 comments

Comments

@bjornaa
Copy link

bjornaa commented Jul 7, 2015

Hi,

I have stumbled over a bug in scatter plot. With latlon=True, it crashes with zero, one or two points.

Example code:

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

bmap = Basemap(projection='merc',
               llcrnrlon=9, urcrnrlon=13,
               llcrnrlat=63, urcrnrlat=65,
               resolution='c')

lon = [10.0, 12.0]
lat = [64.0, 65.0]

bmap.scatter(lon, lat, latlon=True)

plt.show()

This crashes with the following Traceback:

Traceback (most recent call last):
  File "a.py", line 12, in <module>
    bmap.scatter(lon, lat, latlon=True)
  File "/opt/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 536, in with_transform
    x = self.shiftdata(x)
  File "/opt/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 4775, in shiftdata
    thresh = 360.-londiff_sort[-2]
IndexError: index -2 is out of bounds for axis 0 with size 1

I am using python 2.7.10, matplotlib 1.4.3, basemap 1.0.7 on a 64-bit Linux machine

@pwolfram
Copy link

This may be a similar issue as #126

@WeatherGod
Copy link
Member

Once matplotlib 1.5 gets released, I am going to spend some time to fix up
basemap and get a new release of it out.

On Thu, Aug 27, 2015 at 10:45 AM, Phillip Wolfram [email protected]
wrote:

This may be a similar issue as #126
#126


Reply to this email directly or view it on GitHub
#191 (comment).

@pwolfram
Copy link

@WeatherGod Ok, sounds good. If you think this is something easy to fix I could try to fix it too. Thanks!

@WeatherGod
Copy link
Member

I'd be more than happy to have more eyes on this codebase. I am not all
that familiar with it, and it is crufty, so I don't know how easy or hard
it would be to fix any particular issue. So, PRs on any aspect of Basemap
is welcomed.

One thing keeping me from more actively accepting patches is that TravisCI
isn't turned on for Basemap, so I don't know if a patch breaks things or
not. That should probably get fixed first.

My plan for Basemap is to put it into maintenance mode. I do not want to do
any new developments (although I won't refuse any PRs that adds features),
but these bug reports that have been accumulating shows that there is still
interest in this project and that it deserves to have things fixed at the
least. The intention is that cartopy will take over basemap, but cartopy
still needs to mature some more, and basemap has a huge inertia, which will
keep it relevant for a while longer.

On Thu, Aug 27, 2015 at 10:57 AM, Phillip Wolfram [email protected]
wrote:

@WeatherGod https://github.com/WeatherGod Ok, sounds good. If you think
this is something easy to fix I could try to fix it too. Thanks!


Reply to this email directly or view it on GitHub
#191 (comment).

@pelson
Copy link
Member

pelson commented Sep 3, 2015

The intention is that cartopy will take over basemap, but cartopy
still needs to mature some more, and basemap has a huge inertia, which will
keep it relevant for a while longer.

I completely agree with this, particularly the inertia part. Basemap has some awesome examples, and for some people, they cover all the bases.

The exception to this is when one starts to get problems with datelines, wrapping, and ill defined geometries. I think Basemap should do what it can to fix these things, within reason, but it is important to remember that Basemap simply does not have enough context to successfully visualise data that has already been badly transformed (normally by the user). The act of xs, ys = m(lons, lats) typically throws away important context about connectivity that cannot be (non-heuristically) fixed. This is the fundamental difference between cartopy and Basemap.

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

4 participants