Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -r3a508f30cc2ef04feb5de467cba65a6301bec643 -r81d5f2fc913a7793d45efe437c2bc9aec52e70fa --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 3a508f30cc2ef04feb5de467cba65a6301bec643) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 81d5f2fc913a7793d45efe437c2bc9aec52e70fa) @@ -59,6 +59,7 @@ self.runEndTime = datetimeend self.timeStepSecs = timestepsecs self.currentTimeStep = 0 + self.lastTimeStep = 0 self.startadjusted = 0 self.startendadjusted = 0 self.currentmode = mode @@ -77,6 +78,7 @@ self.currentYday = self.currentDateTime.timetuple().tm_yday self.currentHour = self.currentDateTime.hour self.nextDateTime = self.currentDateTime + datetime.timedelta(seconds=self.timeStepSecs) + self.lastTimeStep = self.runTimeSteps + self.currentTimeStep def __str__(self): a = self.__dict__ @@ -170,6 +172,7 @@ calendar.timegm(self.runStateTime.utctimetuple()))/self.timeStepSecs +1 self.nextDateTime = self.currentDateTime + datetime.timedelta(seconds=self.timeStepSecs) + self.lastTimeStep = self.runTimeSteps @@ -441,10 +444,21 @@ self._d_model = userModel self._testRequirements() + + + dte = datetimestart + datetime.timedelta(seconds=(lastTimeStep - firstTimestep) * timestepsecs) self.DT = runDateTimeInfo(timestepsecs=timestepsecs, datetimestart=datetimestart, datetimeend=dte, mode='steps') + + if lastTimeStep != 0: + if firstTimestep == 0: + firstTimestep = 1 + self.DT.update(runTimeSteps=(lastTimeStep - firstTimestep)) + self.DT.update(currentTimeStep=firstTimestep-1) + print self.DT + self.setviaAPI = {} # Flag for each variable. If 1 it is set by the API before this timestep. Reset is done at the end of each timestep @@ -453,6 +467,7 @@ msg = "Cannot run dynamic framework: Start timestep smaller than end timestep" raise frameworkBase.FrameworkError(msg) + # fttb self._addMethodToClass(self._readmapNew) self._addMethodToClass(self._reportNew) @@ -964,7 +979,7 @@ # Assume that we have set this via BMI if self.DT.callstopupdate > 1: - self.logger.info("Not reading time from ini file, assuming it is set by BMI (calls = " + str(self.DT.callstopupdate) + ")") + self.logger.info("Not reading time from ini file, assuming it is set by BMI or otherwise (calls = " + str(self.DT.callstopupdate) + ")") else: if st == "None": # try from the runinfo file rinfo_str = configget(self._userModel().config, 'run', 'runinfo', "None") @@ -1000,9 +1015,14 @@ self._userModel().currentdatetime = self.DT.currentDateTime ed = configget(self._userModel().config, 'run', 'endtime', "None") - self.DT.update(datetimeend=parser.parse(ed), mode=self.runlengthdetermination) - self.DT.update(timestepsecs=int(configget(self._userModel().config, 'run', 'timestepsecs', "86400")), mode=self.runlengthdetermination) - self.DT.update(currentTimeStep=self.DT.currentTimeStep, mode=self.runlengthdetermination) + if ed != 'None': + self.DT.update(datetimeend=parser.parse(ed), mode=self.runlengthdetermination) + self.DT.update(timestepsecs=int(configget(self._userModel().config, 'run', 'timestepsecs', "86400")), mode=self.runlengthdetermination) + self.DT.update(currentTimeStep=self.DT.currentTimeStep, mode=self.runlengthdetermination) + else: + self.logger.error("No end time given with start time: [run] endtime = " + ed ) + exit(1) + self._update_time_from_DT() @@ -2141,7 +2161,7 @@ self.DT.update(currentTimeStep=self.DT.currentTimeStep+1, mode=self.runlengthdetermination) self._userModel().currentdatetime = self.DT.currentDateTime - self.logger.debug("timestep: " + str(self.DT.currentTimeStep-1) + "/" + str(self.DT.runTimeSteps) + " (" + str(self.DT.currentDateTime) + ")") + self.logger.debug("timestep: " + str(self._userModel().currentTimeStep()) + "/" + str(self.DT.lastTimeStep) + " (" + str(self.DT.currentDateTime) + ")") self._timeStepFinished() @@ -2423,6 +2443,7 @@ if hasattr(self._userModel(), "_inDynamic"): if self._userModel()._inDynamic() or self._inUpdateWeight(): timestep = self._userModel().currentTimeStep() + #print timestep if 'None' not in self.ncfile: newName = name else: Index: wflow-py/wflow/wflow_wave.py =================================================================== diff -u -r66b81b5c1aa15650579e748852d60ec0d0e40b7a -r81d5f2fc913a7793d45efe437c2bc9aec52e70fa --- wflow-py/wflow/wflow_wave.py (.../wflow_wave.py) (revision 66b81b5c1aa15650579e748852d60ec0d0e40b7a) +++ wflow-py/wflow/wflow_wave.py (.../wflow_wave.py) (revision 81d5f2fc913a7793d45efe437c2bc9aec52e70fa) @@ -464,8 +464,6 @@ if (len(opts) <=1): usage() - - if _lastTimeStep < _firstTimeStep: print "The starttimestep (" + str(_firstTimeStep) +") is smaller than the last timestep (" + str(_lastTimeStep) + ")" usage()