From 53cfc3eab235ce56d0ad9408d26f3d2ffdd61825 Mon Sep 17 00:00:00 2001
From: nickb <nickb@ssec.wisc.edu>
Date: Fri, 19 Feb 2021 18:15:07 +0000
Subject: [PATCH] get our list of gridded files directly from
 grid_GLM_flashes() instead of globbing for them

---
 gridded_glm/libexec/_minute_gridder.py | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/gridded_glm/libexec/_minute_gridder.py b/gridded_glm/libexec/_minute_gridder.py
index 34db872..add96d4 100644
--- a/gridded_glm/libexec/_minute_gridder.py
+++ b/gridded_glm/libexec/_minute_gridder.py
@@ -328,16 +328,12 @@ if __name__ == '__main__':
 
     # do the gridding
     gridder, glm_filenames, start_time, end_time, grid_kwargs = grid_setup(args, work_dir=tempdir_path)
-    gridder(glm_filenames, start_time, end_time, **grid_kwargs)
-
-    # FIXME: rather than using globs (below), gridder (above) returns some sort of zipped structure that contains the output filenames
-    # pick up gridded files from the tempdir
-    # output looks like: OR_GLM-L2-GLMC-M3_G17_s20202691559400_e20202691600400_c20210120141010.nc
-    log.debug("gridded files in {}".format(tempdir_path))
-    gridded_path = os.path.join(tempdir_path, '{}_GLM-L2-GLM*-M?_G??_s*_e*_c*.nc'.format(args.system_environment_prefix))
-    log.debug(gridded_path)
-    gridded_files = glob(gridded_path)
-    log.debug(gridded_files)
+    gridder_return = gridder(glm_filenames, start_time, end_time, **grid_kwargs)
+
+    gridded_files = []
+    for subgrid in gridder_return:
+        for gridded_file in subgrid[1]:
+            gridded_files.append(gridded_file)
 
     # we need to add attributes here due to an issue where satpy (or its dependencies) are
     # holding the input gridded file open until the process exits
-- 
GitLab