Commit 699aef1a authored by Florentie, Liesbeth's avatar Florentie, Liesbeth
Browse files

fixed error with timevec?

parent 1173cdcf
......@@ -121,12 +121,13 @@ class ctsfTM5ObsOperator(TM5ObservationOperator):
enddate = self.dacycle['time.sample.end']
logging.info('Calculating fluxes from %s to %s' % (startdate, enddate))
datevec = self.calc_timevec_monthly(startdate, enddate)
datevec = self.calc_datevec_monthly(startdate, enddate)
timevec = []
for date in datevec:
timevec.append( (date-fluxmodel.refdate).days )
del date
self.timevec = np.array(timevec)
logging.info('Timevec = %s' % timevec)
# calculate and write fluxmap for ensemble
fluxmodel.calc_flux(self.timevec)
......@@ -139,20 +140,20 @@ class ctsfTM5ObsOperator(TM5ObservationOperator):
def calc_timevec_monthly(self, startdate, enddate):
def calc_datevec_monthly(self, startdate, enddate):
"""Creates time vector with monthly interval ranging from startdate to enddate."""
timevec = []
datevec = []
date = dt.datetime(startdate.year,startdate.month,15)
while date <= enddate:
timevec.append(date)
datevec.append(date)
if date.month < 12:
date = dt.datetime(date.year,date.month+1,15)
else:
date = dt.datetime(date.year+1,1,15)
logging.info('Timevec = %s' % timevec)
return timevec
logging.info('Datevec = %s' % datevec)
return datevec
......
......@@ -228,7 +228,7 @@ class ctsfFluxModel(ObservationOperator):
for t in range(len(timevec)):
foundindex = False
date = self.refdate + dt.timedelta(days=timevec[t])
date = self.refdate + dt.timedelta(int(days=timevec[t]))
for tt in range(len(t_ano)):
date_input = self.refdate + dt.timedelta(days=int(t_ano[tt]))
if (date.year == date_input.year) and (date.month == date_input.month):
......
......@@ -58,7 +58,7 @@ def analysis_pipeline(dacycle, platform, dasystem, samples, statevector):
""" Main entry point for analysis of ctdas results """
# copy da/analysis folder to exec folder and copy copied_region files
if dacycle['dir.da_source'] != dacycle['dir.exec']:
if dacycle['dir.da_source'] != dacycle['dir.da_run']:
import shutil
from da.tools.general import create_dirs
create_dirs(os.path.join(dacycle['dir.exec'],'da'))
......
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