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

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

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index 4803a124..508f55eb 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -711,6 +711,8 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
     print('number of one layer profs with at least one AMV within threshold: ', num_one_lyr_profs)
 
     cnt = 0
+    prof_bot = one_lyr_profs.sel(num_params='layer_bot')
+    prof_top = one_lyr_profs.sel(num_params='layer_top')
     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)
@@ -719,7 +721,7 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
         vld = h_3d > 0
         h_3d = h_3d[vld]
         if len(h_3d) > 0:
-            in_lyr = np.logical_and(h_3d > one_lyr_profs[k, 0, 0], h_3d < one_lyr_profs[k, 0, 1])
+            in_lyr = np.logical_and(h_3d > prof_bot[k, 0], h_3d < prof_top[k, 0])
             cnt += np.sum(in_lyr)
 
     print('fraction hits single cloud layer: ', cnt/num_one_lyr_profs)
@@ -758,7 +760,7 @@ def analyze(prof_da, amvs_da, prof_locs_da, dist_threshold=5.0):
         if len(h_3d) > 0:
             nlevs = prof_locs_da[k].values.astype(int)[3]
             for j in range(nlevs):
-                in_lyr = np.logical_and(h_3d > prof_da[k, j, 0], h_3d < prof_da[k, j, 1])
+                in_lyr = np.logical_and(h_3d > prof_bot[k, j], h_3d < prof_top[k, j])
                 cnt += np.sum(in_lyr)
 
     print('fraction hits multi layer: ', cnt/num_profs)
-- 
GitLab