Index: wflow-py/wflow/wf_netcdfio.py =================================================================== diff -u -rc2990647234af0a02ee609e071234b9438d448c7 -rfb4c96a491f37f94570d811301e74bd91819d8a3 --- wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision c2990647234af0a02ee609e071234b9438d448c7) +++ wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision fb4c96a491f37f94570d811301e74bd91819d8a3) @@ -557,11 +557,17 @@ ncindex = ncindex + self.offset + if self.datetimelist.size < ncindex + 1: + ncindex = self.datetimelist.size -1 + if tsdatetime != None: if tsdatetime.replace(tzinfo=None) != self.datetimelist[ncindex].replace(tzinfo=None): logging.warn("Date/time does not match. Wanted " + str(tsdatetime) + " got " + str(self.datetimelist[ncindex])) import bisect pos = bisect.bisect_left(self.datetimelist,tsdatetime.replace(tzinfo=None)) + if pos >= self.datetimelist.size: + pos = self.datetimelist.size -1 + logging.warn("No matching date/time found using last date/time again...") self.offset = pos - ncindex logging.warn("Adjusting to the date/time at index and setting offset: " + str(pos) + ":" + str(self.offset) + ":" + str(self.datetimelist[pos])) ncindex = pos Index: wflow-py/wflow/wflow_hbv.py =================================================================== diff -u -r514bf8a0eefb7abf9f3ca5adaf10369a0dcb6e85 -rfb4c96a491f37f94570d811301e74bd91819d8a3 --- wflow-py/wflow/wflow_hbv.py (.../wflow_hbv.py) (revision 514bf8a0eefb7abf9f3ca5adaf10369a0dcb6e85) +++ wflow-py/wflow/wflow_hbv.py (.../wflow_hbv.py) (revision fb4c96a491f37f94570d811301e74bd91819d8a3) @@ -28,53 +28,55 @@ [-c configfile][-T timesteps][-s seconds][-W][-E][-N][-U discharge] [-P parameter multiplication][-X][-l loglevel] --F: if set wflow is expected to be run by FEWS. It will determine - the timesteps from the runinfo.xml file and save the output initial - conditions to an alternate location. Also set fewsrun=1 in the .ini file! + -F: if set wflow is expected to be run by FEWS. It will determine + the timesteps from the runinfo.xml file and save the output initial + conditions to an alternate location. Also set fewsrun=1 in the .ini file! --f: Force overwrite of existing results + -f: Force overwrite of existing results --T: Set the number of timesteps to run + -T: Set end time of the run: yyyy-mm-dd hh:mm:ss --N: No lateral flow, use runoff response function to generate fast runoff + -S: Set start time of the run: yyyy-mm-dd hh:mm:ss --s: Set the model timesteps in seconds + -N: No lateral flow, use runoff response function to generate fast runoff --I: re-initialize the initial model conditions with default + -s: Set the model timesteps in seconds --i: Set input table directory (default is intbl) + -I: re-initialize the initial model conditions with default --x: run for subcatchment only (e.g. -x 1) + -i: Set input table directory (default is intbl) --C: set the name of the case (directory) to run + -x: run for subcatchment only (e.g. -x 1) --R: set the name runId within the current case + -C: set the name of the case (directory) to run --L: set the logfile + -R: set the name runId within the current case --c: name of wflow the configuration file (default: Casename/wflow_hbv.ini). + -L: set the logfile --h: print usage information + -c: name of wflow the configuration file (default: Casename/wflow_hbv.ini). --U: The argument to this option should be a .tss file with measured discharge in - [m^3/s] which the program will use to update the internal state to match - the measured flow. The number of columns in this file should match the - number of gauges in the wflow\_gauges.map file. + -h: print usage information --u: list of gauges/columns to use in update. Format: - -u [1 , 4 ,13] - The above example uses column 1, 4 and 13 + -U: The argument to this option should be a .tss file with measured discharge in + [m^3/s] which the program will use to update the internal state to match + the measured flow. The number of columns in this file should match the + number of gauges in the wflow\_gauges.map file. --P: set parameter change string (e.g: -P "self.FC = self.FC * 1.6") for non-dynamic variables + -u: list of gauges/columns to use in update. Format: + -u [1 , 4 ,13] + The above example uses column 1, 4 and 13 --p: set parameter change string (e.g: -P "self.Precipitation = self.Precipitation * 1.11") for - dynamic variables + -P: set parameter change string (e.g: -P "self.FC = self.FC * 1.6") for non-dynamic variables --l: loglevel (most be one of DEBUG, WARNING, ERROR) + -p: set parameter change string (e.g: -P "self.Precipitation = self.Precipitation * 1.11") for + dynamic variables --X overwrites the initial values at the end of each timestep + -l: loglevel (most be one of DEBUG, WARNING, ERROR) + -X overwrites the initial values at the end of each timestep + """ import numpy @@ -1009,8 +1011,6 @@ if o == '-l': exec "loglevel = logging." + a if o == '-c': configfile = a if o == '-s': timestepsecs = int(a) - if o == '-T': _lastTimeStep=int(a) - if o == '-S': _firstTimeStep=int(a) if o == '-h': usage() if o == '-f': NoOverWrite = 0 @@ -1060,6 +1060,10 @@ if o == '-u': exec "zz =" + a updateCols = zz + if o == '-T': + configset(myModel.config, 'run', 'endtime', a, overwrite=True) + if o == '-S': + configset(myModel.config, 'run', 'starttime', a, overwrite=True) dynModelFw.setupFramework() dynModelFw.logger.info("Command line: " + str(argv)) Index: wflow-py/wflow/wflow_routing.py =================================================================== diff -u -r66b81b5c1aa15650579e748852d60ec0d0e40b7a -rfb4c96a491f37f94570d811301e74bd91819d8a3 --- wflow-py/wflow/wflow_routing.py (.../wflow_routing.py) (revision 66b81b5c1aa15650579e748852d60ec0d0e40b7a) +++ wflow-py/wflow/wflow_routing.py (.../wflow_routing.py) (revision fb4c96a491f37f94570d811301e74bd91819d8a3) @@ -31,10 +31,10 @@ -X: save state at the end of the run over the initial conditions at the start - -T: Set last timestep + -T: Set end time of the run: yyyy-mm-dd hh:mm:ss + + -S: Set start time of the run: yyyy-mm-dd hh:mm:ss - -S: Set the start timestep (default = 1) - -s: Set the model timesteps in seconds -I: re-initialize the initial model conditions with default @@ -736,8 +736,6 @@ if o == '-c': configfile = a if o == '-L': LogFileName = a if o == '-s': timestepsecs = int(a) - if o == '-T': _lastTimeStep = int(a) - if o == '-S': _firstTimeStep = int(a) if o == '-h': usage() if o == '-f': _NoOverWrite = 0 if o == '-l': exec "loglevel = logging." + a @@ -778,6 +776,10 @@ left = a.split('=')[0] right = a.split('=')[1] configset(myModel.config,'variable_change_timestep',left,right,overwrite=True) + if o == '-T': + configset(myModel.config, 'run', 'endtime', a, overwrite=True) + if o == '-S': + configset(myModel.config, 'run', 'starttime', a, overwrite=True) dynModelFw.setupFramework() dynModelFw._runInitial() Index: wflow-py/wflow/wflow_sbm.py =================================================================== diff -u -r66b81b5c1aa15650579e748852d60ec0d0e40b7a -rfb4c96a491f37f94570d811301e74bd91819d8a3 --- wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision 66b81b5c1aa15650579e748852d60ec0d0e40b7a) +++ wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision fb4c96a491f37f94570d811301e74bd91819d8a3) @@ -35,9 +35,9 @@ -f: Force overwrite of existing results - -T: Set last timestep + -T: Set end time of the run: yyyy-mm-dd hh:mm:ss - -S: Set the start timestep (default = 1) + -S: Set start time of the run: yyyy-mm-dd hh:mm:ss -s: Set the model timesteps in seconds @@ -84,8 +84,6 @@ """ -#TODO: add Et reduction in unsat zone based on deficit - import numpy #import pcrut import os @@ -1883,8 +1881,6 @@ if o == '-c': configfile = a if o == '-L': LogFileName = a if o == '-s': timestepsecs = int(a) - if o == '-T': _lastTimeStep = int(a) - if o == '-S': _firstTimeStep = int(a) if o == '-h': usage() if o == '-f': _NoOverWrite = 0 if o == '-l': exec "loglevel = logging." + a @@ -1928,7 +1924,12 @@ if o == '-E': configset(myModel.config, 'model', 'reInfilt', '1', overwrite=True) if o == '-R': runId = a if o == '-W': configset(myModel.config, 'model', 'waterdem', '1', overwrite=True) + if o == '-T': + configset(myModel.config, 'run', 'endtime', a, overwrite=True) + if o == '-S': + configset(myModel.config, 'run', 'starttime', a, overwrite=True) + dynModelFw.setupFramework() dynModelFw._runInitial() dynModelFw._runResume() Index: wflow-py/wflow/wflow_w3ra.py =================================================================== diff -u -r66b81b5c1aa15650579e748852d60ec0d0e40b7a -rfb4c96a491f37f94570d811301e74bd91819d8a3 --- wflow-py/wflow/wflow_w3ra.py (.../wflow_w3ra.py) (revision 66b81b5c1aa15650579e748852d60ec0d0e40b7a) +++ wflow-py/wflow/wflow_w3ra.py (.../wflow_w3ra.py) (revision fb4c96a491f37f94570d811301e74bd91819d8a3) @@ -26,6 +26,10 @@ -R: set the name runId within the current case -c name of the config file (in the case directory) + + -T: Set end time of the run: yyyy-mm-dd hh:mm:ss + + -S: Set start time of the run: yyyy-mm-dd hh:mm:ss $Author: schelle $ $Id: wflow_sceleton.py 898 2014-01-09 14:47:06Z schelle $ @@ -742,8 +746,7 @@ if o == '-R': runId = a if o == '-c': configfile = a if o == '-s': timestepsecs = int(a) - if o == '-T': _lastTimeStep=int(a) - if o == '-S': _firstTimeStep=int(a) + if (len(opts) <=1): usage() @@ -773,6 +776,10 @@ if o == '-I': configset(myModel.config, 'model', 'reinit', '1', overwrite=True) if o == '-i': configset(myModel.config, 'model', 'intbl', a, overwrite=True) if o == '-s': configset(myModel.config, 'model', 'timestepsecs', a, overwrite=True) + if o == '-T': + configset(myModel.config, 'run', 'endtime', a, overwrite=True) + if o == '-S': + configset(myModel.config, 'run', 'starttime', a, overwrite=True) dynModelFw.setupFramework()