From c50ed8be1f50918c8bcf7e8637d294cf4d16adf0 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 22 Jun 2021 14:38:50 -0500
Subject: [PATCH] minor

---
 modules/aeolus/aeolus_amv.py | 56 ++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index 23d4644a..1d8229f5 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -1493,7 +1493,7 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
 
     keys = list(aeolus_dict.keys())
 
-    cnt = 0
+    #cnt = 0
     last_f_idx = -1
     param_nd = None
     dataset = None
@@ -1508,6 +1508,8 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
         if prof_s is None:
             continue
 
+        match_dict[key] = []
+
         if f_idx != last_f_idx:
             last_f_idx = f_idx
             dataset = Dataset(fname)
@@ -1530,9 +1532,9 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
             for param in clvrx_params:
                 data.append(dataset[param][cc-4:cc+5, ll-4:ll+5])
             param_nd = np.stack(data, axis=0)
-            match_dict[cnt] = (key, cc, ll, f_idx, prof, param_nd)
+            match_dict[key].append((cc, ll, f_idx, prof, param_nd))
 
-            cnt += 1
+            #cnt += 1
 
     for ds in dataset_s:
         ds.close()
@@ -1556,15 +1558,16 @@ def create_aeolus_clavrx_match_file(match_dct, filename, clvrx_params):
     # scan to get max num levels
     keys = list(match_dct.keys())
     for key in keys:
-        tup = match_dct.get(key)
-        prof = tup[4]
-        lat = prof[0, 0]
-        lon = prof[0, 1]
-        alons.append(lon)
-        alats.append(lat)
-        atimes.append(tup[0])
-        elems.append(tup[1])
-        lines.append(tup[2])
+        tup_s = match_dct.get(key)
+        for tup in tup_s:
+            prof = tup[3]
+            lat = prof[0, 0]
+            lon = prof[0, 1]
+            alons.append(lon)
+            alats.append(lat)
+            atimes.append(key)
+            elems.append(tup[0])
+            lines.append(tup[1])
 
         nlevs = prof.shape[0]
         if nlevs > max_num_alevels:
@@ -1630,20 +1633,23 @@ def create_aeolus_clavrx_match_file(match_dct, filename, clvrx_params):
     prf_line[:] = lines
     prf_time[:] = atimes
 
-    for idx, key in enumerate(keys):
-        tup = match_dct.get(key)
-        prof = tup[4]
-        param_nd = tup[5]
-
-        nlevs = prof.shape[0]
-        for k in range(nlevs):
-            prf_spd[idx,k] = prof[k,6]
-            prf_azm[idx,k] = prof[k,5]
-            prf_hht[idx,k] = prof[k,3]
-            prf_hhb[idx,k] = prof[k,4]
+    idx = 0
+    for key in enumerate(keys):
+        tup_s = match_dct.get(key)
+        for tup in tup_s:
+            prof = tup[3]
+            param_nd = tup[4]
 
-        for pidx, param in enumerate(clvrx_params):
-            nc4_vars[pidx][idx, :, :] = param_nd[pidx, :, :]
+            nlevs = prof.shape[0]
+            for k in range(nlevs):
+                prf_spd[idx,k] = prof[k,6]
+                prf_azm[idx,k] = prof[k,5]
+                prf_hht[idx,k] = prof[k,3]
+                prf_hhb[idx,k] = prof[k,4]
+
+            for pidx, param in enumerate(clvrx_params):
+                nc4_vars[pidx][idx, :, :] = param_nd[pidx, :, :]
+            idx += 1
 
     rg_exmpl.close()
     rootgrp.close()
-- 
GitLab