From b53270b0cc9e8f9106d28a6ff74b63fd05ab3dde Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 12 Nov 2020 15:29:35 -0600
Subject: [PATCH] snapshot...

---
 modules/aeolus/aeolus_amv.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index 1bd33a5e..4803a124 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -707,10 +707,11 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
 
     one_lyr_amvs = one_lyr_amvs[close]
     one_lyr_profs = one_lyr_profs[close]
-    print('number of one layer profs with at least one AMV within 5km: ', one_lyr_profs.shape[0])
+    num_one_lyr_profs = one_lyr_profs.shape[0]
+    print('number of one layer profs with at least one AMV within threshold: ', num_one_lyr_profs)
 
     cnt = 0
-    for k in range(one_lyr_profs.shape[0]):
+    for k in range(num_one_lyr_profs):
         dst = one_lyr_amvs[k, :, ].sel(num_params='dist_to_prof')
         b = np.logical_and(dst > 0.0, dst < dist_threshold)
         h_3d = one_lyr_amvs[k, :].sel(num_params='H_3D')
@@ -721,7 +722,7 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
             in_lyr = np.logical_and(h_3d > one_lyr_profs[k, 0, 0], h_3d < one_lyr_profs[k, 0, 1])
             cnt += np.sum(in_lyr)
 
-    print(cnt)
+    print('fraction hits single cloud layer: ', cnt/num_one_lyr_profs)
 
     # Do calculations for single and multi-layer combined
     hgt_vld = amvs_da.sel(num_params='H_3D') > 0
@@ -741,10 +742,13 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
     amvs_da = amvs_da[close]
     prof_da = prof_da[close]
     prof_locs_da = prof_locs_da[close]
-    print('number of profs with at least one AMV within 5km: ', prof_da.shape[0])
+    num_profs = prof_da.shape[0]
+    print('number of profs with at least one AMV within 5km: ', num_profs)
 
     cnt = 0
-    for k in range(prof_da.shape[0]):
+    prof_bot = prof_da.sel(num_params='layer_bot')
+    prof_top = prof_da.sel(num_params='layer_top')
+    for k in range(num_profs):
         dst = amvs_da[k, :, ].sel(num_params='dist_to_prof')
         b = np.logical_and(dst > 0.0, dst < dist_threshold)
         h_3d = amvs_da[k, :].sel(num_params='H_3D')
@@ -757,5 +761,5 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
                 in_lyr = np.logical_and(h_3d > prof_da[k, j, 0], h_3d < prof_da[k, j, 1])
                 cnt += np.sum(in_lyr)
 
-    print(cnt)
+    print('fraction hits multi layer: ', cnt/num_profs)
     return one_lyr_profs, one_lyr_amvs
-- 
GitLab