Index: doc/release_notes.rst =================================================================== diff -u -r3b9f4fb88662a50aa3905331d4fe70905a021819 -rce599a21046a69d80b7c251c236dfd2143fefbf1 --- doc/release_notes.rst (.../release_notes.rst) (revision 3b9f4fb88662a50aa3905331d4fe70905a021819) +++ doc/release_notes.rst (.../release_notes.rst) (revision ce599a21046a69d80b7c251c236dfd2143fefbf1) @@ -1,9 +1,16 @@ Release notes ============= -Trunk ------ -Under heavy development +2016.02 +------- ++ added better BMI support ++ added bmi2runner and wflow_bmi_combined ++ updated date/time framework ++ added wflow_topoflex model ++ added reservoir support to wflow_routing ++ added support for other functions apart from averaging in output of time series ++ wflow_delwaq support netCDF files ++ wflow_sbm2 updated 2015.02 Index: wflow-py/UnitTests/Testwflow_hbv.py =================================================================== diff -u -rb62f2744579dcd9ef1e9033d0cbd32ac2cf4f007 -rce599a21046a69d80b7c251c236dfd2143fefbf1 --- wflow-py/UnitTests/Testwflow_hbv.py (.../Testwflow_hbv.py) (revision b62f2744579dcd9ef1e9033d0cbd32ac2cf4f007) +++ wflow-py/UnitTests/Testwflow_hbv.py (.../Testwflow_hbv.py) (revision ce599a21046a69d80b7c251c236dfd2143fefbf1) @@ -47,6 +47,61 @@ dynModelFw.wf_setValues('PET', 2.0) dynModelFw.wf_setValues('TEMP', 10.0) dynModelFw._runDynamic(ts,ts) # runs for all timesteps + dynModelFw._runSuspend() # saves the state variables + dynModelFw._wf_shutdown() + + # nore read the csv results acn check of they match the first run + # Sum should be approx c 4.569673676 + my_data = wf.genfromtxt(os.path.join(caseName,runId,"watbal.csv"), delimiter=',') + + print("Checking water budget ....") + self.assertAlmostEquals(-0.0006561279296875,my_data[:,2].sum(),places=4) + + my_data = wf.genfromtxt(os.path.join(caseName,runId,"run.csv"), delimiter=',') + print("Checking discharge ....") + self.assertAlmostEquals(1073.2958811442056,my_data[:,2].mean(),places=4) + + print("Checking precip sum ....") + my_data = wf.genfromtxt(os.path.join(caseName,runId,"P.csv"), delimiter=',') + self.assertAlmostEquals(sump,my_data[:,2].sum()) + + + def testapirunhr(self): + startTime = 1 + stopTime = 30 + currentTime = 1 + + # set runid, clonemap and casename. Also define the ini file + runId = "unittest" + configfile="wflow_hbv_hr.ini" + wflow_cloneMap = 'wflow_catchment.map' + caseName="wflow_hbv" + starttime = starttime = datetime.datetime(1990,01,01) + + myModel = wf.WflowModel(wflow_cloneMap, caseName,runId,configfile) + # initialise the framework + dynModelFw = wf.wf_DynamicFramework(myModel, stopTime,firstTimestep=startTime,datetimestart=starttime) + print dynModelFw.DT + + # Load model config from files and check directory structure + dynModelFw.createRunId(NoOverWrite=False,level=wf.logging.DEBUG) + # Run the initial part of the model (reads parameters and sets initial values) + dynModelFw._runInitial() # Runs initial part + + dynModelFw._runResume() # gets the state variables + sump = 0.0 + for ts in range(startTime,stopTime + 1): + if ts <10: + dynModelFw.wf_setValues('P', 0.0) + elif ts <= 15: + dynModelFw.wf_setValues('P', 10.0) + sump = sump + 10.0 + else: + dynModelFw.wf_setValues('P', 0.0) + + dynModelFw.wf_setValues('PET', 2.0) + dynModelFw.wf_setValues('TEMP', 10.0) + dynModelFw._runDynamic(ts,ts) # runs for all timesteps dynModelFw.logger.info("Doing step: " + str(ts)) dynModelFw._runSuspend() # saves the state variables dynModelFw._wf_shutdown() @@ -56,8 +111,12 @@ my_data = wf.genfromtxt(os.path.join(caseName,runId,"watbal.csv"), delimiter=',') print("Checking water budget ....") - self.assertAlmostEquals(0.00019298947660928434,my_data[:,2].sum(),places=4) + self.assertAlmostEquals(-0.0006561279296875,my_data[:,2].sum(),places=4) + my_data = wf.genfromtxt(os.path.join(caseName,runId,"run.csv"), delimiter=',') + print("Checking discharge ....") + self.assertAlmostEquals(2141.2660095214842,my_data[:,2].mean(),places=4) + print("Checking precip sum ....") my_data = wf.genfromtxt(os.path.join(caseName,runId,"P.csv"), delimiter=',') self.assertAlmostEquals(sump,my_data[:,2].sum()) Index: wflow-py/UnitTests/wflow_hbv/wflow_hbv.ini =================================================================== diff -u -r25fd5288e8a5fc0dde3d411e5666ab7ab1e532d8 -rce599a21046a69d80b7c251c236dfd2143fefbf1 --- wflow-py/UnitTests/wflow_hbv/wflow_hbv.ini (.../wflow_hbv.ini) (revision 25fd5288e8a5fc0dde3d411e5666ab7ab1e532d8) +++ wflow-py/UnitTests/wflow_hbv/wflow_hbv.ini (.../wflow_hbv.ini) (revision ce599a21046a69d80b7c251c236dfd2143fefbf1) @@ -114,11 +114,6 @@ self.Precipitation=P.csv self.watbal=watbal.csv -[outputtss_0] -samplemap=staticmaps/wflow_subcatch.map -self.Precipitation=P.tss -self.watbal=watbal.tss - -[outputtss_0] +[outputcsv_0] samplemap=staticmaps/wflow_gauges.map -self.SurfaceRunoff=run.tss +self.SurfaceRunoff=run.csv Index: wflow-py/UnitTests/wflow_hbv/wflow_hbv_hr.ini =================================================================== diff -u --- wflow-py/UnitTests/wflow_hbv/wflow_hbv_hr.ini (revision 0) +++ wflow-py/UnitTests/wflow_hbv/wflow_hbv_hr.ini (revision ce599a21046a69d80b7c251c236dfd2143fefbf1) @@ -0,0 +1,119 @@ +[API] +P=0,0 +PET=0,0 +TEMP=0,3 + + +# Define the forcings needed for the model here +# the filename is either the name of the pcraster map-stack or the name of the +# variable in the netcdf input file +[inputmapstacks] +Precipitation = /inmaps/P +EvapoTranspiration = /inmaps/PET +Temperature = /inmaps/TEMP +# this is optional inflow (positive) or outflow (negative) of the kin-wave reservoir +Inflow = /inmaps/IF + + +[modelparameters] +# Format: +# name=stack,type,default +# example: +# RootingDepth=monthlyclim/ROOT,monthyclim,100,1 + +# - name - Name of the parameter (internal variable) +# - 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 +# - set to 1 to be verbose if a map is missing + +#Possible types are:: +# - 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 +# - hourlyclim: read a map corresponding to the current hour of the day (24 in total) (not implemented yet) +#RootingDepth=monthlyclim/ROOT,monthlyclim,75,1 + +[run] +# either a runinfo file or a start and end-time are required +#runinfo=runinfo.xml +#starttime= 1995-01-31 00:00:00 +#endtime= 1995-02-28 00:00:00 +# required, base timestep of the model +timestepsecs = 3600 +#start model with cold state +reinit=1 + +# Model parameters and settings +[model] +modeltype= sbm + +AnnualDischarge=2290 +# Alpha for wiver-width estimation 5 for mountain stream 60 for the river rhine +Alpha=120 +ModelSnow=0 +ScalarInput=0 +InterpolationMethod=inv +WIMaxScale=0.8 +Tslice=1 +# Maximum upstream distance to update the flow in metres +UpdMaxDist=300000.0 +#SubCatchFlowOnly = 1 +origTopogLateral = 1 +reinit=0 + + +#DynamicVegetation=1 + +[misc] +#mapSaveInterval=365 + +[framework] +# outputformat for the *dynamic* mapstacks (not the states and summary maps) +# 1: pcraster +# 2: numpy +# 3: matlab + +# netcdfoutput requires also outputformat = 1 (default) and additionally the name of the file +#netcdfoutput = outmaps.nc +#netcdfwritebuffer=100 + +[layout] +# if set to zero the cell-size is given in lat/long (the default) +sizeinmetres = 0 + + + + +[outputmaps] +#self.watbal=wat + + +[summary] +#self.CCup=CCup.map +#self.CClow=CClow.map +# Save and average these per LU type + +[summary_sum] +self.Precipitation=Sumprecip.map + +[summary_max] +self.Precipitation=maxprecip.map + +[summary_min] +#self.Temperature=mintemp.map + +[summary_avg] +self.Precipitation=avgprecip.map + +# gauge output +[outputcsv_0] +samplemap=staticmaps/wflow_subcatch.map +self.Precipitation=P.csv +self.watbal=watbal.csv + +[outputcsv_0] +samplemap=staticmaps/wflow_gauges.map +self.SurfaceRunoff=run.csv