In [4]:
HTML('<iframe src="https://matplotlib.org/basemap/api/basemap_api.html" width=960 height=350></iframe>')


Out[4]:

https://matplotlib.org/basemap/api/basemap_api.html
resolution: Can be c (crude), l (low), i (intermediate), h (high), f (full) or None


In [2]:
%pylab inline

from IPython.core.display import Image
from IPython.display import HTML

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

## little helper to pixel-perfectly render a figure as an inline image
def showFigure(fg, filename, dpi=100, facecolor='0.95') :
    plt.savefig(filename, dpi=dpi, facecolor=facecolor)
    plt.close(fg) 
    return Image(filename=filename)


Populating the interactive namespace from numpy and matplotlib

In [3]:
path  = '/media/noiv/OS/Octets/Projects/weather-simulation/images/data/'
names = ['top', 'front', 'left', 'right', 'back', 'bottom']
lats  = [90, 0,   0,  0,   0, -90]
lons  = [ 0, 0, -90, 90, 180,   0]
reso  = 1024

colCont  = '#333333' # '0.5'
colRiver = '#555555' # '0.5'
colLake  = '#555555' # '0.6'
colWater = '#808080' # '0.7'

rsphere = 6370997.; width = 2.0 * rsphere; height = width

for (lat, lon, name) in zip(lats, lons, names) :
    
    fg, ax = plt.subplots(figsize=(reso/100.0, reso/100.0), dpi=100, facecolor=(0, 0, 0, 0))

    ax.axes.get_yaxis().set_visible(False)
    ax.axes.get_xaxis().set_visible(False)

    ax.set_frame_on(False)
    ax.set_position((0, 0, 1, 1))

    m = Basemap(width=width, height=height, rsphere=rsphere, projection='gnom', lat_0=lat, lon_0=lon, resolution='l', fix_aspect=False, suppress_ticks=True)
    
    ## m.fillcontinents(color=colCont, lake_color=colLake)
    ## m.drawmapboundary(fill_color=colWater, linewidth=0)
    m.drawrivers(linewidth=0.3, color=colRiver) 

    filename = path + 'globe.data.' + name + '.' + str(reso) + '.png'
    plt.savefig(filename, dpi=100, quality=100)
    
    print filename

print 'Done'


/media/noiv/OS/Octets/Projects/weather-simulation/images/data/globe.data.top.1024.png
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-435c345a5b14> in <module>()
     26     ## m.fillcontinents(color=colCont, lake_color=colLake)
     27     ## m.drawmapboundary(fill_color=colWater, linewidth=0)
---> 28     m.drawrivers(linewidth=0.3, color=colRiver)
     29 
     30     filename = path + 'globe.data.' + name + '.' + str(reso) + '.png'

/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/__init__.pyc in drawrivers(self, linewidth, linestyle, color, antialiased, ax, zorder)
   2017         # intersect map boundary polygon.
   2018         if not hasattr(self,'riversegs'):
-> 2019             self.riversegs, types = self._readboundarydata('rivers')
   2020         # get current axes instance (if none specified).
   2021         ax = ax or self._check_ax()

/usr/lib/python2.7/dist-packages/mpl_toolkits/basemap/__init__.pyc in _readboundarydata(self, name, as_polygons)
   1353                             if poly.intersects(boundarypolyll):
   1354                                 if name != 'gshhs' or as_polygons:
-> 1355                                     geoms = poly.intersection(boundarypolyll)
   1356                                 else:
   1357                                     # convert polygons to line segments

KeyboardInterrupt: 

In [ ]:


In [ ]:


In [ ]: