From 284ae9098736c96d06fdd0b595c46f71c406ec30 Mon Sep 17 00:00:00 2001
From: Anne Tipka <anne.tipka@ctbto.org>
Date: Wed, 26 Oct 2022 10:49:27 +0000
Subject: [PATCH] corrected dates and time for operational retrievals for
 fluxes

---
 Source/Python/Mods/get_mars_data.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Source/Python/Mods/get_mars_data.py b/Source/Python/Mods/get_mars_data.py
index 3d4c072..cdad4b6 100755
--- a/Source/Python/Mods/get_mars_data.py
+++ b/Source/Python/Mods/get_mars_data.py
@@ -292,18 +292,20 @@ def mk_dates(c, fluxes):
     end = datetime.strptime(c.end_date, '%Y%m%d')
     chunk = timedelta(days=int(c.date_chunk))
 
-    if c.basetime == 0:
+    if c.basetime == 0:  # non-fluxes
         start = start - timedelta(days=1)
 
     if c.purefc and fluxes and c.maxstep < 24:
         start = start - timedelta(days=1)
         if not c.oper:
-                end = end + timedelta(days=1)
+            end = end + timedelta(days=1)
 
-    if not c.purefc and fluxes and not c.basetime == 0:
+    if not c.purefc and fluxes:
         start = start - timedelta(days=1)
         if not c.oper:
-                end = end + timedelta(days=1)
+            end = end + timedelta(days=1)
+        elif c.oper and c.basetime == 0:
+            end = end - timedelta(days=1)
 
     # if we have non-flux forecast data starting at 18 UTC
     # we need to start retrieving data one day in advance
-- 
GitLab