diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index 4803a1244f66927ad0497982e87b04f4231f239a..508f55ebfeae481f5c9eee38a374803c138b3b70 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)