Beispiel #1
0
meridians = arange(lon1, lon2, delon)
m.drawmeridians(ax, meridians)
ax.set_xticks([])  # no ticks
ax.set_yticks([])
title('Cylindrical Equidistant')
print 'plotting Cylindrical Equidistant example, close plot window to proceed ...'
show()

m = Basemap(lons[0],-80.,lons[-1],80.,\
            resolution='c',area_thresh=10000.,projection='merc',\
            lon_0=0.5*(lons[0]+lons[-1]),lat_ts=20.)
# define grid (nx x ny regularly spaced native projection grid)
nx = len(lons)
ny = int(80. * len(lats) / 90.)
lonsout, latsout = m.makegrid(nx, ny)
topodat = interp(topoin, lons, lats, lonsout, latsout)
xsize = rcParams['figure.figsize'][0]
fig = figure(figsize=(xsize, m.aspect * xsize))
fig.add_axes([0.1, 0.1, 0.8, 0.8])
im = imshow(topodat,
            cm.jet,
            extent=(m.llcrnrx, m.urcrnrx, m.llcrnry, m.urcrnry),
            origin='lower')
ax = gca()  # get current axis instance
m.drawcoastlines(ax)
m.drawcountries(ax)
m.drawstates(ax)
m.fillcontinents(ax)
# draw parallels
m.drawparallels(ax, circles)
# draw meridians
Beispiel #2
0
# set up map projection (lambert azimuthal equal area).
m = Basemap(-150.,
            -20.,
            30.,
            -20.,
            resolution='c',
            area_thresh=10000.,
            projection='laea',
            lat_0=90.,
            lon_0=-105.)
# interpolate to map projection grid.
nx = 101
ny = 101
lonsout, latsout = m.makegrid(nx, ny)
hgt = interp(hgt, lons, lats, lonsout, latsout)
dx = (m.xmax - m.xmin) / (nx - 1)
dy = (m.ymax - m.ymin) / (ny - 1)
x = m.xmin + dx * indices((ny, nx))[1, :, :]
y = m.ymin + dy * indices((ny, nx))[0, :, :]

#m = Basemap(lons[0],lats[0],lons[-1],lats[-1],\
#              resolution='c',area_thresh=10000.,projection='cyl')
#x, y = meshgrid(lons, lats)

fig = figure(figsize=(8, 8))

plots = ['contour', 'pcolor']

for np, plot in enumerate(plots):
Beispiel #3
0
# read in data on lat/lon grid.
datadict = cPickle.load(open('500hgt.pickle','rb'))
hgt = datadict['data']; lons = datadict['lons']; lats = datadict['lats']

# set up map projection (lambert azimuthal equal area).
m = Basemap(-150.,-20.,30.,-20.,
             resolution='c',area_thresh=10000.,projection='laea',
             lat_0=90.,lon_0=-105.)
# interpolate to map projection grid.
nx = 101
ny = 101
lonsout, latsout = m.makegrid(nx,ny)
# get rid of negative lons.
lonsout = where(lonsout < 0., lonsout + 360., lonsout)
hgt = interp(hgt,lons,lats,lonsout,latsout)
dx = (m.xmax-m.xmin)/(nx-1)
dy = (m.ymax-m.ymin)/(ny-1)  
x = m.xmin+dx*indices((ny,nx))[1,:,:]
y = m.ymin+dy*indices((ny,nx))[0,:,:]

#m = Basemap(lons[0],lats[0],lons[-1],lats[-1],\
#              resolution='c',area_thresh=10000.,projection='cyl')
#x, y = meshgrid(lons, lats)

fig = figure(figsize=(8,8))

plots = ['contour','pcolor']

for np,plot in enumerate(plots):
Beispiel #4
0
from pylab import *
import cPickle

# read in topo data from pickle (on a regular lat/lon grid)
# longitudes go from 20 to 380.
topodict = cPickle.load(open('data/etopo20.pickle','rb'))
topoin = topodict['data']; lons = topodict['lons']; lats = topodict['lats']

# setup of basemap ('lcc' = lambert conformal conic).
m = Basemap(-145.5,1.,-2.566,46.352,\
            resolution='c',area_thresh=10000.,projection='lcc',\
            lat_1=50.,lon_0=-107.)
# define grid (nx x ny regularly spaced native projection grid)
nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
lonsout, latsout = m.makegrid(nx,ny)
topodat = interp(topoin,lons,lats,lonsout,latsout)
xsize = rcParams['figure.figsize'][0]
fig=figure(figsize=(xsize,m.aspect*xsize))
ax = fig.add_axes([0.1,0.1,0.75,0.75])
im = imshow(topodat,cm.jet,extent=(m.xmin, m.xmax, m.ymin, m.ymax),origin='lower')

cax = axes([0.875, 0.1, 0.05, 0.75])
colorbar(tickfmt='%d', cax=cax) # draw colorbar

axes(ax)  # make the original axes current again
m.drawcoastlines(ax)
m.drawcountries(ax)
m.drawstates(ax)
#m.fillcontinents(ax)
# draw parallels
delat = 20.