matplotlib / matplotlib/basemap

Broken Basemap rotpole projection

Open
#376 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

Initally posted by a mistake to matplotlib/matplotlib
https://github.com/matplotlib/matplotlib/issues/9541
Here seems to be more relevant..

### Bug report

**Bug summary**

Basemap can't plot rotated-pole maps that cross rotated-grid's 0-th meridian

**Code for reproduction**
Here is a simple code that produce two maps for non-rotated grid (zero-rotation).
One does not cross Greenwich meridian another one does.

```python
# Paste your code here
#
#
#!/usr/bin/python
import matplotlib as mpl
mpl.use('AGG')

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.basemap import Basemap
import os

figname="okay.png"
fig = plt.figure()
bmap = Basemap(projection='rotpole',
llcrnrx=0, urcrnry=15,
urcrnrx=25, llcrnry=-15,
lon_0 = 0,
o_lon_p = 0.,
o_lat_p = 90.,
resolution='c')

bmap.drawmapboundary(fill_color='aqua')
bmap.fillcontinents(color='coral',lake_color='aqua')
bmap.drawcoastlines(linewidth=0.5)
bmap.drawparallels(np.arange(-20,20,10.))
bmap.drawmeridians(np.arange(-40,40,10.))

mpl.pyplot.savefig(figname)

figname="broken.png"
fig.clf()

bmap = Basemap(projection='rotpole',
llcrnrx=-25, urcrnry=15,
urcrnrx=25, llcrnry=-15,
lon_0 = 0,
o_lon_p = 0.,
o_lat_p = 90.,
resolution='c')

bmap.drawmapboundary(fill_color='aqua')
bmap.fillcontinents(color='coral',lake_color='aqua')
bmap.drawcoastlines(linewidth=0.5)
bmap.drawparallels(np.arange(-20,20,10.))
bmap.drawmeridians(np.arange(-40,40,10.))

mpl.pyplot.savefig(figname)

```

**Actual outcome**
Here are two maps.. The second one is obviously broken.
![okay](https://user-images.githubusercontent.com/11734464/31892556-0344a5dc-b812-11e7-9add-5593f9cd81af.png)
![broken](https://user-images.githubusercontent.com/11734464/31892567-08f9db78-b812-11e7-8534-7ccb1889e3a6.png)

**Matplotlib version**
* Operating system: Python 2.7.1, python-matplotlib 1.5.1-1ubuntu1
* Matplotlib version: 1.5.1-1ubuntu1
* Python version: 2.7.1

Default Ubuntu 16.04.3 LTS installation

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

Start by running the provided reproduction script and comparing the two generated maps. Trace Basemap's rotpole projection handling for bounds crossing the rotated grid's zero meridian; done means both cases render map boundaries, coastlines, continents, parallels, and meridians correctly.

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.