def analyze_grid_multipass(ob_data, grid_x, grid_y, ob_x, ob_y, num_passes, weight_func, params, background = None): '''Calculate a value at each grid point using multiple passes of an objective analysis technique''' if background is None: mod_param = (params[0], 1.0) background = analyze_grid(ob_data, grid_x, grid_y, ob_x, ob_y, weight_func, mod_param) num_passes -= 1 for i in range(num_passes): ob_incs = get_ob_incs(ob_x, ob_y, ob_data, grid_x[0], grid_y[:,0], background) print 'pass: %d rms: %f' % (i, misc.rms(ob_incs)) background = analyze_grid(ob_incs, grid_x, grid_y, ob_x, ob_y, weight_func, params) + background return background
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) print "Cressman 2nd Pass rms: %f" % cress2_rms #Cressman 3rd pass cress3 = oban.analyze_grid(N.array(cress2_incs), x_grid, y_grid, data.x, data.y, oban.cressman_weights, 1.5 * d) + cress2