Skip to content
Snippets Groups Projects
Commit 168bd385 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent fef9480e
No related branches found
No related tags found
No related merge requests found
......@@ -968,22 +968,21 @@ def best_fit(amv_spd, amv_dir, amv_prs, amv_lat, amv_lon, fcst_spd, fcst_dir, fc
SatwindBestFitU = fcst_uwind[LevBelow] * (1.0 - Prop) + fcst_uwind[LevAbove] * Prop
SatwindBestFitV = fcst_vwind[LevBelow] * (1.0 - Prop) + fcst_vwind[LevAbove] * Prop
# Check to see if the best fit pressure is constrained.
SatwindGoodConstraint = 1
flag = 0
# Check for overall good agreement
vdiff = np.sqrt((amv_uwind - SatwindBestFitU) ** 2 + (amv_vwind - SatwindBestFitV) ** 2)
if vdiff > 4.0:
SatwindGoodConstraint = 0
flag = 2
# Check for a substantial secondary local minimum or if local minimum is too broad
mm = np.where(fcst_prs > (SatwindBestFitPress + 100))[0]
nn = np.where(fcst_prs < (SatwindBestFitPress - 100))[0]
if (np.sum(VecDiff[mm] < (vdiff + 2.0)) + np.sum(VecDiff[nn] < (vdiff + 2.0))) > 0:
SatwindGoodConstraint = 0
flag = 1
if SatwindGoodConstraint == 1:
mm = np.where(fcst_prs > (SatwindBestFitPress + 100))[0]
nn = np.where(fcst_prs < (SatwindBestFitPress - 100))[0]
if (np.sum(VecDiff[mm] < (vdiff + 2.0)) + np.sum(VecDiff[nn] < (vdiff + 2.0))) > 0:
SatwindGoodConstraint = 0
flag = 1
if SatwindGoodConstraint == 1:
bfit_prs = SatwindBestFitPress
......@@ -1107,7 +1106,6 @@ def best_fit_altitude(amv_spd, amv_dir, amv_alt, amv_lat, amv_lon, fcst_spd, fcs
# check contraints
good_constraint = 1
flag = 0
# Check for overall good agreement: want vdiff less than 4 m/s
vdiff = np.sqrt((amv_uwind - sat_wind_best_fit_u) ** 2 + (amv_vwind - sat_wind_best_fit_v) ** 2)
if vdiff > 4.0:
......@@ -1115,12 +1113,12 @@ def best_fit_altitude(amv_spd, amv_dir, amv_alt, amv_lat, amv_lon, fcst_spd, fcs
flag = 2
# Check for a substantial secondary local minimum or if local minimum is too broad
mm = np.where(fcst_alt > (sat_wind_best_fit_alt + constraint_half_width))[0]
nn = np.where(fcst_alt < (sat_wind_best_fit_alt - constraint_half_width))[0]
if (np.sum(vec_diff[mm] < (vdiff + 2.0)) + np.sum(vec_diff[nn] < (vdiff + 2.0))) > 0:
good_constraint = 0
flag = 1
if good_constraint == 1:
mm = np.where(fcst_alt > (sat_wind_best_fit_alt + constraint_half_width))[0]
nn = np.where(fcst_alt < (sat_wind_best_fit_alt - constraint_half_width))[0]
if (np.sum(vec_diff[mm] < (vdiff + 2.0)) + np.sum(vec_diff[nn] < (vdiff + 2.0))) > 0:
good_constraint = 0
flag = 1
if good_constraint == 1:
bf_tup = (sat_wind_best_fit_u, sat_wind_best_fit_v, sat_wind_best_fit_alt, flag)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment