From 3263cffeff0ce2f3bac98643c591962306a887ca Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 15 Feb 2021 13:59:28 -0600
Subject: [PATCH] slight mod to visibility test

---
 modules/util/geos_nav.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/util/geos_nav.py b/modules/util/geos_nav.py
index 58e8dfa6..dd47b0ba 100644
--- a/modules/util/geos_nav.py
+++ b/modules/util/geos_nav.py
@@ -95,8 +95,9 @@ class GEOSNavigation:
         r_1 = self.h - r_earth * np.cos(geocentric_lat) * np.cos(geographic_lon - self.sub_lon)
         r_2 = -r_earth * np.cos(geocentric_lat) * np.sin(geographic_lon - self.sub_lon)
         r_3 = r_earth * np.sin(geocentric_lat)
+        r = np.sqrt(r_1*r_1 + r_2*r_2 + r_3*r_3)
 
-        if r_1 > self.h:
+        if r >= self.h:
             return np.nan, np.nan
 
         if self.scan_geom == 'GEOS':
@@ -120,6 +121,7 @@ class GEOSNavigation:
         r_1 = self.h - r_earth * np.cos(geocentric_lat) * np.cos(geographic_lon - self.sub_lon)
         r_2 = -r_earth * np.cos(geocentric_lat) * np.sin(geographic_lon - self.sub_lon)
         r_3 = r_earth * np.sin(geocentric_lat)
+        r = np.sqrt(r_1*r_1 + r_2*r_2 + r_3*r_3)
 
         if self.scan_geom == 'GEOS':
             lamda_sat = np.arctan(-r_2/r_1)
@@ -128,8 +130,8 @@ class GEOSNavigation:
             lamda_sat = np.arcsin(-r_2/np.sqrt(r_1*r_1 + r_2*r_2 + r_3*r_3))
             theta_sat = np.arctan(r_3/r_1)
 
-        lamda_sat = np.where(r_1 > self.h, np.nan, lamda_sat)
-        theta_sat = np.where(r_1 > self.h, np.nan, theta_sat)
+        lamda_sat = np.where(r > self.h, np.nan, lamda_sat)
+        theta_sat = np.where(r > self.h, np.nan, theta_sat)
 
         return lamda_sat, theta_sat
 
-- 
GitLab