Broken Basemap rotpole projection

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

Nobody has claimed this yet.

Assessment

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

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.

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.

# 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
broken

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

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

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.

More from matplotlib/basemap

All issues in matplotlib/basemap

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.