Example #1
0
data.u, data.v = oban.get_wind_comps(data.wind_speeds, data.wind_dirs)
data.u_map, data.v_map = ps.orient_wind(data.u, data.v, data.lons)

#Generate grid of x,y positions
delta = 1.27
x0 = 22.86
y0 = -8.89
x = N.arange(22) * delta + x0
y = N.arange(28) * delta + y0
x_grid,y_grid = N.meshgrid(x,y)

#Radius factor used in all of the analyses
R = 4.32

#Perform analysis of height obs using uniform weighting function
heights_uniform = oban.analyze_grid(data.heights, x_grid, y_grid, data.x,\
  data.y, oban.uniform_weights, R)

#Perform analysis of height obs using Cressman weights
heights_cress = oban.analyze_grid(data.heights, x_grid, y_grid, data.x, data.y,
  oban.cressman_weights, R)

#Generate adjusted height field using the (assumed) geostrophic wind on the map 
#to estimate height gradients
map_factor = geos_factor / (ps.map_scale * data.sigma * cm_per_m)
adj_height = oban.adjust_field(data.heights, map_factor * data.v_map,
  -map_factor * data.u_map, x_grid, y_grid, data.x, data.y)
  
#Perform analysis of height obs using winds to estimate height gradients and
#a uniform weighting function
heights_uniforbm_ps = oban.analyze_grid(adj_height, x_grid, y_grid, data.x, data.y,
  oban.uniform_weights, R)
Example #2
0
data.u, data.v = oban.get_wind_comps(data.wind_speeds, data.wind_dirs)
data.u_map, data.v_map = ps.orient_wind(data.u, data.v, data.lons)

#Generate grid of x,y positions
delta = 1.27
x0 = 22.86
y0 = -8.89
x = N.arange(22) * delta + x0
y = N.arange(28) * delta + y0
x_grid,y_grid = N.meshgrid(x,y)

#Mean station separation
d = 2.30564

#Cressman first pass
cress1 = oban.analyze_grid(data.heights, x_grid, y_grid, data.x, data.y,
  oban.cressman_weights, 4 * d)

#Get observation increments for this pass
cress1_incs = oban.get_ob_incs(data.x, data.y, data.heights, x, y, cress1,
  cressman_radius = 4 * d)
cress1_rms = misc.rms(cress1_incs)
print "Cressman 1st Pass rms: %f" % cress1_rms

#Cressman 2nd pass
cress2 = oban.analyze_grid(N.array(cress1_incs), x_grid, y_grid, data.x, data.y,
  oban.cressman_weights, 2.5 * d) + cress1

#Get observation increments for this pass
cress2_incs = oban.get_ob_incs(data.x, data.y, data.heights, x, y, cress2,
  cressman_radius = 2.5 * d)
cress2_rms = misc.rms(cress2_incs)
Example #3
0
##testx, testy = m(-data.lons, data.lats)
##newx = -(testy - h/2.0) * ps.map_scale * cm_per_m
##newy = (testx - w/2.0) * ps.map_scale * cm_per_m

delta = 1.27
x0 = 22.86
y0 = -8.89
x = N.arange(22) * delta + x0
y = N.arange(28) * delta + y0
x_grid,y_grid = N.meshgrid(x,y)

x_bm,y_bm = ps2.to_basemap_xy(m2, x_grid / cm_per_m, y_grid / cm_per_m)
#Radius factor used in all of the analyses
R = 4.32

heights_cress = oban.analyze_grid(data.heights, x_grid, y_grid, data.x, data.y,
  oban.cressman_weights, R)
contours = N.arange(5300., 6000., 60.0)
parallels = N.arange(25., 60.0, 10.0)
meridians = N.arange(-120., -60.0, 10.0)

##m2.drawstates()
##m2.drawcountries()
##m2.drawcoastlines()
##m2.drawparallels(parallels, labels = [1,1,0,0])
##m2.drawmeridians(meridians, labels = [0,0,1,1])
ob_x, ob_y = ps2.to_basemap_xy(m2, data.x / cm_per_m, data.y / cm_per_m)
#m2.plot(ob_x, ob_y, 'bx')
#m2.plot(x_bm, y_bm, 'g.')
for name in M.cm.cmapnames:
  f = P.figure()
  m2.drawstates()