Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -r5cacddfd21cdead17aba383f99a8987e480f141c -r8b703906feb45c1eff40558e71f3e758b5b7b388 --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 5cacddfd21cdead17aba383f99a8987e480f141c) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 8b703906feb45c1eff40558e71f3e758b5b7b388) @@ -62,6 +62,7 @@ self.startadjusted = 0 self.startendadjusted = 0 self.currentmode = mode + self.callstopupdate = 0 if mode =='steps': @@ -96,6 +97,7 @@ :return: """ self.currentmode = mode + self.callstopupdate = self.callstopupdate + 1 if timestepsecs and not runTimeSteps: self.timeStepSecs = timestepsecs @@ -946,46 +948,50 @@ self.skipfirsttimestep = int(configget(self._userModel().config, 'run', 'skipfirst', "0")) - if st == "None": # try from the runinfo file - rinfo_str = configget(self._userModel().config, 'run', 'runinfo', "None") - rinfo = os.path.join(self._userModel().Dir, rinfo_str) - self.DT.update(timestepsecs= int(configget(self._userModel().config, 'run', 'timestepsecs', "86400")), - mode=self.runlengthdetermination, runTimeSteps=self.DT.runTimeSteps) - self._update_time_from_DT() - if rinfo_str != "None": - self.DT.update(datetimestart=wflow_adapt.getStartTimefromRuninfo(rinfo), mode=self.runlengthdetermination) - self.DT.update(datetimeend=wflow_adapt.getEndTimefromRuninfo(rinfo), mode=self.runlengthdetermination) + # 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) + ")") + else: + if st == "None": # try from the runinfo file + rinfo_str = configget(self._userModel().config, 'run', 'runinfo', "None") + rinfo = os.path.join(self._userModel().Dir, rinfo_str) + self.DT.update(timestepsecs= int(configget(self._userModel().config, 'run', 'timestepsecs', "86400")), + mode=self.runlengthdetermination, runTimeSteps=self.DT.runTimeSteps) self._update_time_from_DT() - # add one step to start time if it is the same s the state time + if rinfo_str != "None": + self.DT.update(datetimestart=wflow_adapt.getStartTimefromRuninfo(rinfo), mode=self.runlengthdetermination) + self.DT.update(datetimeend=wflow_adapt.getEndTimefromRuninfo(rinfo), mode=self.runlengthdetermination) + self._update_time_from_DT() + # add one step to start time if it is the same s the state time + #if self.skipfirsttimestep: + # self.logger.debug("Skipping first timestep...") + # self.DT.skiptime() + + self._userModel().currentdatetime = self.DT.currentDateTime + + 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) + self._update_time_from_DT() + else: + self.DT.update(datetimestart=parser.parse('1990-01-01 00:00:00 GMT'), mode=self.runlengthdetermination) + self.logger.info( + "Not enough information in the [run] section. Need start and end time or a runinfo.xml file.... Reverting to default date/time") + else: + self.DT.update(datetimestart=parser.parse(st), mode=self.runlengthdetermination) + self.DT.update(currentTimeStep=self.DT.currentTimeStep, mode=self.runlengthdetermination) #if self.skipfirsttimestep: # self.logger.debug("Skipping first timestep...") # self.DT.skiptime() - self._userModel().currentdatetime = self.DT.currentDateTime + 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) self._update_time_from_DT() - else: - self.DT.update(datetimestart=parser.parse('1990-01-01 00:00:00 GMT'), mode=self.runlengthdetermination) - self.logger.info( - "Not enough information in the [run] section. Need start and end time or a runinfo.xml file.... Reverting to default date/time") - else: - self.DT.update(datetimestart=parser.parse(st), mode=self.runlengthdetermination) - self.DT.update(currentTimeStep=self.DT.currentTimeStep, mode=self.runlengthdetermination) - #if self.skipfirsttimestep: - # self.logger.debug("Skipping first timestep...") - # self.DT.skiptime() - 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) - self._update_time_from_DT() - - def setupFramework(self): """ Second step, after setting the log file and reading the ini file get data from config, setup @@ -1100,7 +1106,7 @@ - # Add the on-lien statistics + # Add the on-line statistics self.onlinestat = wf_online_stats() rollingvars = configsection(self._userModel().config, "rollingmean")