matplotlib / matplotlib/basemap

Basemap creation fails for map covering pole

Open
#161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

``` python
>>> Basemap(width=1000000, height=1000000, projection='stere', lat_0=-88, lon_0=-3)

Traceback (most recent call last):
File "", line 1, in
File "..\site-packages\mpl_toolkits\basemap\__init__.py", line 1085, in __init__
self._readboundarydata('gshhs',as_polygons=True)
File "..\site-packages\mpl_toolkits\basemap\__init__.py", line 1428, in _readboundarydata
if not poly.is_valid(): poly=poly.fix()
File "_geoslib.pyx", line 234, in _geoslib.BaseGeometry.fix (src/_geoslib.c:2233)
File "_geoslib.pyx", line 334, in _geoslib.Polygon.__init__ (src/_geoslib.c:3479)
IndexError: index -1 is out of bounds for axis 0 with size 0
```

Strange thing is that e.g. using `lon_0=-2` works.

I'm using basemap 1.0.8.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the exact Basemap call with projection='stere', lat_0=-88, and lon_0=-3, then compare it with the working lon_0=-2 case. Start in mpl_toolkits/basemap/__init__.py at _readboundarydata and follow the failure into _geoslib.pyx at BaseGeometry.fix. Done means the pole-covering map no longer raises the IndexError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.