basemap icon indicating copy to clipboard operation
basemap copied to clipboard

Broken Basemap rotpole projection

Open rkouznetsov opened this issue 7 years ago • 0 comments

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

rkouznetsov avatar Oct 27 '17 15:10 rkouznetsov