From 45850a34dafb8c501d12c7d97f31acfe64b2361b Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 15 Mar 2021 13:22:05 -0500
Subject: [PATCH] snapshot...

---
 modules/icing/pirep_goes.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 9af161ce..68eae2be 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -121,9 +121,20 @@ def create_file(filename, data_dct, ds_list, lon_c, lat_c, time_s, fl_alt_s):
     h5f.close()
 
 
-def run(pirep_dct, outfile=None, outfile_l1b=None):
+def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end=None):
     time_keys = list(pirep_dct.keys())
 
+    t_start = None
+    t_end = None
+    if (dt_str_start is not None) and (dt_str_end is not None):
+        dto = datetime.datetime.strptime(dt_str_start, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
+        dto.replace(tzinfo=timezone.utc)
+        t_start = dto.timestamp()
+
+        dto = datetime.datetime.strptime(dt_str_end, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
+        dto.replace(tzinfo=timezone.utc)
+        t_end = dto.timestamp()
+
     nav = GEOSNavigation(sub_lon=-75.0, CFAC=5.6E-05, COFF=-0.101332, LFAC=-5.6E-05, LOFF=0.128212, num_elems=2500, num_lines=1500)
 
     lon_s = np.zeros(1)
@@ -136,6 +147,12 @@ def run(pirep_dct, outfile=None, outfile_l1b=None):
     time_s = []
     fl_alt_s = []
     for idx, time in enumerate(time_keys):
+        if t_start is not None:
+            if time < t_start:
+                continue
+            if time > t_end:
+                continue
+
         reports = pirep_dct[time]
         for tup in reports:
             lat, lon, fl, rpt_str = tup
-- 
GitLab