From e3c679d2518710a8d2b18af648ec468fbdfeb003 Mon Sep 17 00:00:00 2001 From: Anne Philipp <anne.philipp@univie.ac.at> Date: Tue, 1 Dec 2020 16:35:15 +0100 Subject: [PATCH] BugFix for Ticket #286 --- Run/Control/CONTROL_EA5 | 1 - Source/Python/Classes/MarsRetrieval.py | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Run/Control/CONTROL_EA5 b/Run/Control/CONTROL_EA5 index 3d5e7c2..4fd74e7 100644 --- a/Run/Control/CONTROL_EA5 +++ b/Run/Control/CONTROL_EA5 @@ -19,5 +19,4 @@ ETA 1 FORMAT GRIB2 PREFIX EA CWC 1 -RRINT 1 ECTRANS 1 diff --git a/Source/Python/Classes/MarsRetrieval.py b/Source/Python/Classes/MarsRetrieval.py index dd97879..20c3aa9 100644 --- a/Source/Python/Classes/MarsRetrieval.py +++ b/Source/Python/Classes/MarsRetrieval.py @@ -504,13 +504,23 @@ class MarsRetrieval(object): date = datetime.strptime(attrs['date'], '%Y%m%d') newattrs['year'] = date.year newattrs['month'] = date.month - newattrs['day'] = date.day + newattrs['day'] = date.day + + # need to correct the time apperance for CDS surface field retrievals + if attrs['type'] == 'FC': # for EA5 only flux fields are retrieved as FC type + # need to convert fc start times 06/18 to usual AN times + # since the surface fields can only be access through their validity time + start, end, step = map(int,attrs['step'].split('/')[::2]) + newattrs['time'] = [ "{0:0=2d}".format(s) for s in range(0,24,step) ] + elif '/' in attrs['time']: # we expect a list of times separated by / + newattrs['time'] = attrs['time'].split('/') + elif isinstance(attrs['time'], str): # we expect a single time in here + newattrs['time'] = [ attrs['time'] ] newattrs['product_type'] = 'reanalysis' newattrs['area'] = attrs['area'].split('/') newattrs['grid'] = list(map(float,attrs['grid'].split('/'))) - newattrs['param'] = attrs['param'].split('/') - newattrs['time'] = list(map(str,range(0,24,3))) + newattrs['param'] = attrs['param'].split('/') newattrs['format'] = 'grib' return newattrs -- GitLab