From b9864114f5a4e412fd0d1307de15fea9d0170677 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Sun, 9 Jan 2022 16:16:38 -0600
Subject: [PATCH] snapshot...

---
 modules/amv/caliop_clavrx_amv.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/amv/caliop_clavrx_amv.py b/modules/amv/caliop_clavrx_amv.py
index 98a206ba..51506c95 100644
--- a/modules/amv/caliop_clavrx_amv.py
+++ b/modules/amv/caliop_clavrx_amv.py
@@ -103,10 +103,10 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
 
         match_dict[nom_time].append((cc, ll, lon_s[idx], lat_s[idx], f_idx, data_da, amvs_da))
 
-    return match_dict, calipso_clavrx_params, amv_params
+    return match_dict
 
 
-def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
+def create_file(match_dct, filename, caliop_clavrx_params, amv_params, amv_filenames):
     num_aprofs = 0
     max_num_amvs = 0
 
@@ -118,7 +118,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
     fidxs = []
     amvs_cnt = []
 
-    #amv_file_s = np.array(amv_file_s, dtype='object')
+    amv_file_s = np.array(amv_filenames, dtype='object')
 
     # scan to get max num levels, amvs
     keys = list(match_dct.keys())
@@ -158,10 +158,10 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
 
     dim_amvs = rootgrp.createDimension('max_num_amvs', size=max_num_amvs)
     dim_num_aeolus_prof = rootgrp.createDimension('num_caliop_profs', size=num_aprofs)
-    #dim_num_files = rootgrp.createDimension('num_amv_files', size=amv_file_s.shape[0])
+    dim_num_files = rootgrp.createDimension('num_amv_files', size=amv_file_s.shape[0])
 
     prf_time = rootgrp.createVariable('time', 'f4', ['num_caliop_profs'])
-    #amv_file_names = rootgrp.createVariable('amv_file_names', str, ['num_amv_files'])
+    amv_file_names = rootgrp.createVariable('amv_file_names', str, ['num_amv_files'])
 
     # ---- CALIOP variables ---------------
     prf_lon = rootgrp.createVariable('prof_longitude', 'f4', ['num_caliop_profs'])
@@ -224,7 +224,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
     amvs_cnt_var[:] = amvs_cnt
     #prf_fidx[:] = fidxs
 
-    #amv_file_names[:] = amv_file_s
+    amv_file_names[:] = amv_file_s
 
     idx = 0
     for key in keys:
@@ -267,12 +267,13 @@ def run_caliop_clavrx_amv_match(output_file, path_to_caliop_clavrx, path_to_amvs
 
     caliop_clavrx_ds = CLAVRx_CALIPSO(path_to_caliop_clavrx)
 
-    amv_files = get_datasource(path_to_amvs, amv_source, band=band)
-    amv_params = amv_files.get_parameters()
+    amv_ds = get_datasource(path_to_amvs, amv_source, band=band)
+    amv_params = amv_ds.get_parameters()
+    amv_filenames = amv_ds.flist
 
-    match_dict = match_calipso_clavrx_to_amvs(caliop_clavrx_ds, None, amv_files, amv_source=amv_source, band=band)
+    match_dict = match_calipso_clavrx_to_amvs(caliop_clavrx_ds, None, amv_ds, amv_source=amv_source, band=band)
 
     caliop_clavrx_params = get_parameters_caliop_clavrx()
 
-    create_file(match_dict, output_file, caliop_clavrx_params, amv_params)
+    create_file(match_dict, output_file, caliop_clavrx_params, amv_params, amv_filenames)
 
-- 
GitLab