From 5bb8d3b1e7a0235719cc9a25b8a9f650c1f975cc Mon Sep 17 00:00:00 2001
From: Paolo Veglio <paolo.veglio@ssec.wisc.edu>
Date: Mon, 12 Dec 2022 20:39:13 +0000
Subject: [PATCH] tried to add qa_bits and test_bits into one function. Still
 exploring solutions for this

---
 spectral_tests.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/spectral_tests.py b/spectral_tests.py
index 73ee1eb..2bbb412 100644
--- a/spectral_tests.py
+++ b/spectral_tests.py
@@ -54,12 +54,19 @@ class CloudTests(object):
                   band: str,
                   cmin: np.ndarray,
                   test_name: str = '11um_Test') -> np.ndarray:
+
         confidence = np.ones(self.data[band].shape)
+        qa_bit = np.zeros(self.data[band].shape)
+        test_bit = np.zeros(self.data[band].shape)
         threshold = self.thresholds[self.scene_name][test_name]
 
         if (threshold['perform'] is True and self.pixels_in_scene is True):
+            qa_bit[self.scene_idx] = 1
             print(f'Testing "{self.scene_name}"\n')
             rad = self.data[band].values[self.scene_idx]
+            idx = np.nonzero((self.data[band].values >= threshold['thr'][1]) &
+                             (self.data[self.scene_name] == 1))
+            test_bit[idx] = 1
             confidence[self.scene_idx] = conf.conf_test_new(rad, threshold['thr'])
 
         cmin = np.fmin(cmin, confidence)
-- 
GitLab