Commit 613fa19f authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 1.0.5+dfsg

parent c35090a5
version 1.0.3 (git tag v1.0.3rel)
version 1.0.5 (git tag v1.0.5rel)
---------------------------------
* fix bug triggered when drawlsmask method called more than once.
* fix error in contour method that caused a bogus mask to be applied
to the data (issue 58).
* fix further corner cases with splitting of parallels that cross
the dateline (issue 40).
* add latlon keyword to plotting methods. If latlon=True, x and y
values are assumed to longitudes and latitudes in degrees. The
data and longitudes are shifted to the map projection region (for
cylindrical and pseudo-cylindrical projections) using the shiftdata
method, and lons/lats are converted to map projection coords. Default
value is False. Addresses issue 54. New example shiftdata.py added
to illustrate usage.
* fix bluemarble and warpimage methods to account for change in orientation
of arrays returned to matplotlib's pil_to_array (issue 51)
* fix glitch with drawing meridians and filling coastline polygons with
omerc projection that includes pole.
version 1.0.4 (git tag v1.0.4rel)
--------------------------------
* fix bug that caused Europe coastlines to disappear from some maps
(evident from nytolondon.py example).
* fix splitting of parallels in conic projections that cross the dateline
(issue 40).
version 1.0.3 (git tag v1.0.3rel)
------------------------------
* fix some more python 3 compatibility issues (all examples now
work with python 3.2).
* added alpha keyword to fillcontinents (to set transparency).
......
......@@ -2,5 +2,6 @@
always tries to fill the inside of a polygon. Under certain situations,
what is the inside of a coastline polygon can be ambiguous, and the
outside may be filled instead of the inside.
Workaround - mask the land areas with the drawlsmask method instead of
Workarounds - change the map projection region slightly or
mask the land areas with the drawlsmask method instead of
filling the coastline polygons (this is illustrated in the ortho_demo.py example).
......@@ -11,6 +11,7 @@ include Changelog
include setup.py
include nad2bin.c
include src/*
include examples/shiftdata.py
include examples/allskymap.py
include examples/allskymap_cr_example.py
include examples/plothighsandlows.py
......
Metadata-Version: 1.1
Name: basemap
Version: 1.0.3
Version: 1.0.5
Summary: Plot data on map projections with matplotlib
Home-page: http://matplotlib.sourceforge.net/toolkits.html
Author: Jeff Whitaker
......
......@@ -5,11 +5,11 @@ using matplotlib.
**Requirements**
python 2.4 (or higher)
python 2.5 (or higher)
matplotlib 1.0.1 (or higher)
matplotlib
numpy 1.4 (or higher)
numpy
The GEOS (Geometry Engine - Open Source) library (version 3.1.1 or higher).
Source code is included in the geos-3.3.3 directory.
......
......@@ -48,9 +48,10 @@ copyright = '2011, Jeffrey Whitaker'
# other places throughout the built documents.
#
# The short X.Y version.
version = '1.0.2'
from mpl_toolkits.basemap import __version__ as bmversion
version = bmversion
# The full version, including alpha/beta/rc tags.
release = '1.0.2'
release = bmversion
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
......
......@@ -4,11 +4,10 @@ plot H's and L's on a sea-level pressure map
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
from datetime import datetime
from mpl_toolkits.basemap import Basemap, addcyclic
from scipy.ndimage.filters import minimum_filter, maximum_filter
from netCDF4 import Dataset
from netCDF4 import Dataset
def extrema(mat,mode='wrap',window=10):
"""find the indices of local extrema (min and max)
......@@ -20,11 +19,16 @@ def extrema(mat,mode='wrap',window=10):
# Return the indices of the maxima, minima
return np.nonzero(mat == mn), np.nonzero(mat == mx)
# set date (today at 00 UTC)
YYYYMMDDHH = datetime.now().strftime('%Y%m%d')+'00'
# plot 00 UTC today.
date = datetime.now().strftime('%Y%m%d')+'00'
# open OpenDAP dataset.
data=Dataset("http://nomad2.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH+".grib2")
#data=Dataset("http://nomads.ncep.noaa.gov:9090/dods/gfs/gfs/%s/gfs_%sz_anl" %\
# (date[0:8],date[8:10]))
data=Dataset("http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd%s/gfs_hd_%sz"%\
(date[0:8],date[8:10]))
# read lats,lons.
lats = data.variables['lat'][:]
......@@ -35,7 +39,7 @@ nlons = len(lons1)
prmsl = 0.01*data.variables['prmslmsl'][0]
# the window parameter controls the number of highs and lows detected.
# (higher value, fewer highs and lows)
local_min, local_max = extrema(prmsl, mode='wrap', window=25)
local_min, local_max = extrema(prmsl, mode='wrap', window=50)
# create Basemap instance.
m =\
Basemap(llcrnrlon=0,llcrnrlat=-80,urcrnrlon=360,urcrnrlat=80,projection='mill')
......@@ -84,5 +88,5 @@ for x,y,p in zip(xhighs, yhighs, highvals):
ha='center',va='top',color='r',
bbox = dict(boxstyle="square",ec='None',fc=(1,1,1,0.5)))
xyplotted.append((x,y))
plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % YYYYMMDDHH)
plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % date)
plt.show()
......@@ -3,8 +3,6 @@ from mpl_toolkits.basemap import Basemap, cm
from netCDF4 import Dataset as NetCDFFile
import numpy as np
import matplotlib.pyplot as plt
import copy
from matplotlib import rcParams
# plot rainfall from NWS using special precipitation
# colormap used by the NWS, and included in basemap.
......
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
date = '20071215' # date to plot.
# open dataset for that date.
dataset = \
Dataset('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst2/%s/AVHRR-AMSR/amsr-avhrr-v2.%s.nc'%\
Dataset('http://www.ncdc.noaa.gov/thredds/dodsC/oisst/NetCDF/AVHRR-AMSR/%s/AVHRR-AMSR/amsr-avhrr-v2.%s.nc.gz'%
(date[0:4],date))
# read sst. Will automatically create a masked array using
# missing_value variable attribute. 'squeeze out' singleton dimensions.
......
......@@ -153,3 +153,6 @@ make_inset.py shows how to make an inset showing the location of the map project
from a global perspective.
utmtest.py shows how to plot a UTM zone.
shiftdata.py shows how to use the 'latlon' keyword to automatically transform to map
projection coordinates and shift the data longitudinally to fit the map projection region.
......@@ -73,7 +73,7 @@ class AllSkyMap(Basemap):
suppress_ticks=True,
boundinglat=None,
fix_aspect=True,
anchor='C',
anchor=str('C'),
ax=None):
if projection != 'hammer' and projection !='moll':
......
......@@ -11,9 +11,9 @@ Created 2011-02-07 by Tom Loredo
"""
try:
from cStringIO import StringIO
from cStringIO import StringIO
except:
from io import StringIO
from io import StringIO
import numpy as np
from numpy import cos, sin, arccos, deg2rad, rad2deg
import csv, re, sys
......
......@@ -49,15 +49,15 @@ tlon = tlon-360.
plt.figure(figsize=(6,8))
plt.subplot(2,1,1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
m = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')
map.drawcoastlines()
map.fillcontinents(color='white')
m.drawcoastlines()
m.fillcontinents(color='white')
x, y = map(tlon,tlat)
im = map.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),
shading='faceted', antialiased=True, cmap=plt.cm.cool,
x, y = m(tlon,tlat)
im = m.pcolor(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
# way pcolor interprets the x and y args.
......@@ -66,11 +66,11 @@ plt.title('(A) CCSM POP Grid Cells')
# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
plt.subplot(2,1,2)
map.drawcoastlines()
map.fillcontinents(color='white')
m.drawcoastlines()
m.fillcontinents(color='white')
CS1 = map.contourf(x,y,temp,15)
CS2 = map.contour(x,y,temp,15,colors='black',linewidths=0.5)
CS1 = m.contourf(x,y,temp,15)
CS2 = m.contour(x,y,temp,15,colors='black',linewidths=0.5)
plt.title('(B) Surface Temp contours on POP Grid')
plt.show()
......
from mpl_toolkits.basemap import Basemap, shiftgrid
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
import sys
......@@ -9,21 +9,18 @@ import sys
hgt = np.loadtxt('500hgtdata.gz')
lons = np.loadtxt('500hgtlons.gz')
lats = np.loadtxt('500hgtlats.gz')
# shift data so lons go from -180 to 180 instead of 0 to 360.
hgt,lons = shiftgrid(180.,hgt,lons,start=False)
lons, lats = np.meshgrid(lons, lats)
# create new figure
fig=plt.figure()
# setup of sinusoidal basemap
m = Basemap(resolution='c',projection='sinu',lon_0=0)
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
# create contour lines
CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS1 = m.contour(lons,lats,hgt,15,linewidths=0.5,colors='k',latlon=True)
# fill between contour lines.
CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet,extend='both')
CS2 =\
m.contourf(lons,lats,hgt,CS1.levels,cmap=plt.cm.jet,extend='both',latlon=True)
m.colorbar(CS2) # draw colorbar
# draw coastlines and political boundaries.
m.drawcoastlines()
......@@ -41,11 +38,10 @@ sys.stdout.write('plotting with sinusoidal basemap ...\n')
fig=plt.figure()
# setup of mollweide basemap
m = Basemap(resolution='c',projection='moll',lon_0=0)
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet,extend='both')
CS1 = m.contour(lons,lats,hgt,15,linewidths=0.5,colors='k',latlon=True)
CS2 =\
m.contourf(lons,lats,hgt,CS1.levels,cmap=plt.cm.jet,extend='both',latlon=True)
m.colorbar(CS2) # draw colorbar
# draw coastlines and political boundaries.
m.drawcoastlines()
......@@ -63,11 +59,9 @@ sys.stdout.write('plotting with mollweide basemap ...\n')
fig=plt.figure()
# set up Robinson map projection.
m = Basemap(resolution='c',projection='robin',lon_0=0)
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet,extend='both')
CS1 = m.contour(lons,lats,hgt,15,linewidths=0.5,colors='k',latlon=True)
CS2 = m.contourf(lons,lats,hgt,CS1.levels,cmap=plt.cm.jet,extend='both',latlon=True)
m.colorbar(CS2) # draw colorbar
# draw coastlines and political boundaries.
m.drawcoastlines()
......@@ -85,7 +79,6 @@ sys.stdout.write('plotting with robinson basemap ...\n')
fig=plt.figure()
# set up map projection (azimuthal equidistant).
m = Basemap(projection='npaeqd',lon_0=-90,boundinglat=15.,resolution='c')
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
......@@ -108,7 +101,6 @@ fig=plt.figure()
# setup of orthographic basemap
m = Basemap(resolution='c',projection='ortho',\
lat_0=45.,lon_0=-120.)
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
......@@ -121,7 +113,7 @@ m.drawmapboundary()
# draw parallels and meridians.
parallels = np.arange(-80.,90,20.)
m.drawparallels(parallels)
meridians = np.arange(0.,360.,20.)
meridians = np.arange(-360.,360.,20.)
m.drawmeridians(meridians)
plt.title('Orthographic Filled Contour Demo')
sys.stdout.write('plotting with orthographic basemap ..\n')
......
from __future__ import unicode_literals
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
......@@ -15,7 +16,7 @@ def lat2str(deg):
deg += 1.0
min -= 60.0
dir = 'S'
return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
return ("%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
def lon2str(deg):
min = 60 * (deg - np.floor(deg))
......@@ -26,7 +27,7 @@ def lon2str(deg):
deg += 1.0
min -= 60.0
dir = 'W'
return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
return ("%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
# (1) use matplotlib custom tick formatter
# instead of Basemap labelling methods.
......
from __future__ import print_function
# this example reads today's numerical weather forecasts
from __future__ import unicode_literals
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
# This version demonstrates the use of the AxesGrid toolkit.
import numpy as np
......
......@@ -29,12 +29,11 @@ plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
fig = plt.figure()
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l')
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='coral',lake_color='aqua')
m.drawmapboundary(fill_color='aqua')
m.drawcountries()
# draw parallels and meridians.
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
plt.show()
"""
plot H's and L's on a sea-level pressure map
(uses scipy.ndimage.filters)
(uses scipy.ndimage.filters and netcdf4-python)
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
from datetime import datetime
from mpl_toolkits.basemap import Basemap, addcyclic
from scipy.ndimage.filters import minimum_filter, maximum_filter
from netCDF4 import Dataset as NetCDFFile
from netCDF4 import Dataset
def extrema(mat,mode='wrap',window=10):
"""find the indices of local extrema (min and max)
......@@ -19,18 +19,16 @@ def extrema(mat,mode='wrap',window=10):
# Return the indices of the maxima, minima
return np.nonzero(mat == mn), np.nonzero(mat == mx)
if len(sys.argv) < 2:
sys.stdout.write('enter date to plot (YYYYMMDDHH) on command line')
raise SystemExit
# get date from command line.
YYYYMMDDHH = sys.argv[1]
# plot 00 UTC today.
date = datetime.now().strftime('%Y%m%d')+'00'
# open OpenDAP dataset.
try:
data=NetCDFFile("http://nomad1.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH+".grib2")
except:
data=NetCDFFile("http://nomad2.ncep.noaa.gov:9090/dods/gdas/rotating/gdas"+YYYYMMDDHH+".grib2")
#data=Dataset("http://nomads.ncep.noaa.gov:9090/dods/gfs/gfs/%s/gfs_%sz_anl" %\
# (date[0:8],date[8:10]))
data=Dataset("http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd%s/gfs_hd_%sz"%\
(date[0:8],date[8:10]))
# read lats,lons.
lats = data.variables['lat'][:]
......@@ -41,10 +39,10 @@ nlons = len(lons1)
prmsl = 0.01*data.variables['prmslmsl'][0]
# the window parameter controls the number of highs and lows detected.
# (higher value, fewer highs and lows)
local_min, local_max = extrema(prmsl, mode='wrap', window=25)
local_min, local_max = extrema(prmsl, mode='wrap', window=50)
# create Basemap instance.
m =\
Basemap(lon_0=180,projection='kav7')
Basemap(llcrnrlon=0,llcrnrlat=-80,urcrnrlon=360,urcrnrlat=80,projection='mill')
# add wrap-around point in longitude.
prmsl, lons = addcyclic(prmsl, lons1)
# contour levels
......@@ -53,7 +51,8 @@ clevs = np.arange(900,1100.,5.)
lons, lats = np.meshgrid(lons, lats)
x, y = m(lons, lats)
# create figure.
fig=plt.figure(figsize=(12,6))
fig=plt.figure(figsize=(8,4.5))
ax = fig.add_axes([0.05,0.05,0.9,0.85])
cs = m.contour(x,y,prmsl,clevs,colors='k',linewidths=1.)
m.drawcoastlines(linewidth=1.25)
m.fillcontinents(color='0.8')
......@@ -89,5 +88,5 @@ for x,y,p in zip(xhighs, yhighs, highvals):
ha='center',va='top',color='r',
bbox = dict(boxstyle="square",ec='None',fc=(1,1,1,0.5)))
xyplotted.append((x,y))
plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % YYYYMMDDHH)
plt.title('Mean Sea-Level Pressure (with Highs and Lows) %s' % date)
plt.show()
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
date = '20071215' # date to plot.
# open dataset for that date.
dataset = \
Dataset('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst2/%s/AVHRR-AMSR/amsr-avhrr-v2.%s.nc'%\
Dataset('http://www.ncdc.noaa.gov/thredds/dodsC/oisst/NetCDF/AVHRR-AMSR/%s/AVHRR-AMSR/amsr-avhrr-v2.%s.nc.gz'%
(date[0:4],date))
# read sst. Will automatically create a masked array using
# missing_value variable attribute. 'squeeze out' singleton dimensions.
......
from mpl_toolkits.basemap import Basemap,shiftgrid
import numpy as np
import matplotlib.pyplot as plt
# read in topo data (on a regular lat/lon grid)
etopo=np.loadtxt('etopo20data.gz')
lons=np.loadtxt('etopo20lons.gz')
lats=np.loadtxt('etopo20lats.gz')
lons, lats = np.meshgrid(lons, lats)
# create Basemap instance.
m = Basemap(projection='kav7',lon_0=0)
# can either shift data manually...
# shift data and longitudes to fit map region
#lons, etopo = m.shiftdata(lons, etopo)
# transform lats/lons to map projection coords
#x, y = m(lons, lats)
# make filled contour plot
#cs = m.contourf(x,y,etopo,30,cmap=plt.cm.jet)
# or let contourf to it for you by passing lons/lats and
# setting latlon=True.
cs = m.contourf(lons,lats,etopo,30,cmap=plt.cm.jet,latlon=True)
#cs = m.pcolormesh(lons,lats,etopo,shading='flat',latlon=True)
#cs = m.pcolor(lons,lats,etopo,shading='flat',latlon=True)
# draw coastlines.
m.drawcoastlines()
# draw parallels and meridians.
m.drawparallels(np.arange(-60.,90.,30.),labels=[1,0,0,0])
m.drawmeridians(np.arange(0.,360.,60.),labels=[0,0,0,1],fontsize=12)
plt.title('test shiftdata method')
plt.show()
# 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).
# example showing how to use streamlines to visualize a vector
# flow field (from Hurricane Earl).
# Requires matplotlib 1.1.1 or newer.
from netCDF4 import Dataset as NetCDFFile
from mpl_toolkits.basemap import Basemap, interp
import numpy as np
import matplotlib.pyplot as plt
if not hasattr(plt, 'streamplot'):
raise ValueError('need newer version of matplotlib to run this example')
# H*wind data from http://www.aoml.noaa.gov/hrd/data_sub/wind.html
ncfile = NetCDFFile('rita.nc')
udat = ncfile.variables['sfc_u'][0,:,:]
......
This diff is collapsed.
......@@ -4,25 +4,25 @@ import numpy as np
# set up orthographic map projection with
# perspective of satellite looking down at 50N, 100W.
# use low resolution coastlines.
map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l')
bmap = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l')
# draw coastlines, country boundaries, fill continents.
map.drawcoastlines(linewidth=0.25)
map.drawcountries(linewidth=0.25)
map.fillcontinents(color='coral',lake_color='aqua')
bmap.drawcoastlines(linewidth=0.25)
bmap.drawcountries(linewidth=0.25)
bmap.fillcontinents(color='coral',lake_color='aqua')
# draw the edge of the map projection region (the projection limb)
map.drawmapboundary(fill_color='aqua')
bmap.drawmapboundary(fill_color='aqua')
# draw lat/lon grid lines every 30 degrees.
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# lat/lon coordinates of five cities.
lats=[40.02,32.73,38.55,48.25,17.29]
lons=[-105.16,-117.16,-77.00,-114.21,-88.10]
cities=['Boulder, CO','San Diego, CA',
'Washington, DC','Whitefish, MT','Belize City, Belize']
# compute the native map projection coordinates for cities.
xc,yc = map(lons,lats)
xc,yc = bmap(lons,lats)
# plot filled circles at the locations of the cities.
map.plot(xc,yc,'bo')
bmap.plot(xc,yc,'bo')
# plot the names of those five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9)
......@@ -33,69 +33,87 @@ lons = (delta*np.indices((nlats,nlons))[1,:,:])
wave = 0.75*(np.sin(2.*lats)**8*np.cos(4.*lons))
mean = 0.5*np.cos(2.*lats)*((np.sin(2.*lats))**2 + 2.)
# compute native map projection coordinates of lat/lon grid.
x, y = map(lons*180./np.pi, lats*180./np.pi)
x, y = bmap(lons*180./np.pi, lats*180./np.pi)
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('filled continent background')
# as above, but use land-sea mask image as map background.
fig = plt.figure()
map.drawmapboundary()
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
bmap.drawmapboundary()
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# plot filled circles at the locations of the cities.
map.plot(xc,yc,'wo')
bmap.plot(xc,yc,'wo')
# plot the names of five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('land-sea mask background')
map.drawlsmask(ocean_color='aqua',land_color='coral')
bmap.drawlsmask(ocean_color='aqua',land_color='coral')
# as above, but use blue marble image as map background.
fig = plt.figure()
map.drawmapboundary()
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
bmap.drawmapboundary()
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# plot filled circles at the locations of the cities.
map.plot(xc,yc,'wo')
bmap.plot(xc,yc,'wo')
# plot the names of five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('blue marble background')
map.bluemarble()
bmap.bluemarble()
# as above, but use shaded relief image as map background.
fig = plt.figure()
map.drawmapboundary()
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
bmap.drawmapboundary()
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# plot filled circles at the locations of the cities.
map.plot(xc,yc,'wo')
bmap.plot(xc,yc,'wo')
# plot the names of five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('shaded relief background')
map.shadedrelief()
bmap.shadedrelief()
# as above, but use etopo image as map background.
fig = plt.figure()
map.drawmapboundary()
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
bmap.drawmapboundary()
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# plot filled circles at the locations of the cities.
map.plot(xc,yc,'wo')
bmap.plot(xc,yc,'wo')
# plot the names of five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('etopo background')
map.etopo()
bmap.etopo()
# as above, but use etopo image as map background overlaid with
# land-sea mask image where land areas are transparent (so etopo
# image shows through over land).
fig = plt.figure()
bmap.drawmapboundary()
bmap.drawmeridians(np.arange(0,360,30))
bmap.drawparallels(np.arange(-90,90,30))
# plot filled circles at the locations of the cities.
bmap.plot(xc,yc,'wo')
# plot the names of five cities.
for name,xpt,ypt in zip(cities,xc,yc):
plt.text(xpt+50000,ypt+50000,name,fontsize=9,color='w')
# contour data over the map.
cs = bmap.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('etopo background with oceans masked')
bmap.etopo()
bmap.drawlsmask(ocean_color='DarkBlue',land_color=(255,255,255,1))
plt.show()
This diff is collapsed.
......@@ -348,7 +348,6 @@ class Proj(object):
else:
return lonlat
if __name__ == "__main__":
params = {}
......
......@@ -109,7 +109,7 @@ package_data = {'mpl_toolkits.basemap':datafiles}
setup(
name = "basemap",
version = "1.0.3",
version = "1.0.5",
description = "Plot data on map projections with matplotlib",
long_description = """
An add-on toolkit for matplotlib that lets you plot data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment