From a839bc9a5ee94a55b57aa28831d8bb7865bcb993 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 13 Nov 2024 13:57:39 -0600
Subject: [PATCH] snapshot...

---
 modules/util/acspo_validate.py | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/modules/util/acspo_validate.py b/modules/util/acspo_validate.py
index b8b89668..a503e78d 100644
--- a/modules/util/acspo_validate.py
+++ b/modules/util/acspo_validate.py
@@ -49,24 +49,31 @@ def acspo_validate(oper_file, cspp_file):
     print('oper start, stop ', start_idx_oper, stop_idx_oper)
     print('cspp start, stop ', start_idx_cspp, stop_idx_cspp)
 
-    lon_cspp = lon_cspp[start_idx_cspp:stop_idx_cspp, :].flatten()
-    lat_cspp = lat_cspp[start_idx_cspp:stop_idx_cspp, :].flatten()
-    lon_oper = lon_oper[start_idx_oper:stop_idx_oper, :].flatten()
-    lat_oper = lat_oper[start_idx_oper:stop_idx_oper, :].flatten()
-
-    print(np.size(lon_cspp), np.size(lon_oper))
-    print(np.size(lat_cspp), np.size(lat_oper))
+    lon_cspp = lon_cspp[start_idx_cspp:stop_idx_cspp, :]
+    lat_cspp = lat_cspp[start_idx_cspp:stop_idx_cspp, :]
+    lon_oper = lon_oper[start_idx_oper:stop_idx_oper, :]
+    lat_oper = lat_oper[start_idx_oper:stop_idx_oper, :]
+    cspp_clear = cspp_clear[start_idx_oper:stop_idx_oper, :]
+    oper_clear = oper_clear[start_idx_oper:stop_idx_oper, :]
+    overlap_shape = lon_cspp.shape
+    print('overlap shape, size: ', overlap_shape, np.size(lon_cspp))
 
     print(np.sum(np.isclose(lon_cspp, lon_oper, rtol=0.001)))
     print(np.sum(np.isclose(lat_cspp, lat_oper, rtol=0.001)))
 
     sst_cspp = sst_cspp[start_idx_cspp:stop_idx_cspp, :].flatten()
     sst_oper = sst_oper[start_idx_oper:stop_idx_oper, :].flatten()
+    oper_clear = oper_clear.flatten()
+    cspp_clear = cspp_clear.flatten()
+    both_clear = oper_clear & cspp_clear
+    sst_cspp = sst_cspp[both_clear]
+    sst_oper = sst_oper[both_clear]
 
     both_valid = np.invert(np.isnan(sst_cspp)) & np.invert(np.isnan(sst_oper))
-    print('number of valid sst in both: ', np.sum(both_valid))
+    print('number of clear and valid SSTs in both: ', np.sum(both_valid))
 
-    print(np.sum(np.isclose(sst_cspp[both_valid], sst_oper[both_valid], rtol=0.001)))
+    print('fraction approx equal: ',
+          np.sum(np.isclose(sst_cspp[both_valid], sst_oper[both_valid], rtol=0.001))/np.sum(both_valid))
     # print(np.histogram((sst_cspp[both_valid] - sst_oper[both_valid]), bins=10))
 
 
-- 
GitLab