From f84c9f20cdcf6167ba8fde269c154f944c357607 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 12 Jan 2021 22:18:57 -0600
Subject: [PATCH] snapshot...

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

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index 9dead440..dec99631 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -22,12 +22,12 @@ num_elems = 5424
 num_lines = 5424
 
 
-def get_amvs(amv_files, timestamp, filepath=None):
+def get_amvs(amv_ds, timestamp, filepath=None):
     if filepath is None:
-        filepath, ftime, f_idx = amv_files.get_file(timestamp)
-    amv_params = amv_files.get_parameters()
+        filepath, ftime, f_idx = amv_ds.get_file(timestamp)
+    amv_params = amv_ds.get_parameters()
     # TODO: Need to generalize this better
-    amv_params = [amv_files.lat_name, amv_files.lon_name, amv_files.elem_name, amv_files.line_name] + amv_params
+    amv_params = [amv_ds.lat_name, amv_ds.lon_name, amv_ds.elem_name, amv_ds.line_name] + amv_params
     ds = Dataset(filepath)
 
     param_s = []
@@ -42,12 +42,19 @@ def get_amvs(amv_files, timestamp, filepath=None):
             vld = np.logical_and(vld, np.invert(param.mask))
         param_s.append(param.data)
 
+    # filter
+    qc_name = amv_ds.get_qc_params()
+    if qc_name is not None:
+        qc_param = ds[qc_name][:].data
+        good = amv_ds.filter(qc_param)
+        vld = np.logical_and(vld, good)
+
     param_nd = np.vstack(param_s)
     param_nd = param_nd[:, vld]
     param_nd = np.transpose(param_nd, axes=[1, 0])
 
-    if amv_files.elem_name is None:
-        nav = amv_files.get_navigation()
+    if amv_ds.elem_name is None:
+        nav = amv_ds.get_navigation()
         cc, ll = nav.earth_to_lc_s(param_nd[:, 1], param_nd[:, 0])
         tmp_nd = np.insert(param_nd, 2, cc, axis=1)
         param_nd = np.insert(tmp_nd, 3, ll, axis=1)
-- 
GitLab