Commit b9a6060c authored by Espen Sollum's avatar Espen Sollum
Browse files

Fixed problem with last time interval in case of missing files. Removed some output to stdout.

parent 896ea8bf
......@@ -233,7 +233,7 @@ eso@nilu.no
### Capture output from subprocess
proc_output = proc.stdout.read().strip()
if (len(proc_output) > -1):
if (len(proc_output) > 0):
print(proc_output)
proc.wait()
......
......@@ -8,7 +8,7 @@ DESCRIPTION
NOTE
Uses the "non-standard" pynco library, install under your user directory with
`python3 -m pip install --user nco´
"python3 -m pip install --user nco"
TODO
A cron job deletes IASI files older than n (=14?) days. Take care in this script
......@@ -126,11 +126,21 @@ def make_interval(files_dict, days_to_process=None):
utc_now_hour = datetime.utcnow().hour
end_hour = math.ceil(utc_now_hour/(DT.seconds/3600))*int(DT.seconds/3600)
# This fails to correctly produce latest interval if files are missing
# if end_hour == 24:
# # set h=0 and increase day
# end_day = latest_date.replace(hour=0, minute=0) + timedelta(days=1)
# else:
# end_day = latest_date.replace(hour=end_hour, minute=0)
# Try using current utc date instead of latest date of files
utc_now = datetime.utcnow()
if end_hour == 24:
# set h=0 and increase day
end_day = latest_date.replace(hour=0, minute=0) + timedelta(days=1)
end_day = utc_now.replace(hour=0, minute=0) + timedelta(days=1)
else:
end_day = latest_date.replace(hour=end_hour, minute=0)
end_day = utc_now.replace(hour=end_hour, minute=0)
# If days_to_process is given, only process the given days back in time
if days_to_process is not None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment