Commit 1350f1cd authored by Sandro Tosi's avatar Sandro Tosi

New upstream version 1.2.0+dfsg

parent 3778c573
......@@ -67,3 +67,5 @@ doc/examples
doc/_templates/gallery.html
doc/users/installing.rst
doc/_static/matplotlibrc
.DS_Store
......@@ -12,7 +12,7 @@ env:
addons:
apt:
packages:
- libgeos-3.3.8
- libgeos-3.4.2
# matplotlib requirements
- libpng12-dev
- libfreetype6-dev
......
version 1.2.0
-------------
* Mostly compatibility bugfixes
version 1.1.0 (git tag v1.1.0rel)
--------------------------------
* Updated packaged data to use GSHHG v2.3.6 (PR #311 & #320)
......
#Basemap
# Basemap
Plot on map projections (with coastlines and political boundaries)
using matplotlib.
##Requirements
## Requirements
* Python 2.6 (or higher)
......@@ -23,7 +23,7 @@ sure the corresponding "python-dev" package is also installed. Otherwise, you
may not have the python header (Python.h), which is required to build python
C extensions.
###Optional
### Optional
* [OWSLib](https://github.com/geopython/OWSLib) (optional) It is needed
for the BaseMap.wmsimage function.
......@@ -32,7 +32,7 @@ for the BaseMap.wmsimage function.
needed for Basemap warpimage, bluemarble, shadedrelief, and etop methods.
PIL should work on Python 2.x. Pillow is a maintained fork of PIL.
##Copyright
## Copyright
source code for the GEOS library is
included in the 'geos-3.3.3' directory under the terms given in
......@@ -59,7 +59,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
##Documentation
## Documentation
see http://matplotlib.github.com/basemap/
......@@ -68,7 +68,7 @@ see scripts in 'examples' directory for example usage.
read the FAQ and/or email the matplotlib-users mailing list if
you have problems or questions.
##Install
## Install
0. Install pre-requisite python modules numpy and matplotlib.
......@@ -100,10 +100,10 @@ prompt.
To run all the examples (except those that have extra dependencies
or require an internet connection), execute 'python run_all.py'.
##Contact
## Contact
Ben Root <ben.v.root@gmail.com>
##Thanks
## Thanks
Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Jonas Bluethgen, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions.
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# setup north polar stereographic basemap.
# setup south polar stereographic basemap.
# The longitude lon_0 is at 6-o'clock, and the
# latitude circle boundinglat is tangent to the edge
# of the map at lon_0. Default value of lat_ts
......
......@@ -10,23 +10,24 @@ Dependencies
**Requirements**
These are external packages which you will need to install before
installing basemap.
installing Basemap.
matplotlib 1.0.0 (or later, `download <http://sf.net/projects/matplotlib/>`__)
Matplotlib 1.0.0 (or later, `download <https://matplotlib.org/users/installing.html>`__)
Python 2.4 (or later, including Python 3)
matplotlib requires python 2.4 or later (`download <http://www.python.org/download/>`__)
Python 2.6 (or later, including Python 3) (`download <http://www.python.org/download/>`__)
Matplotlib 2.2 LTS requires Python 2.7 or later
Matplotlib 3.0 requires Python 3.5 or later
numpy 1.2.1 (or later)
array support for python (`download <http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103>`__)
NumPy 1.2.1 (or later)
Array support for Python (`download <http://www.numpy.org/>`__)
`PROJ4 <https://trac.osgeo.org/proj/>`__ Cartographic Projections Library.
**Required library that ships with basemap**
**Required library that ships with Basemap**
`GEOS <http://trac.osgeo.org/geos/>`__ (Geometry Engine - Open Source) library 3.1.1 or later.
Source code is included in the geos-3.3.3 directory.
Source code is included in the geos-3.3.3 directory.
When building from source, must be built and installed separately
from basemap (see build instructions below).
Included in Windows binary installers.
......@@ -40,8 +41,8 @@ Pillow
Installation
============
Download either Windows binary installers or source tarballs
`here <https://github.com/matplotlib/basemap/releases/>`__.
Download either Windows binary installers or source tarballs
`here <https://github.com/matplotlib/basemap/releases/>`__.
To install from the source, follow these steps:
......@@ -52,7 +53,7 @@ To install from the source, follow these steps:
and cd to the basemap-X.Y.Z directory.
* Install the GEOS library. If you already have it on your
system, just set the environment variable GEOS_DIR to point to the location
system, just set the environment variable GEOS_DIR to point to the location
of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and
geos_c.h is in /usr/local/include, set GEOS_DIR to /usr/local).
Then go to next step. If you don't have it, you can build it from
......@@ -62,12 +63,12 @@ To install from the source, follow these steps:
export GEOS_DIR=<where you want the libs and headers to go>
# A reasonable choice on a Unix-like system is /usr/local, or
# if you don't have permission to write there, your home directory.
./configure --prefix=$GEOS_DIR
./configure --prefix=$GEOS_DIR
make; make install
* cd back to the top level basemap directory (basemap-X.Y.Z) and
run the usual ``python setup.py install``. Check your installation
by running ``from mpl_toolkits.basemap import Basemap`` at the python
by running ``from mpl_toolkits.basemap import Basemap`` at the Python
prompt.
* To test, cd to the examples directory and run ``python simpletest.py``.
......
from __future__ import (absolute_import, division, print_function)
from __future__ import unicode_literals
"""
AllSkyMap is a subclass of Basemap, specialized for handling common plotting
......
from __future__ import (absolute_import, division, print_function)
"""
Example of astronomical use of AllSkyMap class in allskymap.py module
......
from __future__ import (absolute_import, division, print_function)
# example using matplotlib.animation to create a movie
# reads data over http - needs an active internet connection.
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
"""
This example shows how to plot data on rectangular 2D grids
(grids that are not rectlinear in geographic or native map projection
......@@ -56,7 +58,7 @@ m.drawcoastlines()
m.fillcontinents(color='white')
x, y = m(tlon,tlat)
im = m.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
im = m.pcolormesh(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
shading='faceted', antialiased=True, cmap=plt.cm.cool,
vmin=0, vmax=0)
# disclaimer: these are not really the grid cells because of the
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
def draw_map_background(m, ax):
ax.set_axis_bgcolor('#729FCF')
ax.set_facecolor('#729FCF')
m.fillcontinents(color='#FAFAFA', ax=ax, zorder=0)
m.drawcounties(ax=ax)
m.drawstates(ax=ax)
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
......
from __future__ import (absolute_import, division, print_function)
from __future__ import unicode_literals
from mpl_toolkits.basemap import Basemap
import numpy as np
......
from __future__ import (absolute_import, division, print_function)
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
#!/usr/bin/env python
"""
An example of how to use wx or wxagg in an application with the Basemap module
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
from __future__ import unicode_literals
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
from __future__ import unicode_literals
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.colors import rgb2hex, Normalize
from matplotlib.patches import Polygon
from matplotlib.colorbar import ColorbarBase
fig, ax = plt.subplots()
# Lambert Conformal map of lower 48 states.
m = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,
m = Basemap(llcrnrlon=-119,llcrnrlat=20,urcrnrlon=-64,urcrnrlat=49,
projection='lcc',lat_1=33,lat_2=45,lon_0=-95)
# draw state boundaries.
# data from U.S Census Bureau
# http://www.census.gov/geo/www/cob/st2000.html
shp_info = m.readshapefile('st99_d00','states',drawbounds=True)
# population density by state from
# http://en.wikipedia.org/wiki/List_of_U.S._states_by_population_density
# Mercator projection, for Alaska and Hawaii
m_ = Basemap(llcrnrlon=-190,llcrnrlat=20,urcrnrlon=-143,urcrnrlat=46,
projection='merc',lat_ts=20) # do not change these numbers
#%% --------- draw state boundaries ----------------------------------------
## data from U.S Census Bureau
## http://www.census.gov/geo/www/cob/st2000.html
shp_info = m.readshapefile('st99_d00','states',drawbounds=True,
linewidth=0.45,color='gray')
shp_info_ = m_.readshapefile('st99_d00','states',drawbounds=False)
## population density by state from
## http://en.wikipedia.org/wiki/List_of_U.S._states_by_population_density
popdensity = {
'New Jersey': 438.00,
'Rhode Island': 387.35,
......@@ -65,13 +77,13 @@ popdensity = {
'Montana': 2.39,
'Wyoming': 1.96,
'Alaska': 0.42}
print(shp_info)
# choose a color for each state based on population density.
#%% -------- choose a color for each state based on population density. -------
colors={}
statenames=[]
cmap = plt.cm.hot # use 'hot' colormap
cmap = plt.cm.hot_r # use 'reversed hot' colormap
vmin = 0; vmax = 450 # set range.
print(m.states_info[0].keys())
norm = Normalize(vmin=vmin, vmax=vmax)
for shapedict in m.states_info:
statename = shapedict['NAME']
# skip DC and Puerto Rico.
......@@ -80,18 +92,51 @@ for shapedict in m.states_info:
# calling colormap with value between 0 and 1 returns
# rgba value. Invert color range (hot colors are high
# population), take sqrt root to spread out colors more.
colors[statename] = cmap(1.-np.sqrt((pop-vmin)/(vmax-vmin)))[:3]
colors[statename] = cmap(np.sqrt((pop-vmin)/(vmax-vmin)))[:3]
statenames.append(statename)
# cycle through state names, color each one.
ax = plt.gca() # get current axes instance
#%% --------- cycle through state names, color each one. --------------------
for nshape,seg in enumerate(m.states):
# skip DC and Puerto Rico.
if statenames[nshape] not in ['District of Columbia','Puerto Rico']:
color = rgb2hex(colors[statenames[nshape]])
if statenames[nshape] not in ['Puerto Rico', 'District of Columbia']:
color = rgb2hex(colors[statenames[nshape]])
poly = Polygon(seg,facecolor=color,edgecolor=color)
ax.add_patch(poly)
# draw meridians and parallels.
m.drawparallels(np.arange(25,65,20),labels=[1,0,0,0])
m.drawmeridians(np.arange(-120,-40,20),labels=[0,0,0,1])
plt.title('Filling State Polygons by Population Density')
AREA_1 = 0.005 # exclude small Hawaiian islands that are smaller than AREA_1
AREA_2 = AREA_1 * 30.0 # exclude Alaskan islands that are smaller than AREA_2
AK_SCALE = 0.19 # scale down Alaska to show as a map inset
HI_OFFSET_X = -1900000 # X coordinate offset amount to move Hawaii "beneath" Texas
HI_OFFSET_Y = 250000 # similar to above: Y offset for Hawaii
AK_OFFSET_X = -250000 # X offset for Alaska (These four values are obtained
AK_OFFSET_Y = -750000 # via manual trial and error, thus changing them is not recommended.)
for nshape, shapedict in enumerate(m_.states_info): # plot Alaska and Hawaii as map insets
if shapedict['NAME'] in ['Alaska', 'Hawaii']:
seg = m_.states[int(shapedict['SHAPENUM'] - 1)]
if shapedict['NAME'] == 'Hawaii' and float(shapedict['AREA']) > AREA_1:
seg = [(x + HI_OFFSET_X, y + HI_OFFSET_Y) for x, y in seg]
color = rgb2hex(colors[statenames[nshape]])
elif shapedict['NAME'] == 'Alaska' and float(shapedict['AREA']) > AREA_2:
seg = [(x*AK_SCALE + AK_OFFSET_X, y*AK_SCALE + AK_OFFSET_Y)\
for x, y in seg]
color = rgb2hex(colors[statenames[nshape]])
poly = Polygon(seg, facecolor=color, edgecolor='gray', linewidth=.45)
ax.add_patch(poly)
ax.set_title('United states population density by state')
#%% --------- Plot bounding boxes for Alaska and Hawaii insets --------------
light_gray = [0.8]*3 # define light gray color RGB
x1,y1 = m_([-190,-183,-180,-180,-175,-171,-171],[29,29,26,26,26,22,20])
x2,y2 = m_([-180,-180,-177],[26,23,20]) # these numbers are fine-tuned manually
m_.plot(x1,y1,color=light_gray,linewidth=0.8) # do not change them drastically
m_.plot(x2,y2,color=light_gray,linewidth=0.8)
#%% --------- Show color bar ---------------------------------------
ax_c = fig.add_axes([0.9, 0.1, 0.03, 0.8])
cb = ColorbarBase(ax_c,cmap=cmap,norm=norm,orientation='vertical',
label=r'[population per $\mathregular{km^2}$]')
plt.show()
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
"""geos_demo_2.py
This script shows how to plot data onto the Geostationary Satellite projection
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......@@ -6,7 +8,7 @@ fig = plt.figure()
lon_0=57
# global geos map
m1 = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None)
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
# plot just upper right quadrant (coordinates determined from global map).
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
m.drawcoastlines()
......@@ -22,7 +24,7 @@ fig = plt.figure()
# global ortho map
lat_0=10.
m1 = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None)
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
# plot just upper right quadrant (corners determined from global map).
m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
m.drawcoastlines()
......
from __future__ import (absolute_import, division, print_function)
# example showing how to plot scattered data with hexbin.
from numpy.random import uniform
import matplotlib.pyplot as plt
......@@ -54,7 +56,7 @@ H, xedges, yedges = np.histogram2d(x, y, bins=bins, weights=z)
H = np.ma.masked_where(mask, H/bincount)
# set color of masked values to axes background (hexbin does this by default)
palette = plt.cm.jet
palette.set_bad(ax.get_axis_bgcolor(), 1.0)
palette.set_bad(ax.get_facecolor(), 1.0)
CS = m.pcolormesh(xedges,yedges,H.T,shading='flat',cmap=palette)
# draw coastlines, lat/lon lines.
m.drawcoastlines()
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
"""
draw Atlantic Hurricane Tracks for storms that reached Cat 4 or 5.
part of the track for which storm is cat 4 or 5 is shown red.
......
from __future__ import (absolute_import, division, print_function)
# example showing how to use Line Integral Convolution to visualize a vector
# flow field (from Hurricane Earl). Produces something akin to streamlines.
# Requires vectorplot scikit (http://scikits.appspot.com/vectorplot).
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......@@ -32,7 +34,7 @@ plt.title('Near-Sided Perspective Map Centered on Lon=%s, Lat=%s, H=%g' %\
fig = plt.figure()
m1 = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution=None)
ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='k')
ax = fig.add_axes([0.1,0.1,0.8,0.8], facecolor='k')
# plot just upper right quadrant (coordinates determined from global map).
m = Basemap(projection='nsper',lon_0=lon_0,lat_0=lat_0,satellite_height=h,resolution='l',llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/2.,urcrnry=m1.urcrnry/2.)
m.drawcoastlines()
......
from __future__ import (absolute_import, division, print_function)
# example demonstrating how to draw a great circle on a map.
from mpl_toolkits.basemap import Basemap
import numpy as np
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
from matplotlib import rcParams
from matplotlib.ticker import MultipleLocator
......
from __future__ import (absolute_import, division, print_function)
import numpy as np
import sys
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
from matplotlib.mlab import prctile_rank
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
......
from __future__ import (absolute_import, division, print_function)
"""
plot H's and L's on a sea-level pressure map
(uses scipy.ndimage.filters and netcdf4-python)
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
......
from __future__ import (absolute_import, division, print_function)
# make plot of etopo bathymetry/topography data on
# lambert conformal conic map projection, drawing coastlines, state and
# country boundaries, and parallels/meridians.
......
from __future__ import (absolute_import, division, print_function)
# make plot of etopo bathymetry/topography data on
# lambert conformal conic map projection, drawing coastlines, state and
# country boundaries, and parallels/meridians.
......
from __future__ import (absolute_import, division, print_function)
# make plot of etopo bathymetry/topography data on
# lambert conformal conic map projection, drawing coastlines, state and
# country boundaries, and parallels/meridians.
......
from __future__ import (absolute_import, division, print_function)
# make shaded relief plot of etopo bathymetry/topography data on
# lambert conformal conic map projection.
......
from __future__ import (absolute_import, division, print_function)
# make plot of ozone concentration data on
# lambert conformal conic map projection, drawing coastlines, state and
# country boundaries, and parallels/meridians.
......@@ -48,7 +50,7 @@ fig=plt.figure(figsize=(8,8))
# add an axes.
ax = fig.add_axes([0.1,0.1,0.8,0.8])
ax.set_axis_bgcolor('lightgrey')
ax.set_facecolor('lightgrey')
# associate this axes with the Basemap instance.
m.ax = ax
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap, cm
from netCDF4 import Dataset as NetCDFFile
import numpy as np
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset, date2index
import numpy as np
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
# make plots of etopo bathymetry/topography data on
# various map projections, drawing coastlines, state and
# country boundaries, filling continents and drawing
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import rgb2hex
......
from __future__ import (absolute_import, division, print_function)
import glob, os, sys
test_files = glob.glob('*.py')
test_files.remove('run_all.py')
......
from __future__ import (absolute_import, division, print_function)
import matplotlib, sys
matplotlib.use('Agg')
from mpl_toolkits.basemap import Basemap
......
from __future__ import (absolute_import, division, print_function)
# examples of using the 'width' and 'height' keywords
# to the Basemap constructor.
......
from __future__ import (absolute_import, division, print_function)
import mpl_toolkits.basemap as bm
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import (absolute_import, division, print_function)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import cm
......
from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
######################################
# pyplot-free version of simpletest.py
######################################
......
from __future__ import (absolute_import, division, print_function)
# example showing how to use streamlines to visualize a vector
# flow field (from Hurricane Earl).
# Requires matplotlib 1.1.1 or newer.
......@@ -32,11 +34,14 @@ speed = np.sqrt(udat**2+vdat**2)
fig = plt.figure(figsize=(8,8))
m = Basemap(projection='cyl',llcrnrlat=lats1[0],llcrnrlon=lons1[0],urcrnrlat=lats1[-1],urcrnrlon=lons1[-1],resolution='i')
x, y = m(lons,lats)
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.spectral)
m.colorbar()
m.drawmapboundary(fill_color='w')
m.drawcoastlines()
m.drawmeridians(np.arange(-120,-60,2),labels=[0,0,0,1])
m.drawparallels(np.arange(0,30,2),labels=[1,0,0,0])
m.streamplot(x,y,udat,vdat,color=speed,linewidth=2,density=2,cmap=plt.cm.Spectral)
m.colorbar()
plt.title('Hurricane Rita flow field visualized with streamlines',\
fontsize=13)
plt.show()
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
# exercise all the projections by plotting
# etopo bathymetry/topography over them, plus
# drawing coastlines, state and
......@@ -377,7 +378,7 @@ m = Basemap(projection = 'rotpole',lon_0 = -120.,\
llcrnrx = 137, urcrnrx = 222.5, resolution = 'l')
m.drawcoastlines()
ny,nx = lons.shape
m.contourf(lons[ny/2:,:],lats[ny/2:,:],topodat[ny/2:,:],50,cmap=cmap,extend='both',latlon=True)
m.contourf(lons[ny//2:,:],lats[ny//2:,:],topodat[ny//2:,:],50,cmap=cmap,extend='both',latlon=True)
m.drawmeridians(np.arange(-180,180,20),labels=[1,1,1,1])
m.drawparallels(np.arange(20,80,20))
m.colorbar()
......
from __future__ import print_function
from __future__ import (absolute_import, division, print_function)
from netCDF4 import Dataset
from mpl_toolkits.basemap import Basemap
import numpy as np