Index: wflow-py/Scripts/bmi2runner.py =================================================================== diff -u -rcc6e434a865d8b0b2f0c41d90b058e7bf114c1b5 -r12ea40dc08628f654753679e0972e87b7bb12f7a --- wflow-py/Scripts/bmi2runner.py (.../bmi2runner.py) (revision cc6e434a865d8b0b2f0c41d90b058e7bf114c1b5) +++ wflow-py/Scripts/bmi2runner.py (.../bmi2runner.py) (revision 12ea40dc08628f654753679e0972e87b7bb12f7a) @@ -28,66 +28,65 @@ import time - """ Perform command line execution of the model. """ configfile = "bmi2runner.ini" -loglevel = 'INFO' -combilogger = pcrut.setlogger('bmi2runner.log','bmi2runner_logging',thelevel=loglevel) +loglevel = "INFO" +combilogger = pcrut.setlogger("bmi2runner.log", "bmi2runner_logging", thelevel=loglevel) # Construct object and initilize the models -combilogger.info('Starting combined bmi object') +combilogger.info("Starting combined bmi object") bmiobj = wfbmi.wflowbmi_csdms() -#this line is needed when running from batch script -#os.sys.path.append(os.getcwd() +'\\rtc\\rtc_brantas\\bin\\') +# this line is needed when running from batch script +# os.sys.path.append(os.getcwd() +'\\rtc\\rtc_brantas\\bin\\') -bmiobj.initialize_config(configfile,loglevel=loglevel) +bmiobj.initialize_config(configfile, loglevel=loglevel) bmiobj.initialize_model() -#Get and set start and end times +# Get and set start and end times start = bmiobj.get_start_time() end = bmiobj.get_end_time() bmiobj.set_start_time(start) bmiobj.set_end_time(end) -#Update models (if necessary) to start time +# Update models (if necessary) to start time bmiobj.update_to_start_time(start) -#Number of steps to run models +# Number of steps to run models ts = bmiobj.get_time_step() -steps = int((end - start)/ts + 1) +steps = int((end - start) / ts + 1) -print 'start = ', start#time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(start)) -print 'start time rtc =', time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels['RTC-Tools'].get_start_time())) -print 'start time wflow =', time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels['wflow_sbm'].get_start_time())) -print 'start time lintul =', time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels['wflow_lintul'].get_start_time())) +print "start = ", start # time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(start)) +print "start time rtc =", time.strftime( + "%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels["RTC-Tools"].get_start_time()) +) +print "start time wflow =", time.strftime( + "%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels["wflow_sbm"].get_start_time()) +) +print "start time lintul =", time.strftime( + "%Y-%m-%d %H:%M:%S", time.gmtime(bmiobj.bmimodels["wflow_lintul"].get_start_time()) +) cts = bmiobj.currenttimestep -# Loop over the time duration +# Loop over the time duration while cts < steps: bmiobj.update() cts = bmiobj.currenttimestep -#else: +# else: # bmiobj.bmimodels['RTC-Tools'].update() # bmiobj.bmimodels['wflow_sbm'].update() # bmiobj.bmimodels['wflow_lintul'].update() # cts = bmiobj.currenttimestep - -bmiobj.bmimodels['RTC-Tools'].finalize() -bmiobj.bmimodels['wflow_sbm'].finalize() -bmiobj.bmimodels['wflow_lintul'].finalize() -combilogger.info('Finishing run') - - - - - +bmiobj.bmimodels["RTC-Tools"].finalize() +bmiobj.bmimodels["wflow_sbm"].finalize() +bmiobj.bmimodels["wflow_lintul"].finalize() +combilogger.info("Finishing run")