From e446e857d4cd278e6bc97c0ab5c59d47622e9859 Mon Sep 17 00:00:00 2001 From: Anne Philipp <anne.philipp@univie.ac.at> Date: Fri, 1 Mar 2019 23:37:18 +0100 Subject: [PATCH] added functionality to eliminate unnecessary data/times --- source/python/classes/EcFlexpart.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/python/classes/EcFlexpart.py b/source/python/classes/EcFlexpart.py index 9835199..22214d4 100644 --- a/source/python/classes/EcFlexpart.py +++ b/source/python/classes/EcFlexpart.py @@ -1376,6 +1376,12 @@ class EcFlexpart(object): ''' + # generate start and end timestamp of the retrieval period + start_period = datetime.strptime(c.start_date + c.time[0], '%Y%m%d%H') + start_period = start_period + timedelta(hours=int(c.step[0])) + end_period = datetime.strptime(c.end_date + c.time[-1], '%Y%m%d%H') + end_period = end_period + timedelta(hours=int(c.step[-1])) + if c.wrf: table128 = init128(_config.PATH_GRIBTABLE) wrfpars = to_param_id('sp/mslp/skt/2t/10u/10v/2d/z/lsm/sst/ci/sd/\ @@ -1442,6 +1448,12 @@ class EcFlexpart(object): timestamp += timedelta(hours=int(cstep)) cdate_hour = datetime.strftime(timestamp, '%Y%m%d%H') + # eliminate all temporary times + # which are outside the retrieval period + if timestamp < start_period or \ + timestamp > end_period: + continue + # if the timestamp is out of basetime start/end date period, # skip this specific product if c.basetime is not None: -- GitLab