Index: Source/Python/Classes/ControlFile.py
===================================================================
--- Source/Python/Classes/ControlFile.py	(revision 0540bd0a86f9c95077ae8ffbb0ee2b7acd98cf07)
+++ Source/Python/Classes/ControlFile.py	(revision a676cf743d0a6b0d6132985caac376d371883c70)
@@ -624,6 +624,4 @@
                                                      self.end_date)
 
-        self.basetime = check_basetime(self.basetime)
-
         self.levelist, self.level = check_levels(self.levelist, self.level)
 
@@ -639,7 +637,9 @@
         self.type = check_type(self.type, self.step)
 
+        self.purefc = check_purefc(self.type)
+
+        self.basetime, self.time = check_basetime(self.basetime, self.time, self.purefc)
+
         self.time = check_time(self.time)
-
-        self.purefc = check_purefc(self.type)
 
         self.type, self.time, self.step = check_len_type_time_step(self.type,
@@ -652,5 +652,6 @@
 
         self.acctime = check_acctime(self.acctime, self.marsclass,
-                                     self.purefc, self.time)
+                                     self.purefc, self.time,
+                                     self.basetime, self.oper)
 
         self.accmaxstep = check_accmaxstep(self.accmaxstep, self.marsclass,
Index: Source/Python/Classes/EcFlexpart.py
===================================================================
--- Source/Python/Classes/EcFlexpart.py	(revision 365c82a890a4421172ac6711ad7e96cfeec080e9)
+++ Source/Python/Classes/EcFlexpart.py	(revision a676cf743d0a6b0d6132985caac376d371883c70)
@@ -615,5 +615,5 @@
 
 
-    def retrieve(self, server, dates, public, request, inputdir='.'):
+    def retrieve(self, server, dates, public, purefc, request, inputdir='.'):
         '''Finalizing the retrieval information by setting final details
         depending on grid type.
@@ -634,4 +634,12 @@
             "YYYYMMDD/to/YYYYMMDD"
 
+        public : int
+            Switch to select kind of ECMWF Web API access and the possible data sets.
+            Public data sets (1) and Member states data sets (0).
+
+        purefc : int
+            Switch to decide whether the job is a pure forecast retrieval or
+            coupled with analysis data.
+
         request : int
             Selects the mode of retrieval.
@@ -652,4 +660,5 @@
         self.public = public
         self.inputdir = inputdir
+        self.purefc = purefc
         oro = False
 
@@ -739,5 +748,5 @@
                         print('CHANGED FC start date to ' +
                               sdate.strftime("%Y%m%d") +
-                              ' to accomodate TIME=' +
+                              ' to accommodate TIME=' +
                               retr_param_dict['time'][0] +
                               ', STEP=' +
@@ -753,23 +762,49 @@
                     # if yes eliminate those fields since they may not
                     # be accessible with user's credentials
-
+                    dates = retr_param_dict['date'].split('/')
                     enddate = retr_param_dict['date'].split('/')[-1]
-                    elimit = datetime.strptime(enddate + str(self.basetime),
-                                               '%Y%m%d%H')
+                    elimit = datetime.strptime(enddate, '%Y%m%d')
 
                     if self.basetime == 12:
                         # --------------  flux data ----------------------------
-                        if 'acc' in pk:
-                            startdate = retr_param_dict['date'].split('/')[0]
-                            enddate = datetime.strftime(elimit - t24h, '%Y%m%d')
-                            retr_param_dict['date'] = '/'.join([startdate,
-                                                                'to',
-                                                                enddate])
+                        if 'acc' in pk and not self.purefc:
+
+                            retr_param_dict['date'] = dates[0]
+                            retr_param_dict['time'] = '12'
+                            retr_param_dict['target'] = \
+                                self._mk_targetname(ftype, pk,
+                                                    retr_param_dict['date'])
 
                             # ******* start retrievement
                             self._start_retrievement(request, retr_param_dict)
 
-                            retr_param_dict['date'] = \
-                                datetime.strftime(elimit - t12h, '%Y%m%d')
+                            retr_param_dict['date'] = dates[-1]
+                            retr_param_dict['time'] = '00/12'
+                            retr_param_dict['target'] = \
+                                self._mk_targetname(ftype, pk,
+                                                    retr_param_dict['date'])
+
+                            # ******* start retrievement
+                            self._start_retrievement(request, retr_param_dict)
+
+                        # --------------  non flux data ------------------------
+                        else:
+                            # ******* start retrievement
+                            self._start_retrievement(request, retr_param_dict)
+
+                    elif self.basetime == 0:
+                        # --------------  flux data ----------------------------
+                        if 'acc' in pk and not self.purefc:
+
+                            retr_param_dict['date'] = dates[0]
+                            retr_param_dict['time'] = '00/12'
+                            retr_param_dict['target'] = \
+                                self._mk_targetname(ftype, pk,
+                                                    retr_param_dict['date'])
+
+                            # ******* start retrievement
+                            self._start_retrievement(request, retr_param_dict)
+
+                            retr_param_dict['date'] = dates[-1]
                             retr_param_dict['time'] = '00'
                             retr_param_dict['target'] = \
@@ -779,47 +814,42 @@
                             # ******* start retrievement
                             self._start_retrievement(request, retr_param_dict)
-
-                        # --------------  non flux data ------------------------
-                        else:
+                        elif 'acc' in pk and self.purefc:
                             # ******* start retrievement
                             self._start_retrievement(request, retr_param_dict)
-
-                    elif self.basetime == 0:
-
-                        timesave = ''.join(retr_param_dict['time'])
-
-                        if all(['/' in retr_param_dict['time'],
-                                pk != 'OG_OROLSM__SL',
-                                'acc' not in pk]):
-                            times = retr_param_dict['time'].split('/')
-                            steps = retr_param_dict['step'].split('/')
-
-                            while int(times[0]) + int(steps[0]) <= 12:
-                                times = times[1:]
-                                if len(times) > 1:
-                                    retr_param_dict['time'] = '/'.join(times)
-                                else:
-                                    retr_param_dict['time'] = times[0]
-
-                        if all([pk != 'OG_OROLSM__SL',
-                                int(retr_param_dict['step'].split('/')[0]) == 0,
-                                int(timesave.split('/')[0]) == 0]):
-
-                            retr_param_dict['date'] = \
-                                datetime.strftime(elimit, '%Y%m%d')
-                            retr_param_dict['time'] = '00'
-                            retr_param_dict['step'] = '000'
-                            retr_param_dict['target'] = \
-                                self._mk_targetname(ftype, pk,
-                                                    retr_param_dict['date'])
-
-                        if ftype.upper() == 'FC' and \
-                                'acc' not in retr_param_dict['target']:
-
-                            retr_param_dict['date'] = \
-                                datetime.strftime(elimit - t24h, '%Y%m%d')
-
-                        # ******* start retrievement
-                        self._start_retrievement(request, retr_param_dict)
+                        # --------------  non flux data ------------------------
+                        else: # 'acc' not in pk
+                            timesave = ''.join(retr_param_dict['time'])
+
+                            if all(['/' in retr_param_dict['time'],
+                                    pk != 'OG_OROLSM__SL']):
+                                times = retr_param_dict['time'].split('/')
+                                steps = retr_param_dict['step'].split('/')
+
+                                while int(times[0]) + int(steps[0]) <= 12:
+                                    times = times[1:]
+                                    if len(times) > 1:
+                                        retr_param_dict['time'] = '/'.join(times)
+                                    else:
+                                        retr_param_dict['time'] = times[0]
+
+                            if all([pk != 'OG_OROLSM__SL',
+                                    int(retr_param_dict['step'].split('/')[0]) == 0,
+                                    int(timesave.split('/')[0]) == 0]):
+
+                                retr_param_dict['date'] = \
+                                    datetime.strftime(elimit, '%Y%m%d')
+                                retr_param_dict['time'] = '00'
+                                retr_param_dict['step'] = '000'
+                                retr_param_dict['target'] = \
+                                    self._mk_targetname(ftype, pk,
+                                                        retr_param_dict['date'])
+
+                            if ftype.upper() == 'FC' and not self.purefc:
+
+                                retr_param_dict['date'] = \
+                                    datetime.strftime(elimit - t24h, '%Y%m%d')
+
+                            # ******* start retrievement
+                            self._start_retrievement(request, retr_param_dict)
                     else:
                         raise ValueError('ERROR: Basetime has an invalid value '
Index: Source/Python/Mods/checks.py
===================================================================
--- Source/Python/Mods/checks.py	(revision 5606fc9016f687817ac735fc0bbcf2f26d9f7039)
+++ Source/Python/Mods/checks.py	(revision a676cf743d0a6b0d6132985caac376d371883c70)
@@ -93,5 +93,5 @@
         else:
             raise ValueError('GRID parameter contains two '
-                             'different values: %s' (grid))
+                             'different values: %s', grid)
     # # determine grid format
     # if float(grid) / 100. >= 0.5:
@@ -236,5 +236,4 @@
     return levelist, level
 
-
 def check_ppid(c, ppid):
     '''Sets the current PPID.
@@ -262,5 +261,4 @@
     return
 
-
 def check_purefc(ftype):
     '''Check for a pure forecast mode.
@@ -283,5 +281,4 @@
 
     return 0
-
 
 def check_step(step):
@@ -404,12 +401,7 @@
         Valid values are hours (HH) from forecast base time.
     '''
-    if not len(ftype) == len(ftime) == len(steps):
-        raise ValueError('ERROR: The number of field types, times and steps '
-                         'are not the same! Please check the settings in the '
-                         'CONTROL file!')
-
     # if pure forecast is selected and only one field type/time is set
     # prepare a complete list of type/time/step combination upto maxstep
-    if len(ftype) == 1 and purefc:
+    if len(ftime) == 1 and purefc:
         nftype = []
         nsteps = []
@@ -421,4 +413,8 @@
         return nftype, nftime, nsteps
 
+    if not len(ftype) == len(ftime) == len(steps):
+        raise ValueError('ERROR: The number of field types, times and steps '
+                         'are not the same! Please check the settings in the '
+                         'CONTROL file!')
     return ftype, ftime, steps
 
@@ -605,5 +601,5 @@
     return maxstep
 
-def check_basetime(basetime):
+def check_basetime(basetime, time, purefc):
     '''Check if basetime is set and contains one of the two
     possible values (0, 12).
@@ -615,4 +611,11 @@
         retrieved.
 
+    time : str
+        The time in hours of the field.
+
+    purefc : int
+        1 if pure forecasts are to be retrieved. 0 if there are
+        analysis fields in between.
+
     Return
     ------
@@ -620,4 +623,7 @@
         The time for a half day retrieval. The 12 hours upfront are to be
         retrieved.
+
+    time : str or list of str
+        The time in hours of the field.
     '''
     if basetime is not None:
@@ -626,5 +632,7 @@
             raise ValueError('ERROR: Basetime has an invalid value '
                              '-> {}'.format(str(basetime)))
-    return basetime
+        if purefc:
+            time = str(basetime)
+    return basetime, time
 
 def check_request(request, marsfile):
@@ -707,6 +715,5 @@
     return acctype
 
-
-def check_acctime(acctime, marsclass, purefc, time):
+def check_acctime(acctime, marsclass, purefc, time, basetime, oper):
     '''Guarantees that the accumulation forecast times were set.
 
@@ -725,4 +732,12 @@
         Switch for definition of pure forecast mode or not.
 
+    basetime : int
+        The time for a half day retrieval. The 12 hours upfront are to be
+        retrieved.
+
+    oper : int
+        Switch to prepare the operational job script. Start date, end date and
+        basetime will be prepared with environment variables.
+
     Return
     ------
@@ -730,4 +745,7 @@
         The starting time for the accumulated forecasts.
     '''
+
+    if acctime and basetime and oper:
+        return basetime
 
     if not acctime:
@@ -817,5 +835,5 @@
         if '/' in addpar:
             parlist = addpar.split('/')
-            parlist = [p for p in parlist if p is not '']
+            parlist = [p for p in parlist if p != '']
         else:
             parlist = [addpar]
@@ -824,5 +842,4 @@
 
     return addpar
-
 
 def check_job_chunk(job_chunk):
@@ -853,5 +870,4 @@
 
     return job_chunk
-
 
 def check_number(number):
Index: Source/Python/Mods/get_mars_data.py
===================================================================
--- Source/Python/Mods/get_mars_data.py	(revision 365c82a890a4421172ac6711ad7e96cfeec080e9)
+++ Source/Python/Mods/get_mars_data.py	(revision a676cf743d0a6b0d6132985caac376d371883c70)
@@ -160,5 +160,5 @@
     start, end, datechunk = mk_dates(c, fluxes=True)
     do_retrievement(c, server, start, end, datechunk, fluxes=True)
-
+    
     # --------------  non flux data --------------------------------------------
     start, end, datechunk = mk_dates(c, fluxes=False)
@@ -293,11 +293,11 @@
     chunk = timedelta(days=int(c.date_chunk))
 
-    if c.basetime == 0 and not fluxes:  # non-fluxes
+    if c.basetime == 0 and not fluxes and not c.purefc:  # 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)
+#        if not c.oper:
+#            end = end + timedelta(days=1)
 
     if not c.purefc and fluxes:
@@ -305,6 +305,6 @@
         if not c.oper:
             end = end + timedelta(days=1)
-        elif c.oper and c.basetime == 0:
-            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
@@ -389,5 +389,5 @@
 
         try:
-            flexpart.retrieve(server, dates, c.public, c.request, c.inputdir)
+            flexpart.retrieve(server, dates, c.public, c.purefc, c.request, c.inputdir)
         except IOError:
             my_error('MARS request failed')
