From 1c16e5d2f3b2f00a448e60e5e5ab9bbb6ef458dd Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Sun, 25 Oct 2020 10:18:35 -0500
Subject: [PATCH] snapshot...

---
 modules/amv/intercompare.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules/amv/intercompare.py b/modules/amv/intercompare.py
index 3e6bbf12..d3cd8e6c 100644
--- a/modules/amv/intercompare.py
+++ b/modules/amv/intercompare.py
@@ -948,10 +948,7 @@ def best_fit(amv_spd, amv_dir, amv_prs, amv_lat, amv_lon, fcst_spd, fcst_dir, fc
         v3 = VecDiff[imin+1]
         v1 = VecDiff[imin-1]
 
-# if top of allowed region
-        if p3 < TopPress:
-            SatwindBestFitPress = p2
-        elif v1 != v2 and v2 != v3: # check not collinear
+        if p3 < TopPress and v1 != v2 and v2 != v3: # check not collinear, above allowed region
             SatwindBestFitPress = p2 - (0.5 *
             ((((p2 - p1) * (p2 - p1) * (v2 - v3)) - ((p2 - p3) * (p2 - p3) * (v2 - v1))) /
             (((p2 - p1) * (v2 - v3)) - ((p2 - p3) * (v2 - v1)))))
@@ -1094,7 +1091,7 @@ def best_fit_altitude(amv_spd, amv_dir, amv_alt, amv_lat, amv_lon, fcst_spd, fcs
         v3 = vec_diff[imin+1]
 
         # check not co-linear and below alt_max
-        if a3 < alt_max and a1 != a2 and a2 != a3:
+        if a3 < alt_max and v1 != v2 and v2 != v3:
             sat_wind_best_fit_alt = minimize_quadratic(a1, a2, a3, v1, v2, v3)
             if sat_wind_best_fit_alt < a1 or sat_wind_best_fit_alt > a3:
                 sat_wind_best_fit_alt = a2
-- 
GitLab