Index: wflow-py/UnitTests/TestBMI.py =================================================================== diff -u -r3eca9deff0382a0e723ee4a2540f5333c45113cd -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/UnitTests/TestBMI.py (.../TestBMI.py) (revision 3eca9deff0382a0e723ee4a2540f5333c45113cd) +++ wflow-py/UnitTests/TestBMI.py (.../TestBMI.py) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -148,13 +148,13 @@ st = bmiobj.get_start_time() ts = 86400 # Do one timestep and check - print bmiobj.get_current_time() - bmiobj.update_until(st + ts) - print bmiobj.get_current_time() - self.assertEquals(st + ts,bmiobj.get_current_time()) + bmiobj.get_current_time() + bmiobj.update_until(et) bmiobj.finalize() + self.assertEquals(et,bmiobj.get_current_time()) + def testbmirun_l(self): print 'Run with update(-1)' bmiobj = bmi.wflowbmi_light() Index: wflow-py/UnitTests/wflow_sceleton/outstate/TSoil.map =================================================================== diff -u -reca832469efaa693334860f402655660742cc76f -r3844888de0b2f066d4831fd900634056413c9acd Binary files differ Index: wflow-py/UnitTests/wflow_sceleton/wflow_sceleton.ini =================================================================== diff -u -r8528750f1b6542197b6924ee02c6a50ccb05b7d5 -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/UnitTests/wflow_sceleton/wflow_sceleton.ini (.../wflow_sceleton.ini) (revision 8528750f1b6542197b6924ee02c6a50ccb05b7d5) +++ wflow-py/UnitTests/wflow_sceleton/wflow_sceleton.ini (.../wflow_sceleton.ini) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -16,12 +16,13 @@ [run] # either a runinfo file or a start and end-time are required #runinfo=runinfo.xml -starttime= 1995-01-31 00:00:00 -endtime= 1995-02-11 00:00:00 +starttime= 1995-02-01 00:00:00 +endtime= 1995-02-03 00:00:00 # required, base timestep of the model timestepsecs = 86400 #start model with cold state reinit=1 +#runlengthdetermination=intervals [modelparameters] Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -r1f872a3d10a5301f8f4f97fc1a43ebc3861ed316 -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 1f872a3d10a5301f8f4f97fc1a43ebc3861ed316) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -52,7 +52,6 @@ self.runEndTime = datetimeend self.timeStepSecs = timestepsecs self.currentTimeStep = 1 - self.currentDateTime = self.runStartTime self.startadjusted = 0 self.startendadjusted = 0 self.currentmode = mode @@ -96,13 +95,13 @@ if datetimestart: self.runStartTime = datetimestart self.currentTimeStep = 1 - self.currentDateTime = self.runStartTime + if self.currentmode =='steps': self.runStateTime = self.runStartTime - datetime.timedelta(seconds=self.timeStepSecs) else: self.runStateTime = self.runStartTime - self.currentDateTime = self.runStateTime + self.currentDateTime = self.runStateTime self.outPutStartTime = self.runStateTime + datetime.timedelta(seconds=self.timeStepSecs) self.runTimeSteps = (calendar.timegm(self.runEndTime.utctimetuple()) - calendar.timegm(self.runStateTime.utctimetuple()))/self.timeStepSecs self.currentMonth = self.currentDateTime.month @@ -132,6 +131,7 @@ if currentTimeStep: self.currentTimeStep = currentTimeStep self.currentDateTime = self.runStateTime + datetime.timedelta(seconds=self.timeStepSecs * (self.currentTimeStep -1)) + self.currentMonth = self.currentDateTime.month self.currentYday = self.currentDateTime.timetuple().tm_yday self.currentHour = self.currentDateTime.hour @@ -270,7 +270,7 @@ self.writer = [] self.ofile = [] - def writestep(self, variable, fname, timestep=None): + def writestep(self, variable, fname, timestep=None,dtobj=None): """ write a single timestep @@ -304,9 +304,10 @@ self.flatres = self.remap_np.flatten()[self.idx] thiswriter = self.fnamelist.index(fname) - if timestep >= 0: + if dtobj: + self.writer[thiswriter].writerow([str(dtobj)] + self.flatres.tolist()) + elif timestep: self.writer[thiswriter].writerow([timestep] + self.flatres.tolist()) - # self.flatres = numpy.insert(self.flatres,0,timestep) else: self.writer[thiswriter].writerow([self.steps] + self.flatres.tolist()) # self.flatres = numpy.insert(self.flatres,0,self.steps) @@ -1040,8 +1041,10 @@ except: self.logger.warn("Cannot find: " + self.varnamecsv[a] + " variable not in model.") + #self.oscv[self.samplenamecsv[a]].writestep(tmpvar, a, timestep=self.DT.currentTimeStep,dtobj=self.DT.currentDateTime) self.oscv[self.samplenamecsv[a]].writestep(tmpvar, a, timestep=self.DT.currentTimeStep) + def wf_savesummarymaps(self): """ Saves the maps defined in the summary section to disk @@ -1846,7 +1849,7 @@ self._userModel()._setNrTimeSteps(laststep) while step <= self._userModel().nrTimeSteps(): - + self.logger.debug("timestep: " + str(self.DT.currentTimeStep) + "/" + str(self.DT.runTimeSteps) + " (" + str(self.DT.currentDateTime) + ")") self._incrementIndentLevel() self._atStartOfTimeStep(step) # TODO: Check why the timestep setting doesn not work..... @@ -1868,9 +1871,11 @@ #self.currentdatetime = self.currentdatetime + dt.timedelta(seconds=self._userModel().timestepsecs) - self.DT.update(currentTimeStep=self.DT.currentTimeStep + 1) + + self.DT.update(currentTimeStep=self.DT.currentTimeStep + 1, mode=self.runlengthdetermination) self._userModel().currentdatetime = self.DT.currentDateTime + self._timeStepFinished() self._decrementIndentLevel() step += 1 Index: wflow-py/wflow/wflow_bmi.py =================================================================== diff -u -r1f872a3d10a5301f8f4f97fc1a43ebc3861ed316 -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/wflow/wflow_bmi.py (.../wflow_bmi.py) (revision 1f872a3d10a5301f8f4f97fc1a43ebc3861ed316) +++ wflow-py/wflow/wflow_bmi.py (.../wflow_bmi.py) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -482,7 +482,7 @@ dateobj = datetime.datetime.utcfromtimestamp(start_time) datestrimestr = dateobj.strftime("%Y-%m-%d %H:%M:%S") - self.dynModel.DT.update(datetimestart=dateobj, mode='intervals') + self.dynModel.DT.update(datetimestart=dateobj, mode=self.dynModel.runlengthdetermination) self.dynModel._update_time_from_DT() @@ -497,7 +497,7 @@ dateobj = datetime.datetime.utcfromtimestamp(end_time) datestrimestr = dateobj.strftime("%Y-%m-%d %H:%M:%S") - self.dynModel.DT.update(datetimeend=dateobj) + self.dynModel.DT.update(datetimeend=dateobj,mode=self.dynModel.runlengthdetermination) self.dynModel._update_time_from_DT() Index: wflow-py/wflow/wflow_hbv.py =================================================================== diff -u -r5b0e933ec18fb26f7f9e84236512d97fa3cc2777 -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/wflow/wflow_hbv.py (.../wflow_hbv.py) (revision 5b0e933ec18fb26f7f9e84236512d97fa3cc2777) +++ wflow-py/wflow/wflow_hbv.py (.../wflow_hbv.py) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -665,9 +665,6 @@ :var self.ToCubic: Mutiplier to convert mm to m^3/s for fluxes """ - self.logger.debug("Step: " + str(int(self.currentStep)) + "/" + str(int(self._d_nrTimeSteps))) - self.thestep = self.thestep + 1 - self.wf_updateparameters() # read forcing an dynamic parameters self.Precipitation = max(0.0,self.Precipitation) Index: wflow-py/wflow/wflow_sbm.py =================================================================== diff -u -r5b0e933ec18fb26f7f9e84236512d97fa3cc2777 -r3844888de0b2f066d4831fd900634056413c9acd --- wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision 5b0e933ec18fb26f7f9e84236512d97fa3cc2777) +++ wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision 3844888de0b2f066d4831fd900634056413c9acd) @@ -914,11 +914,6 @@ :var self.DLC: length of the river within a cell [m] :var self.ToCubic: Mutiplier to convert mm to m^3/s for fluxes """ - - self.logger.debug( - "Step: " + str(int(self.currentStep)) + "/" + str(int(self._d_nrTimeSteps))) - self.thestep = self.thestep + 1 - # Read forcing data and dynamic parameters self.wf_updateparameters()