From 168bd385dbae643d13225dcc22d39991985c5d05 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 26 Oct 2020 10:05:04 -0500 Subject: [PATCH] snapshot... --- modules/amv/intercompare.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/amv/intercompare.py b/modules/amv/intercompare.py index 32ad6a80..a2156bc0 100644 --- a/modules/amv/intercompare.py +++ b/modules/amv/intercompare.py @@ -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) -- GitLab