diff --git a/modules/amv/intercompare.py b/modules/amv/intercompare.py index 74db79edf5f7ee63ee4e67518b5406eacc96a4e8..412c682f23e0e0ccd04ebc59859bfecc84da75b1 100644 --- a/modules/amv/intercompare.py +++ b/modules/amv/intercompare.py @@ -1115,12 +1115,23 @@ def best_fit_altitude(amv_spd, amv_dir, amv_alt, amv_lat, amv_lon, fcst_spd, fcs + + # Find best fit U and V by linear interpolation: if a2 == sat_wind_best_fit_alt: sat_wind_best_fit_u = fcst_uwind[imin] sat_wind_best_fit_v = fcst_vwind[imin] else: - pass + if a2 < sat_wind_best_fit_alt: + lev_below = imin + lev_above = imin + 1 + Prop = (sat_wind_best_fit_alt - a2) / (a3 - a2) + else: + pass + + sat_wind_best_fit_u = fcst_uwind[lev_below] * (1.0 - Prop) + fcst_uwind[lev_above] * Prop + sat_wind_best_fit_v = fcst_vwind[lev_below] * (1.0 - Prop) + fcst_vwind[lev_above] * Prop + return bf_tup