Index: doc/framework.rst =================================================================== diff -u -ref66b8e21f94f3f322fbf29dbacc22ec45914a9b -reafe3e90f7b27df9e7da35b075aec5aded18764a --- doc/framework.rst (.../framework.rst) (revision ef66b8e21f94f3f322fbf29dbacc22ec45914a9b) +++ doc/framework.rst (.../framework.rst) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -1,7 +1,7 @@ Using the framework =================== -This section only gives a brief description of the framework focussing on the extensions +This section only gives a brief description of the framework focusing on the extensions made for OpenStreams. A full description of the current version of the framework can be found at http://www.pcraster.eu. @@ -10,8 +10,8 @@ and modify the ``wflow_sceleton.py`` example model. You can also use the other models for inspiration. -In order to facilitate reusing data between models the data is stored in the following directory -tree: +In order to facilitate reusing data between models the data is stored in the following +directory tree: .. digraph:: file_system Index: doc/release_notes.rst =================================================================== diff -u -re99553d4811c68780da0d78c83b4567f0b32c43b -reafe3e90f7b27df9e7da35b075aec5aded18764a --- doc/release_notes.rst (.../release_notes.rst) (revision e99553d4811c68780da0d78c83b4567f0b32c43b) +++ doc/release_notes.rst (.../release_notes.rst) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -1,7 +1,17 @@ Release notes ============= -Version 1.0RC6 +Trunc +----- +Under heavy development + ++ added wf_updateparameters to framework. This allows the user to set parameters to update + in the ini file but alse list them in the parameters function in the model itself. This + functionality should replace all manual reading of forcing data and static parameters + + + +Version 1.0RC7 -------------- unsupported interim release Index: doc/wf_DynamicFramework.rst =================================================================== diff -u -rb7f6c4b703a8f7f7bb1551a10f191d9404b34c1e -reafe3e90f7b27df9e7da35b075aec5aded18764a --- doc/wf_DynamicFramework.rst (.../wf_DynamicFramework.rst) (revision b7f6c4b703a8f7f7bb1551a10f191d9404b34c1e) +++ doc/wf_DynamicFramework.rst (.../wf_DynamicFramework.rst) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -112,10 +112,43 @@ +Settings in the modelparameters section +--------------------------------------- +Most of the time this section is not needed as this will mostly be configured +in the python code by the model developer. Howevere, in some case this section can be used +to for example force the model to read RootingDepth from an external data source. +The format of entries in this section is as follows:: + name=stack,type,default + # example: + # RootingDepth=monthlyclim/ROOT,monthyclim,100 ++ name - Name of the parameter (internal variable, without the self.) ++ stack - Name of the mapstack (representation on disk or in mem) relative to case ++ type - Type of parameter (default = static) ++ default - Default value if map/tbl is not present + +Possible parameter types (the second option)are:: + + staticmap: Read at startup from map + statictbl: Read at startup from tbl, falback to map (need Landuse, Soil and TopoId (subcatch) maps)! + timeseries: read map for each timestep + monthlyclim: read a map corresponding to the current month (12 maps in total) + dailyclim: read a map corresponding to the current day of the year + hourlyclim: read a map corresponding to the current hour of the day (24 in total) + + +Example:: + + [modelparameters] + RootingDepth=monthlyclim/ROOTS,monthlyclim,75 + # Force the model to read monthly climatology of P + Precipitation=inmaps/P,monthlyclim,0.0 + + + wf_DynamicFramework Module ========================== Index: doc/wflow_usage.rst =================================================================== diff -u -r9d02128f2238de18ce7d0e2443a26da02064de80 -reafe3e90f7b27df9e7da35b075aec5aded18764a --- doc/wflow_usage.rst (.../wflow_usage.rst) (revision 9d02128f2238de18ce7d0e2443a26da02064de80) +++ doc/wflow_usage.rst (.../wflow_usage.rst) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -321,42 +321,9 @@ self.FirstZoneDepth=fir -[outputtss] -.. note:: - Depricated. This is the old method. Use outputcsv_0 or outputtss_0 instead (see below) -List all timeseries here that you want to have saved (in tss format). -Timeseries are produced as averages per subcatchment. Note that each -timeseries you add here slows down the program so only save what you -need, especially in operational applications. Possible values are: - - Note the run.tss and lev.tss are always saved (runoff and water - level at the gauge locations) - - - -:: - - [outputtss] - self.ActEvap=aet - self.watbal=wat - self.PotEvap=pot - self.FirstZoneDepth=fir - self.Interception=int - self.UStoreDepth=ust - self.zi=zi_ - self.ExfiltWater=exf - self.UStoreCapacity=tde - self.Transfer=tra - self.Ksat=ksa - self.Snow=sno - self.SnowMelt=snm - self.SnowWater=snw - self.FirstZoneFlux=fzf - - [outputcsv_0-n] [outputtss_0-n] @@ -450,9 +417,6 @@ :: - [outputtss] - # All variables in the dynamic section can be put here - [defaultfortbl] RunoffGeneratingGWPerc = 0.1 Index: examples/wflow_rhine_sbm/outstate/TSoil.map =================================================================== diff -u -r9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42 -reafe3e90f7b27df9e7da35b075aec5aded18764a Binary files differ Index: examples/wflow_rhine_sbm/wflow_sbm.ini =================================================================== diff -u -rd66a33f37991f6a5a18c063434f86b2153256a75 -reafe3e90f7b27df9e7da35b075aec5aded18764a --- examples/wflow_rhine_sbm/wflow_sbm.ini (.../wflow_sbm.ini) (revision d66a33f37991f6a5a18c063434f86b2153256a75) +++ examples/wflow_rhine_sbm/wflow_sbm.ini (.../wflow_sbm.ini) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -38,7 +38,8 @@ # - default - Default value if map/tbl is not present #Possible types are:: -# - static: Read at startup from map or tbl (not implmented yet) +# - staticmap: Read at startup from map +# - statictbl: Read at startup from tbl # - timeseries: read map for each timestep # - monthlyclim: read a map corresponding to the current month (12 maps in total) # - dailyclim: read a map corresponding to the current day of the year Index: examples/wflow_rhine_sbm/wflow_sceleton.ini =================================================================== diff -u -r9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42 -reafe3e90f7b27df9e7da35b075aec5aded18764a --- examples/wflow_rhine_sbm/wflow_sceleton.ini (.../wflow_sceleton.ini) (revision 9dd1a78b1a2e6aa0e67e970d6235e4923b8bfc42) +++ examples/wflow_rhine_sbm/wflow_sceleton.ini (.../wflow_sceleton.ini) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -19,3 +19,15 @@ samplemap=staticmaps/wflow_subcatch.map self.TSoil=tes.csv +[outputtss_0] +samplemap=staticmaps/wflow_subcatch.map +self.TSoil=tes.tss + +[summary_avg] +self.TSoil=Tsoilavg.map + +[summary_max] +self.TSoil=Tsoilmax.map + +[summary_min] +self.TSoil=Tsoilmin.map Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -rd66a33f37991f6a5a18c063434f86b2153256a75 -reafe3e90f7b27df9e7da35b075aec5aded18764a --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision d66a33f37991f6a5a18c063434f86b2153256a75) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -302,7 +302,8 @@ Possible parameter types are:: - - static: Read at startup from map or tbl + - staticmap: Read at startup from map + - statictbl: Read at startup from tbl, falback to map (nee Landuse, Soil and TopoId (subcatch) maps! - timeseries: read map for each timestep - monthlyclim: read a map corresponding to the current month (12 maps in total) - dailyclim: read a map corresponding to the current day of the year @@ -313,15 +314,26 @@ for par in self.modelparameters: if self._userModel()._inInitial(): - if par.type == 'static': - if hasattr(self._userModel(),par.name): - tblname = os.path.join(self._userModel().Dir, self._userModel().intbl, par.stack) - theparmap = self.readtblDefault(tblname, - self._userModel().LandUse, self._userModel().TopoId, self._userModel().Soil, - par.default) - setattr(self._userModel(),par.name,theparmap) + if par.type == 'statictbl': + if not hasattr(self._userModel(),par.name): + self._userModel().logger.info("Adding " + par.name + " to model.") + tblname = os.path.join(self._userModel().Dir, "intbl", par.stack) + theparmap = self.readtblDefault(tblname, + self._userModel().LandUse, self._userModel().TopoId, self._userModel().Soil, + par.default) + setattr(self._userModel(),par.name,theparmap) + if par.type == 'staticmap': + if not hasattr(self._userModel(),par.name): + self._userModel().logger.info("Adding " + par.name + " to model.") + fname = os.path.join(self._userModel().Dir, "staticmaps", par.stack) + fileName, fileExtension = os.path.splitext(fname) + if fileExtension == '.map': + theparmap = readmap(fname) else: - print "cannot find " + par.name + par.stack + self._userModel().logger.error(fname + " Does not have a .map extension") + + setattr(self._userModel(),par.name,theparmap) + if self._userModel()._inDynamic(): if par.type == 'timeseries': if not hasattr(self._userModel(),par.name): Index: wflow-py/wflow/wflow_sceleton.py =================================================================== diff -u -r11f8d5cb169091c08cc5b7210e35f2ce7aed5fb3 -reafe3e90f7b27df9e7da35b075aec5aded18764a --- wflow-py/wflow/wflow_sceleton.py (.../wflow_sceleton.py) (revision 11f8d5cb169091c08cc5b7210e35f2ce7aed5fb3) +++ wflow-py/wflow/wflow_sceleton.py (.../wflow_sceleton.py) (revision eafe3e90f7b27df9e7da35b075aec5aded18764a) @@ -60,7 +60,34 @@ self.configfile = configfile + def parameters(self): + """ + List all the parameters (both static and forcing here). USe the wf_updateparameters() + function to update them in the initial section (static) and the dynamic section for + dynamic parameters. + Possible parameter types are:: + + - staticmap: Read at startup from map + - statictbl: Read at startup from tbl, falback to map (nee Landuse, Soil and TopoId (subcatch) maps! + - timeseries: read map for each timestep + - monthlyclim: read a map corresponding to the current month (12 maps in total) + - dailyclim: read a map corresponding to the current day of the year + - hourlyclim: read a map corresponding to the current hour of the day (24 in total) + + + :return list of modelparameters: + """ + modelparameters = [] + + #Static model parameters + modelparameters.append(self.ParamType(name="Altitude",stack="wflow_dem.map",type="staticmap",default=0.0)) + + # Meteo and other forcing + modelparameters.append(self.ParamType(name="Temperature",stack="TEMP",type="timeseries",default=10.0)) + + return modelparameters + def stateVariables(self): """ *Required* @@ -135,11 +162,8 @@ self.timestepsecs = int(configget(self.config,'model','timestepsecs','86400')) - self.basetimestep=86400 - self.SaveMapDir = self.Dir + "/" + self.runId + "/outmaps" - self.TEMP_mapstack=self.Dir + configget(self.config,"inputmapstacks","Temperature","/inmaps/TEMP") - self.Altitude=readmap(self.Dir + "/staticmaps/wflow_dem") + self.wf_updateparameters() self.logger.info("Starting Dynamic run...") @@ -168,6 +192,7 @@ *Optional* Return a default list of variables to report as summary maps in the outsum dir. + The ini file has more option, including average and sum """ return ['self.Altitude'] @@ -178,10 +203,11 @@ This is where all the time dependent functions are executed. Time dependent output should also be saved here. """ + + self.wf_updateparameters() # read the temperature map fo each step (see parameters()) + + self.TSoil = self.TSoil + 0.1125 * (self.Temperature - self.TSoil) * self.timestepsecs/self.basetimestep - Temperature = self.wf_readmap(self.TEMP_mapstack,0.0) - self.TSoil = self.TSoil + 0.1125 * (Temperature - self.TSoil) * self.timestepsecs/self.basetimestep - # reporting of maps and csv timeseries is done by the framework (see ini file)