Index: wflow-py/UnitTests/Testwflow_sbm.py =================================================================== diff -u -rf22ca2514228757f98671c126bd459b02612277b -r89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b --- wflow-py/UnitTests/Testwflow_sbm.py (.../Testwflow_sbm.py) (revision f22ca2514228757f98671c126bd459b02612277b) +++ wflow-py/UnitTests/Testwflow_sbm.py (.../Testwflow_sbm.py) (revision 89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b) @@ -25,7 +25,7 @@ dynModelFw = wf.wf_DynamicFramework(myModel, stopTime,startTime) # Load model config from files and check directory structure - dynModelFw.createRunId(NoOverWrite=False,level=wf.logging.ERROR) + dynModelFw.createRunId(NoOverWrite=False,level=wf.logging.INFO) # Run the initial part of the model (reads parameters and sets initial values) dynModelFw._runInitial() # Runs initial part @@ -35,12 +35,12 @@ if ts <10: dynModelFw.wf_setValues('P', 0.0) elif ts <= 15: - dynModelFw.wf_setValues('P', 10.0) + dynModelFw.wf_setValues('P', 5.0) sump = sump + 10.0 else: dynModelFw.wf_setValues('P', 0.0) - dynModelFw.wf_setValues('PET', 2.0) + dynModelFw.wf_setValues('PET', 3.0) dynModelFw.wf_setValues('TEMP', 10.0) dynModelFw._runDynamic(ts,ts) # runs for all timesteps dynModelFw.logger.info("Doing step: " + str(ts)) Index: wflow-py/UnitTests/wflow_sbm/wflow_sbm.ini =================================================================== diff -u -r8644fe3133901a94b34b418c3368715304cfe865 -r89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b --- wflow-py/UnitTests/wflow_sbm/wflow_sbm.ini (.../wflow_sbm.ini) (revision 8644fe3133901a94b34b418c3368715304cfe865) +++ wflow-py/UnitTests/wflow_sbm/wflow_sbm.ini (.../wflow_sbm.ini) (revision 89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b) @@ -89,7 +89,7 @@ [outputmaps] -#self.Inflow=iflow +self.InterceptionWatBal=iwb #self.WaterDem=wat #self.SubCellFrac=scf @@ -122,27 +122,20 @@ self.Precipitation=avgprecip.map # gauge output + [outputcsv_0] samplemap=staticmaps/wflow_subcatch.map self.SoilWatbal=wbsoil.csv self.SurfaceWatbal=wbsurf.csv self.Precipitation=P.csv +self.InterceptionWatbal=zzzwbint.csv function=average + [outputcsv_1] samplemap=staticmaps/wflow_subcatch.map self.SoilWatbal=1wbsoil.csv self.SurfaceWatbal=1wbsurf.csv self.Precipitation=1P.csv function=total -[outputtss_0] -samplemap=staticmaps/wflow_subcatch.map -self.SoilWatbal=wbsoil.tss -self.SurfaceWatbal=wbsurf.tss -self.watbal=wb.tss -self.Precipitation=P.tss - -[outputtss_1] -samplemap=staticmaps/wflow_gauges.map -self.SurfaceRunoff=run.tss Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -rb792e0bc51c202acca25ff6186fb52816664a7df -r89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision b792e0bc51c202acca25ff6186fb52816664a7df) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b) @@ -256,7 +256,7 @@ self.steps = 0 self.area = area - self.areanp = pcr2numpy(area, 0) + self.areanp = pcr2numpy(area, 0).copy() self.oformat = oformat self.areafunction = areafunction """ average, total, minimum, maximum, majority""" @@ -290,7 +290,7 @@ """ # Add new file if not already present if fname not in self.fnamelist: - bufsize = 10 # Implies line buffered + bufsize = 1 # Implies line buffered self.fnamelist.append(fname) self.ofile.append(open(fname, 'wb', bufsize)) @@ -1009,9 +1009,9 @@ if "None" not in samplemapname: try: self.samplemap = self.wf_readmap(samplemapname,0.0,fail=True) - idd = tsformat + ":" + samplemapname + idd = tsformat + ":" + samplemapname + ":" + areafunction self.oscv[idd] = wf_OutputTimeSeriesArea(self.samplemap, oformat=tsformat,areafunction=areafunction) - self.logger.info("Adding " + tsformat + " output at " + samplemapname) + self.logger.info("Adding " + tsformat + " output at " + samplemapname + " function: " + areafunction) except: self.logger.warn("Could not read sample id-map for timeseries: " + samplemapname) @@ -1066,14 +1066,19 @@ """ Print .ini defined output csv/tss timeseries per timestep """ + for a in self.samplenamecsv: + found = 1 try: exec "tmpvar = " + self.varnamecsv[a] except: + found = 0 self.logger.warn("Cannot find: " + self.varnamecsv[a] + " variable not in model.") #self.oscv[self.samplenamecsv[a]].writestep(tmpvar, a, timestep=self.DT.currentTimeStep,dtobj=self.DT.currentDateTime) - self.oscv[self.samplenamecsv[a]].writestep(tmpvar, a, timestep=self.DT.currentTimeStep) + if found: + self.logger.info(self.varnamecsv[a]) + self.oscv[self.samplenamecsv[a]].writestep(tmpvar, a, timestep=self.DT.currentTimeStep) def wf_savesummarymaps(self): Index: wflow-py/wflow/wflow_funcs.py =================================================================== diff -u -rb792e0bc51c202acca25ff6186fb52816664a7df -r89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b --- wflow-py/wflow/wflow_funcs.py (.../wflow_funcs.py) (revision b792e0bc51c202acca25ff6186fb52816664a7df) +++ wflow-py/wflow/wflow_funcs.py (.../wflow_funcs.py) (revision 89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b) @@ -84,7 +84,7 @@ Interception=ifthenelse(CmaxZero, scalar(0.0),Interception) StemFlow=ifthenelse(CmaxZero, scalar(0.0),StemFlow) - # Now corect for amximum potential evap + # Now corect for maximum potential evap OverEstimate = ifthenelse(Interception > maxevap,Interception - maxevap,scalar(0.0)) Interception = min(Interception,maxevap) # Add surpluss to the thoughdfall Index: wflow-py/wflow/wflow_sbm.py =================================================================== diff -u -r5a1c05b80f692a2f53d488f6a35e71660f1820c4 -r89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b --- wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision 5a1c05b80f692a2f53d488f6a35e71660f1820c4) +++ wflow-py/wflow/wflow_sbm.py (.../wflow_sbm.py) (revision 89ebbeb8e980b4f1cf8ee94bbf7f82fc6557269b) @@ -954,15 +954,14 @@ # Interception according to a modified Gash model ########################################################################## if self.timestepsecs >= (23 * 3600): - ThroughFall, Interception, StemFlow, self.CanopyStorage = rainfall_interception_gash(self.Cmax, self.EoverR, + self.ThroughFall, self.Interception, self.StemFlow, self.CanopyStorage = rainfall_interception_gash(self.Cmax, self.EoverR, self.CanopyGapFraction, self.PrecipitationPlusMelt, self.CanopyStorage,maxevap=self.PotEvap) - self.PotTransSoil = cover(max(0.0, self.PotEvap - Interception), 0.0) # now in mm - self.Interception=Interception + self.PotTransSoil = cover(max(0.0, self.PotEvap - self.Interception), 0.0) # now in mm else: - NetInterception, ThroughFall, StemFlow, LeftOver, Interception, self.CanopyStorage = rainfall_interception_modrut( + NetInterception, self.ThroughFall, self.StemFlow, LeftOver, Interception, self.CanopyStorage = rainfall_interception_modrut( self.PrecipitationPlusMelt, self.PotEvap, self.CanopyStorage, self.CanopyGapFraction, self.Cmax) self.PotTransSoil = cover(max(0.0, LeftOver), 0.0) # now in mm self.Interception=NetInterception @@ -973,7 +972,7 @@ # self.FirstZoneDepth = (self.thetaS - self.thetaR) * (self.FirstZoneThickness - self.zi) - self.AvailableForInfiltration = ThroughFall + StemFlow + self.AvailableForInfiltration = self.ThroughFall + self.StemFlow UStoreCapacity = self.FirstZoneCapacity - self.FirstZoneDepth - self.UStoreDepth # Runoff onto water bodies and river network @@ -1178,7 +1177,9 @@ self.RootZonSoilMoisture = self.UStoreDepth * max(1.0, self.RootingDepth/self.zi) # The MAx here may lead to watbal error. Howevere, if inwaterMMM becomes < 0, the kinematic wave becomes very slow...... - self.InwaterMM = max(0.0,self.ExfiltWater + self.ExcessWater + self.SubCellRunoff + self.SubCellGWRunoff + self.RunoffOpenWater + self.BaseFlow - self.reinfiltwater - self.ActEvapOpenWater) + self.InwaterMM = max(0.0,self.ExfiltWater + self.ExcessWater + self.SubCellRunoff + \ + self.SubCellGWRunoff + self.RunoffOpenWater + self.BaseFlow -\ + self.reinfiltwater - self.ActEvapOpenWater) self.Inwater = self.InwaterMM * self.ToCubic # m3/s self.ExfiltWaterCubic = self.ExfiltWater * self.ToCubic @@ -1284,9 +1285,12 @@ self.DeltaStorage - \ self.FirstZoneFlux + CellInFlow - self.SurfaceWatbal = self.PrecipitationPlusMelt - self.Interception -\ - self.ExcessWater - self.RunoffOpenWater - self.SubCellRunoff - self.ActInfilt -\ - (self.CanopyStorage - self.OldCanopyStorage) + self.InterceptionWatBal = self.PrecipitationPlusMelt - self.Interception -self.StemFlow - self.ThroughFall -\ + (self.OldCanopyStorage - self.CanopyStorage) + self.SurfaceWatbal = self.PrecipitationPlusMelt - self.Interception - \ + self.ExcessWater - self.RunoffOpenWater - self.SubCellRunoff - \ + self.ActInfilt -\ + (self.OldCanopyStorage - self.CanopyStorage) self.watbal = self.SoilWatbal + self.SurfaceWatbal