Commit 896ea8bf authored by Espen Sollum's avatar Espen Sollum
Browse files

Delete older AshML files. Check for existing input file.

parent 2d62ea7c
......@@ -29,6 +29,7 @@ from datetime import timedelta
import pdb
#from joblib import Parallel, delayed
import importlib
import config
importlib.reload(IASITools)
......@@ -160,7 +161,10 @@ def PlotIASIFilteredGeo(nc_directory,
# Retrieve mass
# TODO: - delete old files
retrieve_mass(f)
ret = retrieve_mass(f)
if ret != 0:
# file has been deleted since processing began
continue
man_title = date_str[0:4] +'-'+date_str[4:6]+'-'+date_str[6:8]+' '+date_str[8:10]+':'+date_str[10:12] + ' UTC'
......@@ -195,11 +199,18 @@ def do_plot(f, **kwargs):
"""
pass
def retrieve_mass(file_name):
"""
Retrieve ash mass loading from IASI netcdf file (ore-processed by
Retrieve ash mass loading from IASI netcdf file (pre-processed by
ReadAndPlotIASI.py)
RETURN
0 for success, otherwise file does not exist
TODO
-fix the hardcoded paths
"""
# Path to processed files with retrievals
......@@ -211,6 +222,14 @@ def retrieve_mass(file_name):
# if verbose > 1:
# print(i, ": processing file ", f_n)
# Delete old files
IASITools.remove_old_files(NETCDFPATH, config.DAYS_TO_KEEP, 1, dry_run=False)
# Check if file exists before executing
if not os.path.exists(file_name):
return -1
proc = subprocess.Popen(cmd_retr + ['--IASIfile='+file_name],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
......@@ -223,6 +242,8 @@ def retrieve_mass(file_name):
proc.wait()
return 0
......
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