Beispiel #1
0
height = data['height']

# Generate a map plotting
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')
Beispiel #2
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)
Beispiel #3
0
rbfm_rms = rms(rbfm_interp - truth)

# use RBF - gaussian
epsg = .4
rbfg = Rbf(x, y, z, function='gaussian', epsilon=epsg, smooth=0.1)
rbfg_interp = rbfg(XI, YI)
rbfg_rms = rms(rbfg_interp - truth)

# Natural neighbor
nat_interp = griddata(x, y, z, XI, YI)
nat_filtered = gaussian_filter(XI, YI, nat_interp, 0.1, 0.1)
nat_rms = rms(nat_interp - truth)

# Cressman
Rc = 0.5
cress_interp = grid_data(z, XI, YI, x, y, cressman_weights, Rc)
cress_rms = rms(cress_interp - truth)

# Barnes
kstar = 0.1
barnes_interp = grid_data(z, XI, YI, x, y, barnes_weights, (0.5, kstar))
barnes_rms = rms(barnes_interp - truth)

# plot the results
val_norm = plt.normalize(-0.45, 0.45)
diff_norm = plt.normalize(-1.0, 1.0)
cmap = plt.get_cmap('jet')

fig = plt.figure()
fig.suptitle('Interpolation Results', fontsize=14)
fig.canvas.manager.set_window_title('Actual Fields')
Beispiel #4
0
rbfm_rms = rms(rbfm_interp - truth)

# use RBF - gaussian
epsg = .4
rbfg = Rbf(x, y, z, function='gaussian', epsilon=epsg, smooth=0.1)
rbfg_interp = rbfg(XI, YI)
rbfg_rms = rms(rbfg_interp - truth)

# Natural neighbor
nat_interp = griddata(x, y, z, XI, YI)
nat_filtered = gaussian_filter(XI, YI, nat_interp, 0.1, 0.1)
nat_rms = rms(nat_interp - truth)

# Cressman
Rc = 0.5
cress_interp = grid_data(z, XI, YI, x, y, cressman_weights, Rc)
cress_rms = rms(cress_interp - truth)

# Barnes
kstar = 0.1
barnes_interp = grid_data(z, XI, YI, x, y, barnes_weights, (0.5, kstar))
barnes_rms = rms(barnes_interp - truth)

# plot the results
val_norm = plt.normalize(-0.45, 0.45)
diff_norm = plt.normalize(-1.0, 1.0)
cmap = plt.get_cmap('jet')

fig = plt.figure()
fig.suptitle('Interpolation Results', fontsize=14)
fig.canvas.manager.set_window_title('Actual Fields')