From a6a7e0979d2e64be6effa7c4a3048c5445546b6f Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 27 Sep 2021 20:21:35 -0500
Subject: [PATCH] Fix hanlding of out-of-domain earth loc in earth_to_lc_s

---
 modules/util/geos_nav.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/util/geos_nav.py b/modules/util/geos_nav.py
index bab4d343..587ffab8 100644
--- a/modules/util/geos_nav.py
+++ b/modules/util/geos_nav.py
@@ -162,8 +162,18 @@ class GEOSNavigation:
     def earth_to_lc_s(self, lons, lats):
         lamda, theta = self.earth_to_sat_s(lons, lats)
         cc, ll = self.sat_to_lc(lamda, theta)
+
         cc = np.where(np.isnan(lamda), -1, cc)
+        cc = np.where(cc < 0, -1, cc)
+        cc = np.where(cc >= self.num_elems, -1, cc)
+
         ll = np.where(np.isnan(theta), -1, ll)
+        ll = np.where(ll < 0, -1, ll)
+        ll = np.where(ll >= self.num_lines, -1, ll)
+
+        cc[ll == -1] = -1
+        ll[cc == -1] = -1
+
         return cc, ll
 
     def lc_to_earth(self, cc, ll):
-- 
GitLab