From c0c00bef4d5b8f273450232d09d15fb0a8bb799d Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 29 Mar 2021 18:27:40 -0500
Subject: [PATCH] snapshot...

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

diff --git a/modules/util/util.py b/modules/util/util.py
index c132ebc6..2ce16c6c 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -153,11 +153,11 @@ def value_to_index(nda, value):
     return idx
 
 
-# array solzen must be degrees, missing values must NaN
-def is_night(solzen, threshold):
+# array solzen must be degrees, missing values must NaN. For small 50x50km regions only
+def is_night(solzen, test_angle=80.0, threshold=0.10):
     solzen = solzen.flatten()
     solzen = solzen[np.invert(np.isnan(solzen))]
-    if np.max(solzen) > threshold:
+    if (np.sum(solzen > test_angle) / len(solzen)) > threshold:
         return True
     else:
         return False
-- 
GitLab