Beispiel #1
0
bm = Basemap(projection='tmerc', lat_0=90.0, lon_0=-100.0, lat_ts=40.0,
    llcrnrlon=-121, llcrnrlat=24, urcrnrlon=-64, urcrnrlat=46,
    resolution='l')

# Transform ob locations to locations on map
obx, oby = bm(lon, lat)

# Generate grid of x,y positions
lon_grid, lat_grid, x_grid, y_grid = bm.makegrid(130, 60, returnxy=True)

# Perform analysis of height obs using Cressman weights. Everything is in
# meters
heights_cress = grid_data(height, x_grid, y_grid, obx, oby, cressman_weights,
    600. * kilo)

# Mask out values over the ocean so that we don't draw contours there
heights_cress = maskoceans(lon_grid, lat_grid, heights_cress)

# Map plotting
contours = np.arange(4800., 5900., 60.0)
bm.drawstates()
bm.drawcountries()
bm.drawcoastlines()

station_plot(data, proj=bm, layout=dict(C='height', NW=None, SW=None), zorder=10)
cp = bm.contour(x_grid, y_grid, heights_cress, contours)

plt.clabel(cp, fmt='%.0f', inline_spacing=0)
plt.title('500mb Height map')
plt.show()
Beispiel #2
0
    projection='stere', urcrnrlat=37., urcrnrlon=-94.25, llcrnrlat=33.7,
    llcrnrlon=-103., ax=ax)
m.bluemarble()

#Objectively analyze wind components
sig = 15000
lon_grid, lat_grid, x_grid, y_grid = m.makegrid(125, 50, returnxy=True)
x,y = m(data['longitude'], data['latitude'])
u_grid = griddata(x, y, data['u'], x_grid, y_grid)
u_grid = gaussian_filter(x_grid.T, y_grid.T, u_grid.T, sig, sig)
v_grid = griddata(x, y, data['v'], x_grid, y_grid)
v_grid = gaussian_filter(x_grid.T, y_grid.T, v_grid.T, sig, sig)
conv = h_convergence(u_grid.filled(0), v_grid.filled(0), x_grid[0, 1], y_grid[1, 0])
conv = np.ma.array(conv, mask=u_grid.mask)

plt.pcolor(x_grid.T, y_grid.T, conv, zorder=0, cmap=plt.get_cmap('RdBu'),
    antialiased=False, norm=plt.Normalize(-2e-4, 2e-4))

#Convert wind speeds to MPH
data['u'] *= sconsts.hour / sconsts.mile
data['v'] *= sconsts.hour / sconsts.mile
station_plot(data, ax=ax, proj=m,
    styles=dict(dewpoint=dict(color='lightgreen')), zorder=10)
m.drawstates(ax=ax, zorder=1)
mapfile = os.path.join(os.environ['HOME'], 'mapdata', 'c_03oc08.shp')
if os.path.exists(mapfile):
    m.readshapefile(os.path.splitext(mapfile)[0], 'counties', zorder=0)

plt.title(data['datetime'][0].strftime('%H%MZ %d %b %Y'))
plt.show()
Beispiel #3
0
u_grid = gaussian_filter(x_grid.T, y_grid.T, u_grid.T, sig, sig)
v_grid = griddata(x, y, data['v'], x_grid, y_grid)
v_grid = gaussian_filter(x_grid.T, y_grid.T, v_grid.T, sig, sig)
conv = h_convergence(u_grid.filled(0), v_grid.filled(0), x_grid[0, 1],
                     y_grid[1, 0])
conv = np.ma.array(conv, mask=u_grid.mask)

plt.pcolor(x_grid.T,
           y_grid.T,
           conv,
           zorder=0,
           cmap=plt.get_cmap('RdBu'),
           antialiased=False,
           norm=plt.Normalize(-2e-4, 2e-4))

#Convert wind speeds to MPH
data['u'] *= sconsts.hour / sconsts.mile
data['v'] *= sconsts.hour / sconsts.mile
station_plot(data,
             ax=ax,
             proj=m,
             styles=dict(dewpoint=dict(color='lightgreen')),
             zorder=10)
m.drawstates(ax=ax, zorder=1)
mapfile = os.path.join(os.environ['HOME'], 'mapdata', 'c_03oc08.shp')
if os.path.exists(mapfile):
    m.readshapefile(os.path.splitext(mapfile)[0], 'counties', zorder=0)

plt.title(data['datetime'][0].strftime('%H%MZ %d %b %Y'))
plt.show()
Beispiel #4
0
# Transform ob locations to locations on map
obx, oby = bm(lon, lat)

# Generate grid of x,y positions
lon_grid, lat_grid, x_grid, y_grid = bm.makegrid(130, 60, returnxy=True)

# Perform analysis of height obs using Cressman weights. Everything is in
# meters
heights_cress = grid_data(height, x_grid, y_grid, obx, oby, cressman_weights,
                          600. * kilo)

# Mask out values over the ocean so that we don't draw contours there
heights_cress = maskoceans(lon_grid, lat_grid, heights_cress)

# Map plotting
contours = np.arange(4800., 5900., 60.0)
bm.drawstates()
bm.drawcountries()
bm.drawcoastlines()

station_plot(data,
             proj=bm,
             layout=dict(C='height', NW=None, SW=None),
             zorder=10)
cp = bm.contour(x_grid, y_grid, heights_cress, contours)

plt.clabel(cp, fmt='%.0f', inline_spacing=0)
plt.title('500mb Height map')
plt.show()