Index: wflow-py/wflow/wflow_routing.py =================================================================== diff -u -r210a8f89dcdbdf34d06ab44039da2bac7119fe41 -r241799f88889c8c189027b512b229bbd4430aa34 --- wflow-py/wflow/wflow_routing.py (.../wflow_routing.py) (revision 210a8f89dcdbdf34d06ab44039da2bac7119fe41) +++ wflow-py/wflow/wflow_routing.py (.../wflow_routing.py) (revision 241799f88889c8c189027b512b229bbd4430aa34) @@ -267,7 +267,10 @@ if self.fewsrun: self.logger.info("Saving initial conditions for FEWS...") self.wf_suspend(self.Dir + "/outstate/") + + + def initial(self): """ Initial part of the model, executed only once. Reads all static data from disk @@ -326,12 +329,14 @@ wflow_riverwidth = configget(self.config, "model", "wflow_riverwidth", "staticmaps/wflow_riverwidth.map") wflow_floodplainwidth = configget(self.config, "model", "wflow_floodplainwidth", "staticmaps/wflow_floodplainwidth.map") wflow_bankfulldepth = configget(self.config, "model", "wflow_bankfulldepth", "staticmaps/wflow_bankfulldepth.map") - wflow_floodplaindist = configget(self.config, "model", "wflow_floodplaindist", "staticmaps/wflow_floodplaindist.map") + wflow_floodplaindist = configget(self.config, "model", "wflow_bankfulldepth", "staticmaps/wflow_floodplaindist.map") wflow_landuse = configget(self.config, "model", "wflow_landuse", "staticmaps/wflow_landuse.map") wflow_soil = configget(self.config, "model", "wflow_soil", "staticmaps/wflow_soil.map") # 2: Input base maps ######################################################## + self.instate = configget(self.config,"model","instate","instate") + subcatch = ordinal(self.wf_readmap(os.path.join(self.Dir,wflow_subcatch),0.0,fail=True)) # Determines the area of calculations (all cells > 0) subcatch = ifthen(subcatch > 0, subcatch) @@ -546,7 +551,7 @@ self.ReservoirVolume = self.ResMaxVolume * self.ResTargetFullFrac else: self.logger.info("Setting initial conditions from state files") - self.wf_resume(os.path.join(self.Dir,"instate")) + self.wf_resume(os.path.join(self.Dir, self.instate)) self.Pch = self.wetPerimiterCH(self.WaterLevelCH,self.Bw) self.Pfp = ifthenelse(self.River,self.wetPerimiterFP(self.WaterLevelFP,self.floodPlainWidth,sharpness=self.floodPlainDist),0.0) @@ -587,7 +592,6 @@ :var self.WaterLevel: Total aater level in the kinematic wave [m] (above the bottom) :var self.Pfp: Actual wetted perimiter of the floodplain [m] :var self.Pch: Actual wetted perimiter of the channel [m] - :var self.SurfaceWaterSupply: the negative Inflow (water demand) that could be met from the surfacewater [m^3/s] *Static variables* @@ -616,8 +620,7 @@ self.Inflow = cover(self.OutflowDwn,self.Inflow) - self.SurfaceWaterSupply = ifthenelse (self.Inflow < 0.0 , max(-1.0 * self.Inwater,self.SurfaceRunoff), self.ZeroMap) - self.Inwater = ifthenelse(self.SurfaceRunoff + self.Inwater < 0.0, -1.0 * self.SurfaceRunoff, self.Inwater) + self.Inwater = self.Inwater + self.Inflow # Add abstractions/inflows in m^3/sec ########################################################################## @@ -631,8 +634,7 @@ self.SurfaceRunoffMM = self.SurfaceRunoff * self.QMMConv # SurfaceRunoffMM (mm) from SurfaceRunoff (m3/s) self.updateRunOff() self.InflowKinWaveCell = upstream(self.TopoLdd, self.SurfaceRunoff) - self.MassBalKinWave = (-self.KinWaveVolume + self.OldKinWaveVolume) / self.timestepsecs + self.InflowKinWaveCell\ - + self.Inwater - self.SurfaceRunoff + self.MassBalKinWave = (-self.KinWaveVolume + self.OldKinWaveVolume) / self.timestepsecs + self.InflowKinWaveCell + self.Inwater - self.SurfaceRunoff Runoff = self.SurfaceRunoff @@ -664,7 +666,13 @@ self.updateRunOff() Runoff = self.SurfaceRunoff + ########################################################################## + # water balance ########################################### + ########################################################################## + # Single cell based water budget. snow not included yet. + + def main(argv=None): """ Perform command line execution of the model. @@ -693,7 +701,7 @@ ## Process command-line options # ######################################################################## try: - opts, args = getopt.getopt(argv, 'F:L:hC:Ii:v:S:T:WR:u:s:EP:p:Xx:U:fOc:l:') + opts, args = getopt.getopt(argv, 'F:L:hC:Ii:v:S:T:WR:u:s:EP:p:Xx:U:fOc:l:g:') except getopt.error, msg: pcrut.usage(msg) @@ -712,6 +720,7 @@ if o == '-f': _NoOverWrite = 0 if o == '-l': exec "loglevel = logging." + a + if fewsrun: ts = getTimeStepsfromRuninfo(runinfoFile, timestepsecs) starttime = getStartTimefromRuninfo(runinfoFile) @@ -740,6 +749,8 @@ if o == '-s': configset(myModel.config, 'model', 'timestepsecs', a, overwrite=True) if o == '-x': configset(myModel.config, 'model', 'sCatch', a, overwrite=True) if o == '-c': configset(myModel.config, 'model', 'configfile', a, overwrite=True) + if o == '-g': configset(myModel.config,'model','instate',a,overwrite=True) + if o == '-U': configset(myModel.config, 'model', 'updateFile', a, overwrite=True) configset(myModel.config, 'model', 'updating', "1", overwrite=True)