<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://source.geography.bristol.ac.uk/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wbuytaert</id>
	<title>SourceWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://source.geography.bristol.ac.uk/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wbuytaert"/>
	<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/wiki/Special:Contributions/Wbuytaert"/>
	<updated>2026-04-06T05:32:51Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.8</generator>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=7312</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=7312"/>
		<updated>2010-04-03T14:11:56Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
NOTE: This page is no longer updated since my move to Imperial College London. For an updated version please visit [http://rwiki.sciviews.org/doku.php?id=guides:tutorials:hydrological_data_analysis the R wiki]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=7311</id>
		<title>RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=7311"/>
		<updated>2010-04-03T14:11:06Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6593</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6593"/>
		<updated>2009-11-09T09:05:18Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
NOTE: This page is not updated any more since my move to Imperial College London. For an updated version please visit [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis the R wiki]&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
* [[topmodel|TOPMODEL]]&lt;br /&gt;
&lt;br /&gt;
==Importing data==&lt;br /&gt;
&lt;br /&gt;
* [[miscellaneous data import]]&lt;br /&gt;
&lt;br /&gt;
Importing hydrological time series and basic preprocessing&lt;br /&gt;
&lt;br /&gt;
* [[GCM data from the IPCC data repository]]&lt;br /&gt;
&lt;br /&gt;
* [[CRU reanalysis data]]&lt;br /&gt;
&lt;br /&gt;
==Basic hydrological analysis==&lt;br /&gt;
&lt;br /&gt;
* [[baseflow separation]]&lt;br /&gt;
&lt;br /&gt;
* [[calculating catchment characteristics]]&lt;br /&gt;
&lt;br /&gt;
==Hydrological modelling==&lt;br /&gt;
&lt;br /&gt;
* [[Running Topmodel]]&lt;br /&gt;
&lt;br /&gt;
==Uncertainty analysis==&lt;br /&gt;
&lt;br /&gt;
* [[GLUE analysis]]&lt;br /&gt;
&lt;br /&gt;
* [[Performance measures]]&lt;br /&gt;
&lt;br /&gt;
==Visualisation==&lt;br /&gt;
&lt;br /&gt;
* [[plotting maps]]&lt;br /&gt;
&lt;br /&gt;
* [[Making nice hydrological graphs]]&lt;br /&gt;
&lt;br /&gt;
==Miscellaneous functions==&lt;br /&gt;
&lt;br /&gt;
* [[Data formatting and preprocessing]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6592</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6592"/>
		<updated>2009-11-09T09:05:00Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
NOTE: This page is not updated any more since my move to Imperial College London. For an updated version please visit [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis the R wiki]&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
* [[topmodel|TOPMODEL]]&lt;br /&gt;
&lt;br /&gt;
==Importing data==&lt;br /&gt;
&lt;br /&gt;
* [[miscellaneous data import]]&lt;br /&gt;
&lt;br /&gt;
Importing hydrological time series and basic preprocessing&lt;br /&gt;
&lt;br /&gt;
* [[GCM data from the IPCC data repository]]&lt;br /&gt;
&lt;br /&gt;
* [[CRU reanalysis data]]&lt;br /&gt;
&lt;br /&gt;
==Topographical analysis==&lt;br /&gt;
&lt;br /&gt;
* [[Digital terrain analysis with RHydro]]&lt;br /&gt;
&lt;br /&gt;
==Basic hydrological analysis==&lt;br /&gt;
&lt;br /&gt;
* [[baseflow separation]]&lt;br /&gt;
&lt;br /&gt;
* [[calculating catchment characteristics]]&lt;br /&gt;
&lt;br /&gt;
==Hydrological modelling==&lt;br /&gt;
&lt;br /&gt;
* [[Running Topmodel]]&lt;br /&gt;
&lt;br /&gt;
==Uncertainty analysis==&lt;br /&gt;
&lt;br /&gt;
* [[GLUE analysis]]&lt;br /&gt;
&lt;br /&gt;
* [[Performance measures]]&lt;br /&gt;
&lt;br /&gt;
==Visualisation==&lt;br /&gt;
&lt;br /&gt;
* [[plotting maps]]&lt;br /&gt;
&lt;br /&gt;
* [[Making nice hydrological graphs]]&lt;br /&gt;
&lt;br /&gt;
==Miscellaneous functions==&lt;br /&gt;
&lt;br /&gt;
* [[Data formatting and preprocessing]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_the_topographical_index&amp;diff=6591</id>
		<title>Calculating the topographical index</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_the_topographical_index&amp;diff=6591"/>
		<updated>2009-11-09T09:04:20Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6479</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6479"/>
		<updated>2009-08-28T09:16:08Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
NOTE: This page is not updated any more since my move to Imperial College London. For an updated version please visit [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis the R wiki]&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
* [[topmodel|TOPMODEL]]&lt;br /&gt;
&lt;br /&gt;
==Importing data==&lt;br /&gt;
&lt;br /&gt;
* [[miscellaneous data import]]&lt;br /&gt;
&lt;br /&gt;
Importing hydrological time series and basic preprocessing&lt;br /&gt;
&lt;br /&gt;
* [[GCM data from the IPCC data repository]]&lt;br /&gt;
&lt;br /&gt;
* [[CRU reanalysis data]]&lt;br /&gt;
&lt;br /&gt;
==Topographical analysis==&lt;br /&gt;
&lt;br /&gt;
* [[Calculating the topographical index]]&lt;br /&gt;
&lt;br /&gt;
* [[Digital terrain analysis with RHydro]]&lt;br /&gt;
&lt;br /&gt;
==Basic hydrological analysis==&lt;br /&gt;
&lt;br /&gt;
* [[baseflow separation]]&lt;br /&gt;
&lt;br /&gt;
* [[calculating catchment characteristics]]&lt;br /&gt;
&lt;br /&gt;
==Hydrological modelling==&lt;br /&gt;
&lt;br /&gt;
* [[Running Topmodel]]&lt;br /&gt;
&lt;br /&gt;
==Uncertainty analysis==&lt;br /&gt;
&lt;br /&gt;
* [[GLUE analysis]]&lt;br /&gt;
&lt;br /&gt;
* [[Performance measures]]&lt;br /&gt;
&lt;br /&gt;
==Visualisation==&lt;br /&gt;
&lt;br /&gt;
* [[plotting maps]]&lt;br /&gt;
&lt;br /&gt;
* [[Making nice hydrological graphs]]&lt;br /&gt;
&lt;br /&gt;
==Miscellaneous functions==&lt;br /&gt;
&lt;br /&gt;
* [[Data formatting and preprocessing]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6478</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=6478"/>
		<updated>2009-08-28T09:15:33Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
This page is not updated any more since my move to Imperial College London. For an updated version please visit [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis the R wiki]&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
* [[topmodel|TOPMODEL]]&lt;br /&gt;
&lt;br /&gt;
==Importing data==&lt;br /&gt;
&lt;br /&gt;
* [[miscellaneous data import]]&lt;br /&gt;
&lt;br /&gt;
Importing hydrological time series and basic preprocessing&lt;br /&gt;
&lt;br /&gt;
* [[GCM data from the IPCC data repository]]&lt;br /&gt;
&lt;br /&gt;
* [[CRU reanalysis data]]&lt;br /&gt;
&lt;br /&gt;
==Topographical analysis==&lt;br /&gt;
&lt;br /&gt;
* [[Calculating the topographical index]]&lt;br /&gt;
&lt;br /&gt;
* [[Digital terrain analysis with RHydro]]&lt;br /&gt;
&lt;br /&gt;
==Basic hydrological analysis==&lt;br /&gt;
&lt;br /&gt;
* [[baseflow separation]]&lt;br /&gt;
&lt;br /&gt;
* [[calculating catchment characteristics]]&lt;br /&gt;
&lt;br /&gt;
==Hydrological modelling==&lt;br /&gt;
&lt;br /&gt;
* [[Running Topmodel]]&lt;br /&gt;
&lt;br /&gt;
==Uncertainty analysis==&lt;br /&gt;
&lt;br /&gt;
* [[GLUE analysis]]&lt;br /&gt;
&lt;br /&gt;
* [[Performance measures]]&lt;br /&gt;
&lt;br /&gt;
==Visualisation==&lt;br /&gt;
&lt;br /&gt;
* [[plotting maps]]&lt;br /&gt;
&lt;br /&gt;
* [[Making nice hydrological graphs]]&lt;br /&gt;
&lt;br /&gt;
==Miscellaneous functions==&lt;br /&gt;
&lt;br /&gt;
* [[Data formatting and preprocessing]]&lt;br /&gt;
&lt;br /&gt;
==Feedback==&lt;br /&gt;
&lt;br /&gt;
* This page is maintained by [http://www3.imperial.ac.uk/people/w.buytaert Wouter Buytaert]. All feedback is welcome.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=6477</id>
		<title>Digital terrain analysis with RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=6477"/>
		<updated>2009-08-28T09:12:56Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The digital terrain analysis tools are now merged with the topmodel package. A revised guide can be found at [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis:dta|the R wiki]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=6363</id>
		<title>GLUE analysis</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=6363"/>
		<updated>2009-08-12T18:13:13Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
Since I am now at Imperial College London, this page has moved and can now be found on [http://wiki.r-project.org/rwiki/doku.php?id=guides:tutorials:hydrological_data_analysis the wiki page of the R-project].&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=6116</id>
		<title>GLUE analysis</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=6116"/>
		<updated>2009-05-23T21:47:27Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
This is an example of R code to perform a Generalised Likelihood Uncertainty Estimation (GLUE) on a hydrological model. In the example we use [[topmodel]] (implemented as ''topmodel()'') on a catchment in the Ecuadorian Andes (Huagrahuma). Other models can be used as long as they are implemented as an R function.&lt;br /&gt;
&lt;br /&gt;
More examples and scripts for doing uncertainty analysis in R can be found on [http://www.glue-uncertainty.org/ Keith Beven's uncertainty pages].&lt;br /&gt;
&lt;br /&gt;
===Libraries ===&lt;br /&gt;
&lt;br /&gt;
Library Hmisc ([http://cran.r-project.org/web/packages/Hmisc/index.html CRAN]) is needed for the ''wgt.quantile()'' function. See ?wgt.quantile for details. &lt;br /&gt;
&lt;br /&gt;
   library(Hmisc)&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
   data(huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Procedure===&lt;br /&gt;
Sample parameter sets from a prior parameter distribution. This example uses the uniform distribution, which can be sampled with &amp;quot;runif()&amp;quot;. The parameters vch and psi are not used in this example but need to be initialised. For an explanation of the parameter values see the page on [[Running Topmodel]]. We take initially 1000 parameter sets. Depending on the performance of the model, many of them will be rejected as non-behavioural. If you end up with too few parameter behavioural parameter sets, you will need to increase your sample size.&lt;br /&gt;
&lt;br /&gt;
   qs0   &amp;lt;- runif(1000, min = 0.0001, max = 0.00025)&lt;br /&gt;
   lnTe  &amp;lt;- runif(1000, min = -2, max = 3)&lt;br /&gt;
   m     &amp;lt;- runif(1000, min = 0, max = 0.1)&lt;br /&gt;
   Sr0   &amp;lt;- runif(1000, min = 0, max = 0.2)&lt;br /&gt;
   Srmax &amp;lt;- runif(1000, min = 0, max = 0.1)&lt;br /&gt;
   td    &amp;lt;- runif(1000, min = 0, max = 3)&lt;br /&gt;
   vch   &amp;lt;- 1000&lt;br /&gt;
   vr    &amp;lt;- runif(1000, min = 100, max = 2500)&lt;br /&gt;
   k0    &amp;lt;- runif(1000, min = 0, max = 10)&lt;br /&gt;
   CD    &amp;lt;- runif(1000, min = 0, max = 5)&lt;br /&gt;
   dt    &amp;lt;- 0.25&lt;br /&gt;
   &lt;br /&gt;
   parameters &amp;lt;- cbind(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)&lt;br /&gt;
&lt;br /&gt;
Now each row in the matrix ''parameters'' contains a sampled parameter set. Run the model for the calibration period with the each set to obtain the simulated discharge:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters[1,],topidx,delay,rain,ET0)&lt;br /&gt;
&lt;br /&gt;
Calculate the likelihood of this parameter set using the simulated and observed discharge. The choice of the likelihood function is up to the user, but the Nash - Sutcliffe efficiency is given here as an example:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
Decide whether the parameter set is behavioural or not and retain the parameter set if behavioural&lt;br /&gt;
&lt;br /&gt;
NOTE: in GLUE, this decision is subjective. For a more scientifically sound determination of the behavioural limit, see Beven (2006). Here we will use an efficiency of 0.6 as a threshold. The efficiency, parameter set and simulated discharge of a behavioural run are stored in resp. the objects ''total.eff'', ''total.param.set'' and ''total.qsim''&lt;br /&gt;
&lt;br /&gt;
   if(eff &amp;gt; 0.6) {&lt;br /&gt;
      total.eff &amp;lt;- c(total.eff,eff)&lt;br /&gt;
      behavioural.parameters &amp;lt;- cbind(behavioural.parameters,parameters)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
The above procedure should be repeated until enough behavioural runs are obtained (e.g. using a while()-loop)&lt;br /&gt;
&lt;br /&gt;
If the above code is used, each column of the matrix ''behavioural.parameters'' contains a behavioural parameter set. The corresponding performance is found at the same location in the vector ''total.eff''&lt;br /&gt;
&lt;br /&gt;
Rerun the model for the prediction period, using each of the behavioural parameter sets. The simulated discharges are stored in the columns of a matrix called predicted.qsim&lt;br /&gt;
&lt;br /&gt;
   predicted.qsim &amp;lt;- model(behavioural.parameters[,1], rain, ...)&lt;br /&gt;
   &lt;br /&gt;
   for(i in 2:dim(param.set)[2]) {&lt;br /&gt;
      qsim &amp;lt;- model(behavioural.parameters[,i], rain, ...)&lt;br /&gt;
      predicted.qsim &amp;lt;- cbind(predicted.obs,qobs)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
Normalise the efficiencies so that they sum up to 1:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- eff - 0.6&lt;br /&gt;
   eff &amp;lt;- eff/sum(eff)&lt;br /&gt;
&lt;br /&gt;
Calculate the quantiles for each timestep. Here we take the 0.05 and 0.95 quantiles, resulting in 90% prediction limits. &lt;br /&gt;
&lt;br /&gt;
   limits &amp;lt;- apply(Qsim,1,&amp;quot;wtd.quantile&amp;quot;, weights = Eff, probs = c(0.05,0.95), normwt=T)&lt;br /&gt;
&lt;br /&gt;
===Final notes===&lt;br /&gt;
&lt;br /&gt;
* If topmodel is used, some loops can be avoided. topmodel() can work on entire parameter set matrices, which makes things faster. It can also return the Nash-Sutcliffe efficiency directly (see the topmodel page)&lt;br /&gt;
* The procedure can be very memory intensive because all simulated discharges for all parameter sets are stored in memory (the matrix predicted.qsim). If the model can give output per timestep, the above procedure can be repeated for each timestep separately to reduce memory usage&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K., and Binley, A. The future of distributed models: Model calibration and uncertainty prediction. Hydrological Processes 6 (1992), 279-298.&lt;br /&gt;
* Beven, K. A manifesto for the equifinality thesis. Journal of Hydrology 320 (2006), 18-36.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6081</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6081"/>
		<updated>2009-04-10T20:38:32Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     make&lt;br /&gt;
&lt;br /&gt;
NOTE: to build static libraries for inclusion in R on AMD86 you need to do: ./configure CFLAGS=-fPIC&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include -lm&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the current time in seconds. ''w'' is a vector of results at each timestep.&lt;br /&gt;
&lt;br /&gt;
QUESTION: Does the fact that ''tout'' is defined in seconds mean that the internal time step of the solver is seconds? Any way of making this more flexible?&lt;br /&gt;
&lt;br /&gt;
QUESTION: why do we need to patch the solver? Can't we execute ''W2Flux()'' after each call to CVode()? Likely answer: no, because the frequency of the input data may be higher than the requested output.&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
The structure of cvode_mem is internal to the solver and we do not really need to know this. cvode_mem is created with:&lt;br /&gt;
&lt;br /&gt;
     cvode_mem = CVodeCreate(CV_BDF, CV_NEWTON)&lt;br /&gt;
&lt;br /&gt;
and then initialised with:&lt;br /&gt;
&lt;br /&gt;
     CVodeSetFdata(cvode_mem, MData)&lt;br /&gt;
     CVodeMalloc(cvode_mem, f, CData.T0, w, CV_SS, CData.RTOL, &amp;amp;CData.ATOL)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* MData = pointer to model data structure&lt;br /&gt;
* cvode_mem is the structure to be initialised&lt;br /&gt;
* f is the right hand side function&lt;br /&gt;
* CData.T0: starting time (dimensions?)&lt;br /&gt;
* w: state vector&lt;br /&gt;
* CV_SS&lt;br /&gt;
* CData.RTOL = Relative Tolerance&lt;br /&gt;
* CData.ATOL = Absolute Tolerance&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6080</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6080"/>
		<updated>2009-04-10T20:27:27Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include -lm&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the current time in seconds. ''w'' is a vector of results at each timestep.&lt;br /&gt;
&lt;br /&gt;
QUESTION: Does the fact that ''tout'' is defined in seconds mean that the internal time step of the solver is seconds? Any way of making this more flexible?&lt;br /&gt;
&lt;br /&gt;
QUESTION: why do we need to patch the solver? Can't we execute ''W2Flux()'' after each call to CVode()? Likely answer: no, because the frequency of the input data may be higher than the requested output.&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
The structure of cvode_mem is internal to the solver and we do not really need to know this. cvode_mem is created with:&lt;br /&gt;
&lt;br /&gt;
     cvode_mem = CVodeCreate(CV_BDF, CV_NEWTON)&lt;br /&gt;
&lt;br /&gt;
and then initialised with:&lt;br /&gt;
&lt;br /&gt;
     CVodeSetFdata(cvode_mem, MData)&lt;br /&gt;
     CVodeMalloc(cvode_mem, f, CData.T0, w, CV_SS, CData.RTOL, &amp;amp;CData.ATOL)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* MData = pointer to model data structure&lt;br /&gt;
* cvode_mem is the structure to be initialised&lt;br /&gt;
* f is the right hand side function&lt;br /&gt;
* CData.T0: starting time (dimensions?)&lt;br /&gt;
* w: state vector&lt;br /&gt;
* CV_SS&lt;br /&gt;
* CData.RTOL = Relative Tolerance&lt;br /&gt;
* CData.ATOL = Absolute Tolerance&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6068</id>
		<title>Remote sensing data</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6068"/>
		<updated>2009-03-30T11:10:31Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Remote Sensing]]&lt;br /&gt;
&lt;br /&gt;
== Overview of remote sensing data that may be useful for hydrological analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Spectrometer ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!channels!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]  ||MERIS   ||15||March 2002||260x290m||Visible and Near Infrared spectrum (390 to 1040 nm), cloud cover, water bodies, frequency 3 days (higher at the poles)&lt;br /&gt;
|-&lt;br /&gt;
|NASA&lt;br /&gt;
|TIROS-N&lt;br /&gt;
|AVHRR&lt;br /&gt;
|4&lt;br /&gt;
| &amp;lt;!-- launch data unknown --&amp;gt;&lt;br /&gt;
|1.09x1.09km&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;| http://www.nsof.class.noaa.gov. &amp;lt;br/&amp;gt; Can be used for cloud cover (Bendix et al.), surface temperature (ref), delineation of water bodies (Zhou et al., 2000)&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-7||AVHRR||5||         ||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-15||AVHRR||6||May 1998||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-16||AVHRR||6||Sep 2000||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-17||AVHRR||6||Jun 2002||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-18||AVHRR||6||May 2005||&lt;br /&gt;
|-&lt;br /&gt;
|Eumetsat||METOP||AVHRR||?||||||cloud cover, surface temperature&lt;br /&gt;
|-&lt;br /&gt;
|ESA||MSG-1 &amp;amp; 2 (Meteosat-8 &amp;amp; 9)||SEVIRI||12||2002||||Spinning Enhanced Visible and Infrared Imager. [[http://www.eumetsat.int/Home/Main/Access_to_Data/Meteosat_Image_Services/SP_1123237865326 Africa and Europe]] @ 15 minutes. 8 channels can be used for monitoring the earth surface. Channel 12 is a high resolution visible (hrv) channel. Resolution: 3 km at the sub-satellite point (5 – 6 km over Europe). Channel 12 has a resolution of 1 km at the sub-satellite point (1.5 – 2 km over Europe). Can be used for precipitation (see e.g. Thies et al. doi:10.1029/2008JD010464)&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TRMM||??||||||25x25km (0.25°)|| rainfall&lt;br /&gt;
|-&lt;br /&gt;
|NASA||AQUA||AMSR-E||||May 2002||6.25 - 25 km||Wind speed, water vapor, cloud liquid water, Snow water equivalent,Surface Soil Moisture (daily). [[http://wwwghcc.msfc.nasa.gov/AMSR/data_products.html More details]].&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA||ASTER||[http://en.wikipedia.org/wiki/Advanced_Spaceborne_Thermal_Emission_and_Reflection_Radiometer 15]||1999||15-90m||temperature, reflectance, elevation, land use. On demand; some images exist for the Andes&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA/AQUA||[http://en.wikipedia.org/wiki/MODIS MODIS]||36||1999/2002||see notes||http://www.landcover.org, spatial resolution: 250 m (bands 1-2) 500 m (bands 3-7) 1000 m (bands 8-36), temporal resolution 1 to 2 days, visible and near infrared (400 to 14400 nm)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== radar ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||ASAR    ||March 2002||30m||APG HH and HV -&amp;gt; delineation of water bodies&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||Altimeter||March 2002||400m||altitude (only 1 dimension)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-1 RADARSAT-1]||ASAR||November 1995||10m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-2 RADARSAT-2]||ASAR||December 2007||3m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|ASI||[http://en.wikipedia.org/wiki/COSMO-SkyMed COSMO-SkyMed]||SAR||June 2007|| || Constellation of 4 satellites&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== other ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One that has not gone up yet: [http://bprc.osu.edu/water/index.php SWOT]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data aquisition ==&lt;br /&gt;
&lt;br /&gt;
=== ESA ===&lt;br /&gt;
&lt;br /&gt;
ESA is a very big engine and it is tricky to find what you are actually looking for or what you need but there is lots:&lt;br /&gt;
&lt;br /&gt;
The following link is a shortcut to ESA's 'Resources' page that includes upcoming workshops, the ESA library, data samples and archives, and probably most useful for anyone working with ESA data, there are ESA-tailored software tools that run free-of-charge on Windows, linux and also MacOS (although mac versions are usually appearing a bit later than the other two!): http://earth.esa.int/resources/&lt;br /&gt;
P.S. I attended an ESA Land Training course in Lisbon in September 2007 on Flooding/Soil moisture and Forests and have lots of lecture notes on ASAR, ALOS and how to use these data with the BEST, BEAM and POLSARPRO packages (I have actually worked with an ALOS quadpol for tree height and soil moisture retrieval: amazing data!). &lt;br /&gt;
If you want any of these notes or some help, just email me (guy.schumann@bristol.ac.uk) and I'll try to help!  &lt;br /&gt;
 &lt;br /&gt;
There is a useful tool from the ESA website to search for available images (does ENVISAT and others):&lt;br /&gt;
&lt;br /&gt;
http://eoli.esa.int/&lt;br /&gt;
&lt;br /&gt;
To access online (last 7-10 days) data and submit CAT-1 (free data) proposals for projects: &lt;br /&gt;
&lt;br /&gt;
http://earth.esa.int/dataproducts/accessingeodata/&lt;br /&gt;
&lt;br /&gt;
To answer third party mission (from non-ESA satellites) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist, and go to the 'TPM' link to the left of the page,&lt;br /&gt;
&lt;br /&gt;
and AO (Announcement of Opportunities) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist&lt;br /&gt;
&lt;br /&gt;
=== ESA conferences and workshops ===&lt;br /&gt;
&lt;br /&gt;
Anyone interested in this year's (2008) ESA summer school in August (4-14) at the ESRIN centre in Italy? Topic: Data assimilation, monitoring and modelling the Earth System. Have a look at: http://envisat.esa.int/envschool/&lt;br /&gt;
&lt;br /&gt;
== Detailed info on satellites ==&lt;br /&gt;
&lt;br /&gt;
=== meteosat ===&lt;br /&gt;
&lt;br /&gt;
The channels of SEVERI on board meteosat-8 (spectral band / μm)&lt;br /&gt;
&lt;br /&gt;
(from http://las.physik.uni-oldenburg.de/eProceedings/vol05_1/05_1_de-ruyter1.pdf)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
!Channel!!min!!max!!description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0.635 || 0.56 || 0.71 visual&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 0.81 || 0.74 || 0.88 visual&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 1.64 || 1.50 || 1.78 near infrared&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 3.90 || 3.48 || 4.36 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 6.25 || 5.35 || 7.15 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 7.35 || 6.85 || 7.85 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 8.70 || 8.30 || 9.1 infrared&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 9.66 || 9.38 || 9.94 infrared (ozone absorption)&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 10.80 || 9.80 || 11.80 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 12.00 || 11.00 || 13.00 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 13.40 || 12.40 || 14.40 infrared (CO2 absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0.75 || 0.60 || 0.90 high resolution visual broadband (hrv)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Processing ==&lt;br /&gt;
&lt;br /&gt;
=== Envisat altimeter ===&lt;br /&gt;
&lt;br /&gt;
Some information that may make life easier when dealing with ESA's altimeter N1 files:&lt;br /&gt;
&lt;br /&gt;
* ESA's [http://earth.esa.int/brat/html/data/toolbox_en.html Basic Radar Altimeter Toolbox] provides a set of tools and an interface for extracting data from the original N1 files. The interface is broken on recent linux versions due to obsolete dependencies but the command line tools work.  &lt;br /&gt;
&lt;br /&gt;
* The XY extraction utility (BratCreateZFXY) does not seem capable of extracting the original data directly. It requires a predefined raster size and automatically interpolates before exporting.&lt;br /&gt;
&lt;br /&gt;
* BratCreateYFX extracts the measurements in the original resolution. However it only includes one dimension so you have to add the other one manually as a dataset. Something like this in the parameter file:&lt;br /&gt;
&lt;br /&gt;
     # longitude&lt;br /&gt;
     X=lon&lt;br /&gt;
     X_NAME=X&lt;br /&gt;
     X_TYPE=Longitude&lt;br /&gt;
     X_UNIT=degrees_east&lt;br /&gt;
     X_TITLE=X&lt;br /&gt;
     # latitude&lt;br /&gt;
     FIELD=lat&lt;br /&gt;
     FIELD_NAME=Y&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=count&lt;br /&gt;
     FIELD_TITLE=Y&lt;br /&gt;
     # data of interest follow&lt;br /&gt;
     FIELD=alt_cog_ellip&lt;br /&gt;
     FIELD_NAME=alt_cog_ellip&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=mm&lt;br /&gt;
     FIELD_TITLE=alt_cog_ellip&lt;br /&gt;
&lt;br /&gt;
* Extracting many fields from many files is '''much''' easier using the command line tools and a batch script. &lt;br /&gt;
&lt;br /&gt;
== downscaling techniques ==&lt;br /&gt;
&lt;br /&gt;
=== statistical ===&lt;br /&gt;
&lt;br /&gt;
singular vector decomposition&lt;br /&gt;
&lt;br /&gt;
Bretherton CS, Smith C, Wallace JM. 1992. An intercomparison of methods for finding coupled patterns in climate data. Journal of Wilks DS. 1995. Statistical Methods in the Atmospheric Sciences. Climate 5: 541–560&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== dynamical ===&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6062</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6062"/>
		<updated>2009-02-27T23:00:30Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     ./make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include -lm&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the current time in seconds. ''w'' is a vector of results at each timestep.&lt;br /&gt;
&lt;br /&gt;
QUESTION: Does the fact that ''tout'' is defined in seconds mean that the internal time step of the solver is seconds? Any way of making this more flexible?&lt;br /&gt;
&lt;br /&gt;
QUESTION: why do we need to patch the solver? Can't we execute ''W2Flux()'' after each call to CVode()? Likely answer: no, because the frequency of the input data may be higher than the requested output.&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
The structure of cvode_mem is internal to the solver and we do not really need to know this. cvode_mem is created with:&lt;br /&gt;
&lt;br /&gt;
     cvode_mem = CVodeCreate(CV_BDF, CV_NEWTON)&lt;br /&gt;
&lt;br /&gt;
and then initialised with:&lt;br /&gt;
&lt;br /&gt;
     CVodeSetFdata(cvode_mem, MData)&lt;br /&gt;
     CVodeMalloc(cvode_mem, f, CData.T0, w, CV_SS, CData.RTOL, &amp;amp;CData.ATOL)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* MData = pointer to model data structure&lt;br /&gt;
* cvode_mem is the structure to be initialised&lt;br /&gt;
* f is the right hand side function&lt;br /&gt;
* CData.T0: starting time (dimensions?)&lt;br /&gt;
* w: state vector&lt;br /&gt;
* CV_SS&lt;br /&gt;
* CData.RTOL = Relative Tolerance&lt;br /&gt;
* CData.ATOL = Absolute Tolerance&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6061</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6061"/>
		<updated>2009-02-27T22:51:48Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     ./make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include -lm&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the current time in seconds. ''w'' is a vector of results at each timestep.&lt;br /&gt;
&lt;br /&gt;
QUESTION: Does the fact that ''tout'' is defined in seconds mean that the internal time step of the solver is seconds? Any way of making this more flexible?&lt;br /&gt;
&lt;br /&gt;
QUESTION: why do we need to patch the solver? Can't we execute ''W2Flux()'' after each call to CVode()? Likely answer: no, because the frequency of the input data may be higher than the requested output.&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
The structure of cvode_mem is internal to the solver and we do not really need to know this. cvode_mem is created with:&lt;br /&gt;
&lt;br /&gt;
     cvode_mem = CVodeCreate(CV_BDF, CV_NEWTON)&lt;br /&gt;
&lt;br /&gt;
and then initialised with:&lt;br /&gt;
&lt;br /&gt;
     CVodeMalloc(cvode_mem, f, CData.T0, w, CV_SS, CData.RTOL, &amp;amp;CData.ATOL)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* cvode_mem is the structure to be initialised&lt;br /&gt;
* f is the right hand side function&lt;br /&gt;
* CData.T0: starting time (dimensions?)&lt;br /&gt;
* w: state vector&lt;br /&gt;
* CV_SS&lt;br /&gt;
* CData.RTOL = Relative Tolerance&lt;br /&gt;
* CData.ATOL = Absolute Tolerance&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=6035</id>
		<title>Digital terrain analysis with RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=6035"/>
		<updated>2009-02-13T17:48:39Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an example using the DEM supplied with the package. Load the package and the DEM (we also need the package topmodel for the make.classes() function):&lt;br /&gt;
&lt;br /&gt;
  library(topmodel)&lt;br /&gt;
  library(RHydro)&lt;br /&gt;
  data(huagrahuma.dem)&lt;br /&gt;
&lt;br /&gt;
Fill depression and look at the difference between the original and filled map:&lt;br /&gt;
 &lt;br /&gt;
  dem.filled &amp;lt;- sinkfind(huagrahuma.dem, cellsize=25, degree=0.1)&lt;br /&gt;
  library(lattice)&lt;br /&gt;
  levelplot(dem.filled)&lt;br /&gt;
  &lt;br /&gt;
  difference &amp;lt;- dem.filled - huagrahuma.dem&lt;br /&gt;
  max(difference)&lt;br /&gt;
  min(difference)&lt;br /&gt;
  levelplot(difference)&lt;br /&gt;
&lt;br /&gt;
Topographic index calculation:&lt;br /&gt;
&lt;br /&gt;
  topidx &amp;lt;- atb(dem.filled, cellsize=25)&lt;br /&gt;
  class(topidx)&lt;br /&gt;
  str(topidx)&lt;br /&gt;
  levelplot(topidx$atb)&lt;br /&gt;
  levelplot(topidx$area)&lt;br /&gt;
&lt;br /&gt;
If you want, you can compare with the analysis on the non-filled DEM that contains obvious artefacts &lt;br /&gt;
&lt;br /&gt;
  old &amp;lt;- atb(huagrahuma.dem, cellsize=25)&lt;br /&gt;
  levelplot(old$area)&lt;br /&gt;
  levelplot(topidx$area - old$area)&lt;br /&gt;
&lt;br /&gt;
Have a look at the potential outlet:&lt;br /&gt;
&lt;br /&gt;
  outlet(topidx$area,c(28,8),2)&lt;br /&gt;
&lt;br /&gt;
We know from manual catchment delineation (on a topographic map) that the area of the catchment is around 2.4 km2, so the following cells are likely to contain the outlet: c(28,8); c(29,8); c(29,9). Just try them out with the subcatch() function and take the one you like.&lt;br /&gt;
&lt;br /&gt;
  catchment &amp;lt;- subcatch(dem.filled, c(29,8)) &lt;br /&gt;
  image(catchment)&lt;br /&gt;
  catchment[catchment == 0] &amp;lt;- NA&lt;br /&gt;
&lt;br /&gt;
  flowlength &amp;lt;- flowlength(dem.filled, c(29,8))&lt;br /&gt;
&lt;br /&gt;
Headwater cells are identified on the basis of a topographic index&lt;br /&gt;
or an accumulation area threshold. This is an “intuitive” choice:&lt;br /&gt;
&lt;br /&gt;
  rivers &amp;lt;- river(dem.filled,topidx$atb,topidx$area,cellsize=25,thatb=12.35,tharea=10000)&lt;br /&gt;
  image(rivers)&lt;br /&gt;
&lt;br /&gt;
Play around with the values of thatb and tharea and look at the impact…&lt;br /&gt;
&lt;br /&gt;
Mask the rivers and topographic index maps outside the catchment:&lt;br /&gt;
&lt;br /&gt;
  rivers &amp;lt;- rivers * catchment&lt;br /&gt;
  topidxmap &amp;lt;- topidx$atb * catchment&lt;br /&gt;
&lt;br /&gt;
And make topographic index classes which can be used with topmodel.&lt;br /&gt;
&lt;br /&gt;
  classes &amp;lt;- make.classes(topidxmap,16)&lt;br /&gt;
  plot(classes)&lt;br /&gt;
&lt;br /&gt;
The object ''classes'' can be used as input for [[topmodel]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=6027</id>
		<title>Running Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=6027"/>
		<updated>2009-02-12T16:26:24Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Topmodel is a conceptual semi-distributed model developed for shallow, mountainous catchments. Despite being about 30 years old, it is still widely used. Nevertheless it is highly recommended to study the theory behind the model before applying it in any hydrological study. Some good resources are given in the references section below.&lt;br /&gt;
&lt;br /&gt;
===Important note===&lt;br /&gt;
&lt;br /&gt;
In its current stage, the model does very little checking of input data. Feeding the function with unrealistic parameter values, such as very small channel flows (&amp;lt;50 m / hour) are known to crash the underlying compiled libraries (and probably R with it). So be careful (and let me know any problems you come across)!&lt;br /&gt;
&lt;br /&gt;
===Packages and data===&lt;br /&gt;
&lt;br /&gt;
Topmodel is part of the [[topmodel]] package (duh!). A set of example data are available from a small mountainous catchment in the Ecuadorian Andes with the unpronouncable name ''Huagrahuma''.&lt;br /&gt;
&lt;br /&gt;
  library(topmodel)&lt;br /&gt;
  data(huagrahuma)&lt;br /&gt;
  attach(huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Running the model===&lt;br /&gt;
&lt;br /&gt;
Topmodel needs the following parameters:&lt;br /&gt;
&lt;br /&gt;
* qs0 = Initial subsurface flow per unit area [m]&lt;br /&gt;
* lnTe = log of the areal average of T0 [m2/h]&lt;br /&gt;
* m = Model parameter [m]&lt;br /&gt;
* Sr0 = Initial root zone storage deficit [m]&lt;br /&gt;
* Srmax = Maximum root zone storage deficit [m]&lt;br /&gt;
* td = Unsaturated zone time delay per unit storage deficit [h/m]&lt;br /&gt;
* vch = channel flow outside the catchment catchment [m/h]&lt;br /&gt;
* vr = channel flow inside catchment [m/h]&lt;br /&gt;
* k0 = Surface hydraulic conductivity [m/h]&lt;br /&gt;
* CD = capillary drive, see Morel-Seytoux and Khanji (1974) [m]&lt;br /&gt;
* dt = The timestep [hours]&lt;br /&gt;
&lt;br /&gt;
We need to construct a vector with the parameter values (the order is important):&lt;br /&gt;
&lt;br /&gt;
   parameters&amp;lt;-c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)&lt;br /&gt;
&lt;br /&gt;
(good values for the example catchment come with the Huagrahuma dataset)&lt;br /&gt;
&lt;br /&gt;
Then the model is run with the inputs described above:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters, topidx, delay, rain, ET0)&lt;br /&gt;
&lt;br /&gt;
===Special features===&lt;br /&gt;
&lt;br /&gt;
* The model can be run with several parameter sets at the time. Then &amp;quot;parameters&amp;quot; should be a 2-dimensional matrix with a parameter set in each row.&lt;br /&gt;
&lt;br /&gt;
* The Nash-Sutcliffe efficiency is calculated directly when observed discharge (&amp;quot;Qobs&amp;quot;) is passed to the function:&lt;br /&gt;
&lt;br /&gt;
   NS &amp;lt;- topmodel(parameters, topidx, delay, rain ,ET0, Qobs = Qobs)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K. J., Kirkby, M. J., 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24, 43-69.&lt;br /&gt;
* Beven K, Lamb R, Quinn P, Romanowicz R, Freer J, 1995. TOPMODEL. In: Sing VP (Ed), Computer Models of Watershed Hydrology. Water Resources Publications, Colorado. pp. 627-668.&lt;br /&gt;
* Morel-Seytoux, H.J., Khanji, J., 1974. Derivation of an Equation of Infiltration. Water Resources Research, 10, 795-800.&lt;br /&gt;
* Beven, K., 1984. Infiltration into a Class of Vertically Non-Uniform Soils. Hydrological Sciences Journal 29, 425-434.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=6026</id>
		<title>Running Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=6026"/>
		<updated>2009-02-12T16:11:47Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Topmodel is a conceptual semi-distributed model developed for shallow, mountainous catchments. Despite being about 30 years old, it is still widely used. Nevertheless it is highly recommended to study the theory behind the model before applying it in any hydrological study. Some good resources are given in the references section below.&lt;br /&gt;
&lt;br /&gt;
===Important note===&lt;br /&gt;
&lt;br /&gt;
In its current stage, the model does very little checking of input data. Feeding the function with unrealistic parameter values, such as very small channel flows (&amp;lt;50 m / hour) are known to crash the underlying compiled libraries (and probably R with it). So be careful (and let me know any problems you come across)!&lt;br /&gt;
&lt;br /&gt;
===Packages and data===&lt;br /&gt;
&lt;br /&gt;
Topmodel is part of the [[topmodel]] package (duh!). A set of example data are available from a small mountainous catchment in the Ecuadorian Andes with the unpronouncable name ''Huagrahuma''.&lt;br /&gt;
&lt;br /&gt;
  library(topmodel)&lt;br /&gt;
  data(Huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Running the model===&lt;br /&gt;
&lt;br /&gt;
Topmodel needs the following parameters:&lt;br /&gt;
&lt;br /&gt;
* qs0 = Initial subsurface flow per unit area [m]&lt;br /&gt;
* lnTe = log of the areal average of T0 [m2/h]&lt;br /&gt;
* m = Model parameter [m]&lt;br /&gt;
* Sr0 = Initial root zone storage deficit [m]&lt;br /&gt;
* Srmax = Maximum root zone storage deficit [m]&lt;br /&gt;
* td = Unsaturated zone time delay per unit storage deficit [h/m]&lt;br /&gt;
* vch = channel flow outside the catchment catchment [m/h]&lt;br /&gt;
* vr = channel flow inside catchment [m/h]&lt;br /&gt;
* k0 = Surface hydraulic conductivity [m/h]&lt;br /&gt;
* CD = capillary drive, see Morel-Seytoux and Khanji (1974) [m]&lt;br /&gt;
* dt = The timestep [hours]&lt;br /&gt;
&lt;br /&gt;
We need to construct a vector with the parameter values (the order is important):&lt;br /&gt;
&lt;br /&gt;
   parameters&amp;lt;-c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)&lt;br /&gt;
&lt;br /&gt;
(good values for the example catchment come with the Huagrahuma dataset)&lt;br /&gt;
&lt;br /&gt;
Then the model is run with the inputs described above:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters, topidx, delay, rain, ET0)&lt;br /&gt;
&lt;br /&gt;
===Special features===&lt;br /&gt;
&lt;br /&gt;
* The model can be run with several parameter sets at the time. Then &amp;quot;parameters&amp;quot; should be a 2-dimensional matrix with a parameter set in each row.&lt;br /&gt;
&lt;br /&gt;
* The Nash-Sutcliffe efficiency is calculated directly when observed discharge (&amp;quot;Qobs&amp;quot;) is passed to the function:&lt;br /&gt;
&lt;br /&gt;
   NS &amp;lt;- topmodel(parameters, topidx, delay, rain ,ET0, Qobs = Qobs)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K. J., Kirkby, M. J., 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24, 43-69.&lt;br /&gt;
* Beven K, Lamb R, Quinn P, Romanowicz R, Freer J, 1995. TOPMODEL. In: Sing VP (Ed), Computer Models of Watershed Hydrology. Water Resources Publications, Colorado. pp. 627-668.&lt;br /&gt;
* Morel-Seytoux, H.J., Khanji, J., 1974. Derivation of an Equation of Infiltration. Water Resources Research, 10, 795-800.&lt;br /&gt;
* Beven, K., 1984. Infiltration into a Class of Vertically Non-Uniform Soils. Hydrological Sciences Journal 29, 425-434.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=6025</id>
		<title>RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=6025"/>
		<updated>2009-02-12T11:19:22Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
RHydro is a set of topographical analysis tools that are not dissimilar to the ArcGIS ArcHydro toolbox (but more modest in scope). They are originally based on the [http://www.es.lancs.ac.uk/hfdg/freeware/hfdg_freeware_dta.htm DTM-ANALYSIS program] from the hydrology group at Lancaster University. &lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Digital terrain analysis with RHydro]] page.&lt;br /&gt;
&lt;br /&gt;
RHydro is experimental software and comes without any warranty. Currently it does not do much input checking but should be fairly safe if used correctly.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.1.zip Windows]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.1.tgz MacOSX]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.1.tar.gz Linux]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installation can be done via the packages menu (install local packages from zip files) or directly from the command line with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;RHydro_0.1.1.zip&amp;quot;, repos=NULL)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(RHydro)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* atb()&lt;br /&gt;
* flowlength()&lt;br /&gt;
* outlet()&lt;br /&gt;
* river()&lt;br /&gt;
* sinkfind()&lt;br /&gt;
* subcatch()&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=6024</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=6024"/>
		<updated>2009-02-11T14:54:57Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Topmodel is available from the [http://cran.r-project.org/mirrors.html Comprehensive R Archive Network]. It can be installed directly from within R with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;topmodel&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* ''infiltration()'' gives direct access to the Green-Ampt infiltration routine used by topmodel&lt;br /&gt;
* ''make.classes()'' makes topographic index classes from a topographic index map&lt;br /&gt;
* ''NSeff()'' calculates the Nash-Sutcliffe efficiency&lt;br /&gt;
* ''topidx()'' calculates the topographic index from a raster DEM&lt;br /&gt;
* ''topmodel()'' implements the original model&lt;br /&gt;
&lt;br /&gt;
==Raw libraries==&lt;br /&gt;
&lt;br /&gt;
The package is in fact a wrapper around a set of C libraries. This makes it easy to recycle the libraries and link them in C programs or other languages (Fortran, C++, Python, ...). For access to the libraries, download the [http://cran.r-project.org/src/contrib/topmodel_0.5.tar.gz source package], extract it, and look into the src/ subdirectory.&lt;br /&gt;
&lt;br /&gt;
Only the file topmodel.c contains some R-specific functions (they start with R_) related to output in the R console. This file implements the monte-carlo simulation. The model itself can be found in core_topmodel.c and subroutines.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6022</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=6022"/>
		<updated>2009-02-11T10:41:00Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     ./make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include -lm&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the time at which output is shown on the screen while the model is running, and may cover many hydrological time steps. ''w'' is a vector of results at this timestep.&lt;br /&gt;
&lt;br /&gt;
TODO: where is ''tout'' defined, and we may want to check the above is correct by altering ''tout''. This should only have an impact on what is shown on the screen, but not on the final model results&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6001</id>
		<title>Remote sensing data</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6001"/>
		<updated>2009-02-05T10:46:11Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Remote Sensing]]&lt;br /&gt;
&lt;br /&gt;
== Overview of remote sensing data that may be useful for hydrological analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Spectrometer ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!channels!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]  ||MERIS   ||15||March 2002||260x290m||Visible and Near Infrared spectrum (390 to 1040 nm), cloud cover, water bodies, frequency 3 days (higher at the poles)&lt;br /&gt;
|-&lt;br /&gt;
|NASA&lt;br /&gt;
|TIROS-N&lt;br /&gt;
|AVHRR&lt;br /&gt;
|4&lt;br /&gt;
| &amp;lt;!-- launch data unknown --&amp;gt;&lt;br /&gt;
|1.09x1.09km&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;| http://www.nsof.class.noaa.gov. &amp;lt;br/&amp;gt; Can be used for cloud cover (Bendix et al.), surface temperature (ref), delineation of water bodies (Zhou et al., 2000)&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-7||AVHRR||5||         ||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-15||AVHRR||6||May 1998||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-16||AVHRR||6||Sep 2000||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-17||AVHRR||6||Jun 2002||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-18||AVHRR||6||May 2005||&lt;br /&gt;
|-&lt;br /&gt;
|Eumetsat||METOP||AVHRR||?||||||cloud cover, surface temperature&lt;br /&gt;
|-&lt;br /&gt;
|NASA||EOS AQUA ||AMSR-E  ||||||||??&lt;br /&gt;
|-&lt;br /&gt;
|ESA||MSG-1 &amp;amp; 2 (Meteosat-8 &amp;amp; 9)||SEVIRI||12||2002||||Spinning Enhanced Visible and Infrared Imager. [[http://www.eumetsat.int/Home/Main/Access_to_Data/Meteosat_Image_Services/SP_1123237865326 Africa and Europe]] @ 15 minutes. 8 channels can be used for monitoring the earth surface. Channel 12 is a high resolution visible (hrv) channel. Resolution: 3 km at the sub-satellite point (5 – 6 km over Europe). Channel 12 has a resolution of 1 km at the sub-satellite point (1.5 – 2 km over Europe). Can be used for precipitation (see e.g. Thies et al. doi:10.1029/2008JD010464)&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TRMM||??||||||25x25km (0.25°)|| rainfall&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA||ASTER||[http://en.wikipedia.org/wiki/Advanced_Spaceborne_Thermal_Emission_and_Reflection_Radiometer 15]||1999||15-90m||temperature, reflectance, elevation, land use. On demand; some images exist for the Andes&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA/AQUA||[http://en.wikipedia.org/wiki/MODIS MODIS]||36||1999/2002||see notes||http://www.landcover.org, spatial resolution: 250 m (bands 1-2) 500 m (bands 3-7) 1000 m (bands 8-36), temporal resolution 1 to 2 days, visible and near infrared (400 to 14400 nm)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== radar ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||ASAR    ||March 2002||30m||APG HH and HV -&amp;gt; delineation of water bodies&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||Altimeter||March 2002||400m||altitude (only 1 dimension)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-1 RADARSAT-1]||ASAR||November 1995||10m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-2 RADARSAT-2]||ASAR||December 2007||3m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|ASI||[http://en.wikipedia.org/wiki/COSMO-SkyMed COSMO-SkyMed]||SAR||June 2007|| || Constellation of 4 satellites&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== other ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One that has not gone up yet: [http://bprc.osu.edu/water/index.php SWOT]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data aquisition ==&lt;br /&gt;
&lt;br /&gt;
=== ESA ===&lt;br /&gt;
&lt;br /&gt;
ESA is a very big engine and it is tricky to find what you are actually looking for or what you need but there is lots:&lt;br /&gt;
&lt;br /&gt;
The following link is a shortcut to ESA's 'Resources' page that includes upcoming workshops, the ESA library, data samples and archives, and probably most useful for anyone working with ESA data, there are ESA-tailored software tools that run free-of-charge on Windows, linux and also MacOS (although mac versions are usually appearing a bit later than the other two!): http://earth.esa.int/resources/&lt;br /&gt;
P.S. I attended an ESA Land Training course in Lisbon in September 2007 on Flooding/Soil moisture and Forests and have lots of lecture notes on ASAR, ALOS and how to use these data with the BEST, BEAM and POLSARPRO packages (I have actually worked with an ALOS quadpol for tree height and soil moisture retrieval: amazing data!). &lt;br /&gt;
If you want any of these notes or some help, just email me (guy.schumann@bristol.ac.uk) and I'll try to help!  &lt;br /&gt;
 &lt;br /&gt;
There is a useful tool from the ESA website to search for available images (does ENVISAT and others):&lt;br /&gt;
&lt;br /&gt;
http://eoli.esa.int/&lt;br /&gt;
&lt;br /&gt;
To access online (last 7-10 days) data and submit CAT-1 (free data) proposals for projects: &lt;br /&gt;
&lt;br /&gt;
http://earth.esa.int/dataproducts/accessingeodata/&lt;br /&gt;
&lt;br /&gt;
To answer third party mission (from non-ESA satellites) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist, and go to the 'TPM' link to the left of the page,&lt;br /&gt;
&lt;br /&gt;
and AO (Announcement of Opportunities) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist&lt;br /&gt;
&lt;br /&gt;
=== ESA conferences and workshops ===&lt;br /&gt;
&lt;br /&gt;
Anyone interested in this year's (2008) ESA summer school in August (4-14) at the ESRIN centre in Italy? Topic: Data assimilation, monitoring and modelling the Earth System. Have a look at: http://envisat.esa.int/envschool/&lt;br /&gt;
&lt;br /&gt;
== Detailed info on satellites ==&lt;br /&gt;
&lt;br /&gt;
=== meteosat ===&lt;br /&gt;
&lt;br /&gt;
The channels of SEVERI on board meteosat-8 (spectral band / μm)&lt;br /&gt;
&lt;br /&gt;
(from http://las.physik.uni-oldenburg.de/eProceedings/vol05_1/05_1_de-ruyter1.pdf)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
!Channel!!min!!max!!description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0.635 || 0.56 || 0.71 visual&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 0.81 || 0.74 || 0.88 visual&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 1.64 || 1.50 || 1.78 near infrared&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 3.90 || 3.48 || 4.36 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 6.25 || 5.35 || 7.15 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 7.35 || 6.85 || 7.85 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 8.70 || 8.30 || 9.1 infrared&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 9.66 || 9.38 || 9.94 infrared (ozone absorption)&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 10.80 || 9.80 || 11.80 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 12.00 || 11.00 || 13.00 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 13.40 || 12.40 || 14.40 infrared (CO2 absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0.75 || 0.60 || 0.90 high resolution visual broadband (hrv)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Processing ==&lt;br /&gt;
&lt;br /&gt;
=== Envisat altimeter ===&lt;br /&gt;
&lt;br /&gt;
Some information that may make life easier when dealing with ESA's altimeter N1 files:&lt;br /&gt;
&lt;br /&gt;
* ESA's [http://earth.esa.int/brat/html/data/toolbox_en.html Basic Radar Altimeter Toolbox] provides a set of tools and an interface for extracting data from the original N1 files. The interface is broken on recent linux versions due to obsolete dependencies but the command line tools work.  &lt;br /&gt;
&lt;br /&gt;
* The XY extraction utility (BratCreateZFXY) does not seem capable of extracting the original data directly. It requires a predefined raster size and automatically interpolates before exporting.&lt;br /&gt;
&lt;br /&gt;
* BratCreateYFX extracts the measurements in the original resolution. However it only includes one dimension so you have to add the other one manually as a dataset. Something like this in the parameter file:&lt;br /&gt;
&lt;br /&gt;
     # longitude&lt;br /&gt;
     X=lon&lt;br /&gt;
     X_NAME=X&lt;br /&gt;
     X_TYPE=Longitude&lt;br /&gt;
     X_UNIT=degrees_east&lt;br /&gt;
     X_TITLE=X&lt;br /&gt;
     # latitude&lt;br /&gt;
     FIELD=lat&lt;br /&gt;
     FIELD_NAME=Y&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=count&lt;br /&gt;
     FIELD_TITLE=Y&lt;br /&gt;
     # data of interest follow&lt;br /&gt;
     FIELD=alt_cog_ellip&lt;br /&gt;
     FIELD_NAME=alt_cog_ellip&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=mm&lt;br /&gt;
     FIELD_TITLE=alt_cog_ellip&lt;br /&gt;
&lt;br /&gt;
* Extracting many fields from many files is '''much''' easier using the command line tools and a batch script. &lt;br /&gt;
&lt;br /&gt;
== downscaling techniques ==&lt;br /&gt;
&lt;br /&gt;
=== statistical ===&lt;br /&gt;
&lt;br /&gt;
singular vector decomposition&lt;br /&gt;
&lt;br /&gt;
Bretherton CS, Smith C, Wallace JM. 1992. An intercomparison of methods for finding coupled patterns in climate data. Journal of Wilks DS. 1995. Statistical Methods in the Atmospheric Sciences. Climate 5: 541–560&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== dynamical ===&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6000</id>
		<title>Remote sensing data</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Remote_sensing_data&amp;diff=6000"/>
		<updated>2009-02-05T10:45:37Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Remote Sensing]]&lt;br /&gt;
&lt;br /&gt;
== Overview of remote sensing data that may be useful for hydrological analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Spectrometer ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!channels!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]  ||MERIS   ||15||March 2002||260x290m||Visible and Near Infrared spectrum (390 to 1040 nm), cloud cover, water bodies, frequency 3 days (higher at the poles)&lt;br /&gt;
|-&lt;br /&gt;
|NASA&lt;br /&gt;
|TIROS-N&lt;br /&gt;
|AVHRR&lt;br /&gt;
|4&lt;br /&gt;
| &amp;lt;!-- launch data unknown --&amp;gt;&lt;br /&gt;
|1.09x1.09km&lt;br /&gt;
| rowspan=&amp;quot;6&amp;quot; valign=&amp;quot;top&amp;quot;| http://www.nsof.class.noaa.gov. &amp;lt;br/&amp;gt; Can be used for cloud cover (Bendix et al.), surface temperature (ref), delineation of water bodies (Zhou et al., 2000)&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-7||AVHRR||5||         ||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-15||AVHRR||6||May 1998||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-16||AVHRR||6||Sep 2000||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-17||AVHRR||6||Jun 2002||&lt;br /&gt;
|-&lt;br /&gt;
|NOAA||NOAA-18||AVHRR||6||May 2005||&lt;br /&gt;
|-&lt;br /&gt;
|Eumetsat||METOP||AVHRR||?||||||cloud cover, surface temperature&lt;br /&gt;
|-&lt;br /&gt;
|NASA||EOS AQUA ||AMSR-E  ||||||||??&lt;br /&gt;
|-&lt;br /&gt;
|ESA||MSG-1 &amp;amp; 2 (Meteosat-8 &amp;amp; 9)||SEVIRI||12||2002||||Spinning Enhanced Visible and Infrared Imager. [[http://www.eumetsat.int/Home/Main/Access_to_Data/Meteosat_Image_Services/SP_1123237865326 Africa and Europe]] @ 15 minutes. 8 channels can be used for monitoring the earth surface. Channel 12 is a high resolution visible (hrv) channel. Resolution: 3 km at the sub-satellite point (5 – 6 km over Europe). Channel 12 has a resolution of 1 km at the sub-satellite point (1.5 – 2 km over Europe). Can be used for precipitation (see e.g. Thiess et al. doi:10.1029/2008JD010464)&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TRMM||??||||||25x25km (0.25°)|| rainfall&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA||ASTER||[http://en.wikipedia.org/wiki/Advanced_Spaceborne_Thermal_Emission_and_Reflection_Radiometer 15]||1999||15-90m||temperature, reflectance, elevation, land use. On demand; some images exist for the Andes&lt;br /&gt;
|-&lt;br /&gt;
|NASA||TERRA/AQUA||[http://en.wikipedia.org/wiki/MODIS MODIS]||36||1999/2002||see notes||http://www.landcover.org, spatial resolution: 250 m (bands 1-2) 500 m (bands 3-7) 1000 m (bands 8-36), temporal resolution 1 to 2 days, visible and near infrared (400 to 14400 nm)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== radar ===&lt;br /&gt;
&lt;br /&gt;
{|border = &amp;quot;1&amp;quot;&lt;br /&gt;
!Institute!!Satellite!!Sensor!!launched!!resolution!!Notes&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||ASAR    ||March 2002||30m||APG HH and HV -&amp;gt; delineation of water bodies&lt;br /&gt;
|-&lt;br /&gt;
|ESA ||[http://en.wikipedia.org/wiki/Envisat ENVISAT]||Altimeter||March 2002||400m||altitude (only 1 dimension)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-1 RADARSAT-1]||ASAR||November 1995||10m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|MDA||[http://en.wikipedia.org/wiki/RADARSAT-2 RADARSAT-2]||ASAR||December 2007||3m||commercial (Canadian private company)&lt;br /&gt;
|-&lt;br /&gt;
|ASI||[http://en.wikipedia.org/wiki/COSMO-SkyMed COSMO-SkyMed]||SAR||June 2007|| || Constellation of 4 satellites&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== other ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One that has not gone up yet: [http://bprc.osu.edu/water/index.php SWOT]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data aquisition ==&lt;br /&gt;
&lt;br /&gt;
=== ESA ===&lt;br /&gt;
&lt;br /&gt;
ESA is a very big engine and it is tricky to find what you are actually looking for or what you need but there is lots:&lt;br /&gt;
&lt;br /&gt;
The following link is a shortcut to ESA's 'Resources' page that includes upcoming workshops, the ESA library, data samples and archives, and probably most useful for anyone working with ESA data, there are ESA-tailored software tools that run free-of-charge on Windows, linux and also MacOS (although mac versions are usually appearing a bit later than the other two!): http://earth.esa.int/resources/&lt;br /&gt;
P.S. I attended an ESA Land Training course in Lisbon in September 2007 on Flooding/Soil moisture and Forests and have lots of lecture notes on ASAR, ALOS and how to use these data with the BEST, BEAM and POLSARPRO packages (I have actually worked with an ALOS quadpol for tree height and soil moisture retrieval: amazing data!). &lt;br /&gt;
If you want any of these notes or some help, just email me (guy.schumann@bristol.ac.uk) and I'll try to help!  &lt;br /&gt;
 &lt;br /&gt;
There is a useful tool from the ESA website to search for available images (does ENVISAT and others):&lt;br /&gt;
&lt;br /&gt;
http://eoli.esa.int/&lt;br /&gt;
&lt;br /&gt;
To access online (last 7-10 days) data and submit CAT-1 (free data) proposals for projects: &lt;br /&gt;
&lt;br /&gt;
http://earth.esa.int/dataproducts/accessingeodata/&lt;br /&gt;
&lt;br /&gt;
To answer third party mission (from non-ESA satellites) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist, and go to the 'TPM' link to the left of the page,&lt;br /&gt;
&lt;br /&gt;
and AO (Announcement of Opportunities) calls: http://eopi.esa.int/esa/esa?type=10&amp;amp;cmd=aolist&lt;br /&gt;
&lt;br /&gt;
=== ESA conferences and workshops ===&lt;br /&gt;
&lt;br /&gt;
Anyone interested in this year's (2008) ESA summer school in August (4-14) at the ESRIN centre in Italy? Topic: Data assimilation, monitoring and modelling the Earth System. Have a look at: http://envisat.esa.int/envschool/&lt;br /&gt;
&lt;br /&gt;
== Detailed info on satellites ==&lt;br /&gt;
&lt;br /&gt;
=== meteosat ===&lt;br /&gt;
&lt;br /&gt;
The channels of SEVERI on board meteosat-8 (spectral band / μm)&lt;br /&gt;
&lt;br /&gt;
(from http://las.physik.uni-oldenburg.de/eProceedings/vol05_1/05_1_de-ruyter1.pdf)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
!Channel!!min!!max!!description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0.635 || 0.56 || 0.71 visual&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 0.81 || 0.74 || 0.88 visual&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 1.64 || 1.50 || 1.78 near infrared&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 3.90 || 3.48 || 4.36 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 6.25 || 5.35 || 7.15 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 7.35 || 6.85 || 7.85 infrared (water vapour absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 8.70 || 8.30 || 9.1 infrared&lt;br /&gt;
|-&lt;br /&gt;
|  8 || 9.66 || 9.38 || 9.94 infrared (ozone absorption)&lt;br /&gt;
|-&lt;br /&gt;
|  9 || 10.80 || 9.80 || 11.80 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 10 || 12.00 || 11.00 || 13.00 infrared&lt;br /&gt;
|-&lt;br /&gt;
| 11 || 13.40 || 12.40 || 14.40 infrared (CO2 absorption)&lt;br /&gt;
|-&lt;br /&gt;
| 12 || 0.75 || 0.60 || 0.90 high resolution visual broadband (hrv)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Processing ==&lt;br /&gt;
&lt;br /&gt;
=== Envisat altimeter ===&lt;br /&gt;
&lt;br /&gt;
Some information that may make life easier when dealing with ESA's altimeter N1 files:&lt;br /&gt;
&lt;br /&gt;
* ESA's [http://earth.esa.int/brat/html/data/toolbox_en.html Basic Radar Altimeter Toolbox] provides a set of tools and an interface for extracting data from the original N1 files. The interface is broken on recent linux versions due to obsolete dependencies but the command line tools work.  &lt;br /&gt;
&lt;br /&gt;
* The XY extraction utility (BratCreateZFXY) does not seem capable of extracting the original data directly. It requires a predefined raster size and automatically interpolates before exporting.&lt;br /&gt;
&lt;br /&gt;
* BratCreateYFX extracts the measurements in the original resolution. However it only includes one dimension so you have to add the other one manually as a dataset. Something like this in the parameter file:&lt;br /&gt;
&lt;br /&gt;
     # longitude&lt;br /&gt;
     X=lon&lt;br /&gt;
     X_NAME=X&lt;br /&gt;
     X_TYPE=Longitude&lt;br /&gt;
     X_UNIT=degrees_east&lt;br /&gt;
     X_TITLE=X&lt;br /&gt;
     # latitude&lt;br /&gt;
     FIELD=lat&lt;br /&gt;
     FIELD_NAME=Y&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=count&lt;br /&gt;
     FIELD_TITLE=Y&lt;br /&gt;
     # data of interest follow&lt;br /&gt;
     FIELD=alt_cog_ellip&lt;br /&gt;
     FIELD_NAME=alt_cog_ellip&lt;br /&gt;
     FIELD_TYPE=Data&lt;br /&gt;
     FIELD_UNIT=mm&lt;br /&gt;
     FIELD_TITLE=alt_cog_ellip&lt;br /&gt;
&lt;br /&gt;
* Extracting many fields from many files is '''much''' easier using the command line tools and a batch script. &lt;br /&gt;
&lt;br /&gt;
== downscaling techniques ==&lt;br /&gt;
&lt;br /&gt;
=== statistical ===&lt;br /&gt;
&lt;br /&gt;
singular vector decomposition&lt;br /&gt;
&lt;br /&gt;
Bretherton CS, Smith C, Wallace JM. 1992. An intercomparison of methods for finding coupled patterns in climate data. Journal of Wilks DS. 1995. Statistical Methods in the Atmospheric Sciences. Climate 5: 541–560&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== dynamical ===&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=5997</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=5997"/>
		<updated>2009-02-02T19:48:16Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory. Note: we do not need to install the library (''make install'') since we will just copy the static libraries for use in threw.&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     ./make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (''libsundials_cvode.a'' and ''libsundials_nvecserial.a'') into the ''src'' directory of the THREW model. You may now throw away the cvode-2.5.0/ folder since both files (which are static libraries) contain all the functionality we need.&lt;br /&gt;
&lt;br /&gt;
* Now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include&lt;br /&gt;
&lt;br /&gt;
Why do we need to patch the solver? Only one thing changes: after each hydrological time step the function ''W2Flux()'' is executed. This is necessary to add external fluxes, such as rain. In its original form, the solver solves a differential equation from a certain initial state without further external intervention. In a hydrological model however, we may need to update the internal states after each timestep, for instance by adding rain, or taking away evapotranspiration. This is what ''W2Flux()'' does.&lt;br /&gt;
&lt;br /&gt;
== the solver ==&lt;br /&gt;
&lt;br /&gt;
Get your head around the solver in threw takes a bit of time. Here is a little explanation of what actually happens.&lt;br /&gt;
&lt;br /&gt;
The core of the solver is the following line in threw2.c:&lt;br /&gt;
&lt;br /&gt;
     CVode(cvode_mem, tout, w, &amp;amp;t, CV_NORMAL)&lt;br /&gt;
&lt;br /&gt;
This function solves the differential equations up to time ''tout''. ''tout'' is the time at which output is shown on the screen while the model is running, and may cover many hydrological time steps. ''w'' is a vector of results at this timestep.&lt;br /&gt;
&lt;br /&gt;
TODO: where is ''tout'' defined, and we may want to check the above is correct by altering ''tout''. This should only have an impact on what is shown on the screen, but not on the final model results&lt;br /&gt;
&lt;br /&gt;
All the data for running the model are stored in the structure ''cvode_mem''. This is a very complex structure that is understood by the solver. It contains everything from model state variables, parameters, as well as the 'right hand side function'. It is this function that is solved by the solver. It is basically the entire hydrological model, represented as a set of differential equations. In the threw code, the function is constructed in threw_f.c. It ''contains'' all the closure relations, which, individually, are defined in threw_closure.c.&lt;br /&gt;
&lt;br /&gt;
=== Structure of the RHS function ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
=== Structure of cvode_mem ===&lt;br /&gt;
&lt;br /&gt;
todo&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=5996</id>
		<title>REW</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=REW&amp;diff=5996"/>
		<updated>2009-02-02T17:15:37Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page collects information about the application of the Representative Elementary Watershed model.&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
C version maintained by Fuqiang Tian (University of Illinois)&lt;br /&gt;
&lt;br /&gt;
=== CREW ===&lt;br /&gt;
&lt;br /&gt;
FORTRAN version maintained by Haksu Lee&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== THREW ===&lt;br /&gt;
&lt;br /&gt;
==== Macintosh / linux ====&lt;br /&gt;
&lt;br /&gt;
An easy way to install on mac and linux is by creating first static libraries for the solver and then linking those in the application. The advantage of this is that you don't need to recompile the solver each time you make changes to the model, which is quicker. Compiling it this way involves the following steps:&lt;br /&gt;
&lt;br /&gt;
* download the cvode solver from the [https://computation.llnl.gov/casc/sundials/download/download.html cvode/sundials website] At the time of writing that is cvode-2.5.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
* decompress cvode-2.5.0.tar.gz, and add the directory /include/threw/ from the threw model to ''cvode-2.5.0/include''. Replace the file ''cvode-2.5.0/src/cvode/cvode.c'' with the one included in the THREW model.&lt;br /&gt;
&lt;br /&gt;
* Compile the solver with the changes we just made. This can be done with the following commands from within the cvode-2.5.0 directory:&lt;br /&gt;
&lt;br /&gt;
     ./configure&lt;br /&gt;
     ./make&lt;br /&gt;
&lt;br /&gt;
* copy the static libraries, which reside in a hidden directory&lt;br /&gt;
&lt;br /&gt;
     cp src/cvode/.libs/libsundials_cvode.a ./&lt;br /&gt;
     cp src/nvec_ser/.libs/libsundials_nvecserial.a ./&lt;br /&gt;
&lt;br /&gt;
* then copy both files (libsundials_cvode.a and libsundials_nvecserial.a) into the ''src'' directory of the THREW model.&lt;br /&gt;
&lt;br /&gt;
* now you should be able to compile the threw model with the following command:&lt;br /&gt;
&lt;br /&gt;
     gcc -pipe threw_closure.c threw_error.c threw_f.c threw_init.c threw_io.c threw_utility.c threw2.c -o threw2 \&lt;br /&gt;
     -L. -lsundials_cvode -lsundials_nvecserial -I../include&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Developers and applications ==&lt;br /&gt;
&lt;br /&gt;
afaik, the following institutes / persons use a version of the REW model&lt;br /&gt;
&lt;br /&gt;
* University of Illinois at Urbana Champaign&lt;br /&gt;
* University of Bristol (Wouter Buytaert)&lt;br /&gt;
* T U Munchen&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=5934</id>
		<title>GLUE analysis</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=5934"/>
		<updated>2009-01-12T01:09:10Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
This is an example of R code to perform a Generalised Likelihood Uncertainty Estimation (GLUE) on a hydrological model. In the example we use [[topmodel]] (implemented as ''topmodel()'') on a catchment in the Ecuadorian Andes (Huagrahuma). Other models can be used as long as they are implemented as an R function.&lt;br /&gt;
&lt;br /&gt;
More examples and scripts for doing uncertainty analysis in R can be found on [http://www.glue-uncertainty.org/ Keith Beven's uncertainty pages].&lt;br /&gt;
&lt;br /&gt;
===Libraries ===&lt;br /&gt;
&lt;br /&gt;
Library Hmisc ([http://cran.r-project.org/web/packages/Hmisc/index.html CRAN]) is needed for the ''wgt.quantile()'' function. See ?wgt.quantile for details. &lt;br /&gt;
&lt;br /&gt;
   library(Hmisc)&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
   data(huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Procedure===&lt;br /&gt;
Sample parameter sets from a prior parameter distribution. This example uses the uniform distribution, which can be sampled with &amp;quot;runif()&amp;quot;. The parameters vch and psi are not used in this example but need to be initialised. For an explanation of the parameter values see the page on [[Running Topmodel]]. We take initially 1000 parameter sets. Depending on the performance of the model, many of them will be rejected as non-behavioural. If you end up with too few parameter behavioural parameter sets, you will need to increase your sample size.&lt;br /&gt;
&lt;br /&gt;
   qs0   &amp;lt;- runif(1000, min = 0.0001, max = 0.00025)&lt;br /&gt;
   lnTe  &amp;lt;- runif(1000, min = -2, max = 3)&lt;br /&gt;
   m     &amp;lt;- runif(1000, min = 0, max = 0.1)&lt;br /&gt;
   Sr0   &amp;lt;- runif(1000, min = 0, max = 0.2)&lt;br /&gt;
   Srmax &amp;lt;- runif(1000, min = 0, max = 0.1)&lt;br /&gt;
   td    &amp;lt;- runif(1000, min = 0, max = 3)&lt;br /&gt;
   vch   &amp;lt;- 1000&lt;br /&gt;
   vr    &amp;lt;- runif(1000, min = 100, max = 2500)&lt;br /&gt;
   k0    &amp;lt;- runif(1000, min = 0, max = 10)&lt;br /&gt;
   CD    &amp;lt;- runif(1000, min = 0, max = 5)&lt;br /&gt;
   dt    &amp;lt;- 0.25&lt;br /&gt;
   &lt;br /&gt;
   parameters &amp;lt;- cbind(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,psi,dtheta,dt)&lt;br /&gt;
&lt;br /&gt;
Now each row in the matrix ''parameters'' contains a sampled parameter set. Run the model for the calibration period with the each set to obtain the simulated discharge:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters[1,],topidx,delay,rain,ET0)&lt;br /&gt;
&lt;br /&gt;
Calculate the likelihood of this parameter set using the simulated and observed discharge. The choice of the likelihood function is up to the user, but the Nash - Sutcliffe efficiency is given here as an example:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
Decide whether the parameter set is behavioural or not and retain the parameter set if behavioural&lt;br /&gt;
&lt;br /&gt;
NOTE: in GLUE, this decision is subjective. For a more scientifically sound determination of the behavioural limit, see Beven (2006). Here we will use an efficiency of 0.6 as a threshold. The efficiency, parameter set and simulated discharge of a behavioural run are stored in resp. the objects ''total.eff'', ''total.param.set'' and ''total.qsim''&lt;br /&gt;
&lt;br /&gt;
   if(eff &amp;gt; 0.6) {&lt;br /&gt;
      total.eff &amp;lt;- c(total.eff,eff)&lt;br /&gt;
      behavioural.parameters &amp;lt;- cbind(behavioural.parameters,parameters)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
The above procedure should be repeated until enough behavioural runs are obtained (e.g. using a while()-loop)&lt;br /&gt;
&lt;br /&gt;
If the above code is used, each column of the matrix ''behavioural.parameters'' contains a behavioural parameter set. The corresponding performance is found at the same location in the vector ''total.eff''&lt;br /&gt;
&lt;br /&gt;
Rerun the model for the prediction period, using each of the behavioural parameter sets. The simulated discharges are stored in the columns of a matrix called predicted.qsim&lt;br /&gt;
&lt;br /&gt;
   predicted.qsim &amp;lt;- model(behavioural.parameters[,1], rain, ...)&lt;br /&gt;
   &lt;br /&gt;
   for(i in 2:dim(param.set)[2]) {&lt;br /&gt;
      qsim &amp;lt;- model(behavioural.parameters[,i], rain, ...)&lt;br /&gt;
      predicted.qsim &amp;lt;- cbind(predicted.obs,qobs)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
Normalise the efficiencies so that they sum up to 1:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- eff - 0.6&lt;br /&gt;
   eff &amp;lt;- eff/sum(eff)&lt;br /&gt;
&lt;br /&gt;
Calculate the quantiles for each timestep. Here we take the 0.05 and 0.95 quantiles, resulting in 90% prediction limits. &lt;br /&gt;
&lt;br /&gt;
   limits &amp;lt;- apply(Qsim,1,&amp;quot;wtd.quantile&amp;quot;, weights = Eff, probs = c(0.05,0.95), normwt=T)&lt;br /&gt;
&lt;br /&gt;
===Final notes===&lt;br /&gt;
&lt;br /&gt;
* If topmodel is used, some loops can be avoided. topmodel() can work on entire parameter set matrices, which makes things faster. It can also return the Nash-Sutcliffe efficiency directly (see the topmodel page)&lt;br /&gt;
* The procedure can be very memory intensive because all simulated discharges for all parameter sets are stored in memory (the matrix predicted.qsim). If the model can give output per timestep, the above procedure can be repeated for each timestep separately to reduce memory usage&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K., and Binley, A. The future of distributed models: Model calibration and uncertainty prediction. Hydrological Processes 6 (1992), 279-298.&lt;br /&gt;
* Beven, K. A manifesto for the equifinality thesis. Journal of Hydrology 320 (2006), 18-36.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=5933</id>
		<title>GLUE analysis</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GLUE_analysis&amp;diff=5933"/>
		<updated>2009-01-12T01:04:05Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
This is an example of R code to perform a Generalised Likelihood Uncertainty Estimation (GLUE) on a hydrological model. In the example we use [[topmodel]] (implemented as ''topmodel()'') on a catchment in the Ecuadorian Andes (Huagrahuma). Other models can be used as long as they are implemented as an R function.&lt;br /&gt;
&lt;br /&gt;
More examples and scripts for doing uncertainty analysis in R can be found on [http://www.glue-uncertainty.org/ Keith Beven's uncertainty pages].&lt;br /&gt;
&lt;br /&gt;
===Libraries ===&lt;br /&gt;
&lt;br /&gt;
Library Hmisc ([http://cran.r-project.org/web/packages/Hmisc/index.html CRAN]) is needed for the ''wgt.quantile()'' function. See ?wgt.quantile for details. &lt;br /&gt;
&lt;br /&gt;
   library(Hmisc)&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
   data(huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Procedure===&lt;br /&gt;
Sample a parameter set from a prior parameter distribution. This example uses the uniform distribution, which can be sampled with &amp;quot;runif()&amp;quot;. The parameters vch and psi are not used in this example but need to be initialised. For an explanation of the parameter values see the page on [[Running Topmodel]].&lt;br /&gt;
&lt;br /&gt;
   qs0   &amp;lt;- runif(1, min = 0.0001, max = 0.00025)&lt;br /&gt;
   lnTe  &amp;lt;- runif(1, min = -2, max = 3)&lt;br /&gt;
   m     &amp;lt;- runif(1, min = 0, max = 0.1)&lt;br /&gt;
   Sr0   &amp;lt;- runif(1, min = 0, max = 0.2)&lt;br /&gt;
   Srmax &amp;lt;- runif(1, min = 0, max = 0.1)&lt;br /&gt;
   td    &amp;lt;- runif(1, min = 0, max = 3)&lt;br /&gt;
   vch   &amp;lt;- 1000&lt;br /&gt;
   vr    &amp;lt;- runif(1, min = 100, max = 2500)&lt;br /&gt;
   k0    &amp;lt;- runif(1, min = 0, max = 10)&lt;br /&gt;
   CD    &amp;lt;- runif(1, min = 0, max = 5)&lt;br /&gt;
   dt    &amp;lt;- 0.25&lt;br /&gt;
   &lt;br /&gt;
   parameters &amp;lt;- c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,psi,dtheta,dt)&lt;br /&gt;
&lt;br /&gt;
Run the model for the calibration period with the generated parameter set to obtain the simulated discharge&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters,topidx,delay,rain,ET0)&lt;br /&gt;
&lt;br /&gt;
Calculate the likelihood of this parameter set using the simulated and observed discharge. The choice of the likelihood function is up to the user, but the Nash - Sutcliffe efficiency is given here as an example:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
Decide whether the parameter set is behavioural or not and retain the parameter set if behavioural&lt;br /&gt;
&lt;br /&gt;
NOTE: this decision is again subjective. For a more scientifically sound determination of the behavioural limit, see Beven (2006). Here we will use an efficiency of 0.6 as a threshold. The efficiency, parameter set and simulated discharge of a behavioural run are stored in resp. the objects ''total.eff'', ''total.param.set'' and ''total.qsim''&lt;br /&gt;
&lt;br /&gt;
   if(eff &amp;gt; 0.6) {&lt;br /&gt;
      total.eff &amp;lt;- c(total.eff,eff)&lt;br /&gt;
      behavioural.parameters &amp;lt;- cbind(behavioural.parameters,parameters)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
The above procedure should be repeated until enough behavioural runs are obtained (e.g. using a while()-loop)&lt;br /&gt;
&lt;br /&gt;
If the above code is used, each column of the matrix ''behavioural.parameters'' contains a behavioural parameter set. The corresponding performance is found at the same location in the vector ''total.eff''&lt;br /&gt;
&lt;br /&gt;
Rerun the model for the prediction period, using each of the behavioural parameter sets. The simulated discharges are stored in the columns of a matrix called predicted.qsim&lt;br /&gt;
&lt;br /&gt;
   predicted.qsim &amp;lt;- model(behavioural.parameters[,1], rain, ...)&lt;br /&gt;
   &lt;br /&gt;
   for(i in 2:dim(param.set)[2]) {&lt;br /&gt;
      qsim &amp;lt;- model(behavioural.parameters[,i], rain, ...)&lt;br /&gt;
      predicted.qsim &amp;lt;- cbind(predicted.obs,qobs)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
Normalise the efficiencies so that they sum up to 1:&lt;br /&gt;
&lt;br /&gt;
   eff &amp;lt;- eff - 0.6&lt;br /&gt;
   eff &amp;lt;- eff/sum(eff)&lt;br /&gt;
&lt;br /&gt;
Calculate the quantiles for each timestep. Here we take the 0.05 and 0.95 quantiles, resulting in 90% prediction limits. &lt;br /&gt;
&lt;br /&gt;
   limits &amp;lt;- apply(Qsim,1,&amp;quot;wtd.quantile&amp;quot;, weights = Eff, probs = c(0.05,0.95), normwt=T)&lt;br /&gt;
&lt;br /&gt;
===Final notes===&lt;br /&gt;
&lt;br /&gt;
* If topmodel is used, some loops can be avoided. topmodel() can work on entire parameter set matrices, which makes things faster. It can also return the Nash-Sutcliffe efficiency directly (see the topmodel page)&lt;br /&gt;
* The procedure can be very memory intensive because all simulated discharges for all parameter sets are stored in memory (the matrix predicted.qsim). If the model can give output per timestep, the above procedure can be repeated for each timestep separately to reduce memory usage&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K., and Binley, A. The future of distributed models: Model calibration and uncertainty prediction. Hydrological Processes 6 (1992), 279-298.&lt;br /&gt;
* Beven, K. A manifesto for the equifinality thesis. Journal of Hydrology 320 (2006), 18-36.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_the_topographical_index&amp;diff=5932</id>
		<title>Calculating the topographical index</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_the_topographical_index&amp;diff=5932"/>
		<updated>2009-01-11T01:03:24Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
===The topographic index===&lt;br /&gt;
&lt;br /&gt;
Some GIS programs can calculate the topographic index, but the [[Topmodel]]-package provides a function too. If you use the R function, you should delineate your catchment in your preferred GIS application and export a DEM of your catchment as a text file (ascii). Pixels outside the catchment area should be given a distinct value that can be set to NA in R.&lt;br /&gt;
&lt;br /&gt;
For now, the GIS functions of this package are quite limited. The DEM has to be imported as a matrix, which can then be processed by topidx(). Take for instance this minimalistic DEM, saved in a test file called &amp;quot;DEM.txt&amp;quot;. Values outside the catchment are given the value -9999 (this can be any other value):&lt;br /&gt;
&lt;br /&gt;
   -9999 -9999 828.9 835.6 -9999&lt;br /&gt;
   818.3 826.0 830.7 834.5 836.0&lt;br /&gt;
   817.1 824.0 825.2 833.3 836.9&lt;br /&gt;
   816.5 820.0 824.1 330.8 -9999&lt;br /&gt;
   810.7 815.6 822.2 -9999 -9999&lt;br /&gt;
&lt;br /&gt;
This file can be imported and processed in R with:&lt;br /&gt;
&lt;br /&gt;
   DEM &amp;lt;- read.table(&amp;quot;DEM.txt&amp;quot;)&lt;br /&gt;
   DEM &amp;lt;- as.matrix(DEM)&lt;br /&gt;
&lt;br /&gt;
remove the values outside the catchment:&lt;br /&gt;
&lt;br /&gt;
   DEM[DEM==-9999] &amp;lt;- NA&lt;br /&gt;
 &lt;br /&gt;
plot the DEM:&lt;br /&gt;
&lt;br /&gt;
   image(DEM)&lt;br /&gt;
&lt;br /&gt;
Calculate the topographic index. topidx() returns a list with two objects: atb and area. The first is the topographic index (a over tan b) and the second is the cumulative area a. In this case we are interested in atb:&lt;br /&gt;
&lt;br /&gt;
   topindex &amp;lt;- topidx(DEM, resolution=25)$atb&lt;br /&gt;
&lt;br /&gt;
Split the values into a set of classes, for instance for use with topmodel():&lt;br /&gt;
&lt;br /&gt;
   topidxclasses &amp;lt;- make.classes(topindex,16)&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=5847</id>
		<title>Running Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=5847"/>
		<updated>2008-11-21T17:54:05Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Topmodel is a conceptual semi-distributed model developed for shallow, mountainous catchments. Despite being about 30 years old, it is still widely used. Nevertheless it is highly recommended to study the theory behind the model before applying it in any hydrological study. Some good resources are given in the references section below.&lt;br /&gt;
&lt;br /&gt;
===Important note===&lt;br /&gt;
&lt;br /&gt;
In its current stage, the model does very little checking of input data. Feeding the function with unrealistic parameter values, such as very small channel flows (&amp;lt;50 m / hour) are known to crash the underlying compiled libraries (and probably R with it). So be careful (and let me know any problems you come across)!&lt;br /&gt;
&lt;br /&gt;
===Packages and data===&lt;br /&gt;
&lt;br /&gt;
Topmodel is part of the [[topmodel]] package (duh!). A set of example data are available from a small mountainous catchment in the Ecuadorian Andes with the unpronouncable name ''Huagrahuma''.&lt;br /&gt;
&lt;br /&gt;
  library(topmodel)&lt;br /&gt;
  data(Huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Running the model===&lt;br /&gt;
&lt;br /&gt;
Topmodel needs the following parameters:&lt;br /&gt;
&lt;br /&gt;
* qs0 = Initial subsurface flow per unit area [m]&lt;br /&gt;
* lnTe = log of the areal average of T0 [m2/h]&lt;br /&gt;
* m = Model parameter [m]&lt;br /&gt;
* Sr0 = Initial root zone storage deficit [m]&lt;br /&gt;
* Srmax = Maximum root zone storage deficit [m]&lt;br /&gt;
* td = Unsaturated zone time delay per unit storage deficit [h/m]&lt;br /&gt;
* vch = channel flow outside the catchment catchment [m/h]&lt;br /&gt;
* vr = channel flow inside catchment [m/h]&lt;br /&gt;
* k0 = Surface hydraulic conductivity [m/h]&lt;br /&gt;
* CD = capillary drive, see Morel-Seytoux and Khanji (1974) [m]&lt;br /&gt;
* dt = The timestep [hours]&lt;br /&gt;
&lt;br /&gt;
We need to construct a vector with the parameter values (the order is important):&lt;br /&gt;
&lt;br /&gt;
   parameters&amp;lt;-c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)&lt;br /&gt;
&lt;br /&gt;
(good values for the example catchment come with the Huagrahuma dataset)&lt;br /&gt;
&lt;br /&gt;
Then the model is run with the inputs described above:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters, topidx, delay, rain, ET0)&lt;br /&gt;
&lt;br /&gt;
===Special features===&lt;br /&gt;
&lt;br /&gt;
* The model can be run with several parameter sets at the time. Then &amp;quot;parameters&amp;quot; should be a 2-dimensional matrix with a parameter set in each row.&lt;br /&gt;
&lt;br /&gt;
* The Nash-Sutcliffe efficiency is calculated directly when observed discharge (&amp;quot;Qobs&amp;quot;) is passed to the function:&lt;br /&gt;
&lt;br /&gt;
   NS &amp;lt;- topmodel(parameters, topidx, delay, rain ,ET0, Qobs)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K. J., Kirkby, M. J., 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24, 43-69.&lt;br /&gt;
* Beven K, Lamb R, Quinn P, Romanowicz R, Freer J, 1995. TOPMODEL. In: Sing VP (Ed), Computer Models of Watershed Hydrology. Water Resources Publications, Colorado. pp. 627-668.&lt;br /&gt;
* Morel-Seytoux, H.J., Khanji, J., 1974. Derivation of an Equation of Infiltration. Water Resources Research, 10, 795-800.&lt;br /&gt;
* Beven, K., 1984. Infiltration into a Class of Vertically Non-Uniform Soils. Hydrological Sciences Journal 29, 425-434.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5656</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5656"/>
		<updated>2008-09-30T19:17:55Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may be contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Topmodel is available from the [http://cran.r-project.org/mirrors.html Comprehensive R Archive Network]. It can be installed directly from within R with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;topmodel&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* ''infiltration()'' gives direct access to the Green-Ampt infiltration routine used by topmodel&lt;br /&gt;
* ''make.classes()'' makes topographic index classes from a topographic index map&lt;br /&gt;
* ''NSeff()'' calculates the Nash-Sutcliffe efficiency&lt;br /&gt;
* ''topidx()'' calculates the topographic index from a raster DEM&lt;br /&gt;
* ''topmodel()'' implements the original model&lt;br /&gt;
&lt;br /&gt;
==Raw libraries==&lt;br /&gt;
&lt;br /&gt;
The package is in fact a wrapper around a set of C libraries. This makes it easy to recycle the libraries and link them in C programs or other languages (Fortran, C++, Python, ...). For access to the libraries, download the [http://cran.r-project.org/src/contrib/topmodel_0.5.tar.gz source package], extract it, and look into the src/ subdirectory.&lt;br /&gt;
&lt;br /&gt;
Only the file topmodel.c contains some R-specific functions (they start with R_) related to output in the R console. This file implements the monte-carlo simulation. The model itself can be found in core_topmodel.c and subroutines.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5631</id>
		<title>Performance measures</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5631"/>
		<updated>2008-09-15T15:08:24Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Here is a selection of measures you can use for assessing the performance of your model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Nash-Sutcliffe efficiency===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Nash-Sutcliffe_efficiency_coefficient Nash-Sutcliffe efficiency] is a widely used performance measure based on the error variance. It is implemented as ''NSeff()'' in the topmodel package. It takes two vectors, containing the simulated (Qsim) and observed (Qobs) discharge:&lt;br /&gt;
&lt;br /&gt;
   Eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
The underlying code is very simple:&lt;br /&gt;
&lt;br /&gt;
   NSeff &amp;lt;- function (Qobs, Qsim){&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qsim)]&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qsim)]&lt;br /&gt;
      NS &amp;lt;- 1 - (sum((Qobs - Qsim)^2)/sum((Qobs - mean(Qobs))^2))&lt;br /&gt;
      return(NS)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Coefficient of determination===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/R-squared coefficient of determination] is the square of the Pearson's product-moment correlation coefficient. Note that the COD only evaluates linear relations between variables!&lt;br /&gt;
&lt;br /&gt;
   COD &amp;lt;- cor(Qobs, Qsim, use=&amp;quot;complete.obs&amp;quot;)^2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Root mean squared error===&lt;br /&gt;
&lt;br /&gt;
As the name suggests, the root mean squared error is the square root of the [http://en.wikipedia.org/wiki/Mean_squared_error mean squared error]:&lt;br /&gt;
&lt;br /&gt;
   RMSE &amp;lt;- (mean((Qobs - Qsim)^2))^0.5&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5619</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5619"/>
		<updated>2008-09-05T13:03:27Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may be contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Topmodel is available from the [http://cran.r-project.org/mirrors.html Comprehensive R Archive Network]. It can be installed directly from within R with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;topmodel&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* ''infiltration()'' gives direct access to the Green-Ampt infiltration routine used by topmodel&lt;br /&gt;
* ''make.classes()'' makes topographic index classes from a topographic index map&lt;br /&gt;
* ''NSeff()'' calculates the Nash-Sutcliffe efficiency&lt;br /&gt;
* ''topidx()'' calculates the topographic index from a raster DEM&lt;br /&gt;
* ''topmodel()'' implements the original model&lt;br /&gt;
&lt;br /&gt;
==Raw libraries==&lt;br /&gt;
&lt;br /&gt;
The package is in fact a wrapper around a set of C libraries. This makes it easy to recycle the libraries and link them in C programs or other languages (Fortran, C++, Python, ...). For access to the libraries, download the [http://cran.r-project.org/src/contrib/topmodel_0.5.tar.gz source package], extract it, and look into the src/ subdirectory.&lt;br /&gt;
&lt;br /&gt;
Only the file topmodel.c contains some R-specific functions (they start with R_) related to output in the R console. This file implements the monte-carlo simulation. The model itself can be found in core_topmodel.r and subroutines.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5612</id>
		<title>RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5612"/>
		<updated>2008-08-26T21:40:28Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
RHydro is a set of topographical analysis tools that are not dissimilar to the ArcGIS ArcHydro toolbox (but more modest in scope). They are originally based on the [http://www.es.lancs.ac.uk/hfdg/freeware/hfdg_freeware_dta.htm DTM-ANALYSIS program] from the hydrology group at Lancaster University. &lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Digital terrain analysis with RHydro]] page.&lt;br /&gt;
&lt;br /&gt;
RHydro is experimental software and comes without any warranty. Currently it does not do much input checking but should be fairly safe if used correctly.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.zip Windows]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tgz MacOSX]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tar.gz Linux]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installation can be done via the packages menu (install local packages from zip files) or directly from the command line with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;RHydro_0.1.zip&amp;quot;, repos=NULL)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(RHydro)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* atb()&lt;br /&gt;
* flowlength()&lt;br /&gt;
* outlet()&lt;br /&gt;
* river()&lt;br /&gt;
* sinkfind()&lt;br /&gt;
* subcatch()&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=5611</id>
		<title>Digital terrain analysis with RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Digital_terrain_analysis_with_RHydro&amp;diff=5611"/>
		<updated>2008-08-26T21:38:56Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an example using the DEM supplied with the package. Load the package and the DEM:&lt;br /&gt;
&lt;br /&gt;
  library(RHydro)&lt;br /&gt;
  data(huagrahuma.dem)&lt;br /&gt;
&lt;br /&gt;
Fill depression and look at the difference between the original and filled map:&lt;br /&gt;
 &lt;br /&gt;
  dem.filled &amp;lt;- sinkfind(huagrahuma.dem, cellsize=25, degree=0.1)&lt;br /&gt;
  library(lattice)&lt;br /&gt;
  levelplot(dem.filled)&lt;br /&gt;
  &lt;br /&gt;
  difference &amp;lt;- dem.filled - huagrahuma.dem&lt;br /&gt;
  max(difference)&lt;br /&gt;
  min(difference)&lt;br /&gt;
  levelplot(difference)&lt;br /&gt;
&lt;br /&gt;
Topographic index calculation:&lt;br /&gt;
&lt;br /&gt;
  topidx &amp;lt;- atb(dem.filled, cellsize=25)&lt;br /&gt;
  class(topidx)&lt;br /&gt;
  str(topidx)&lt;br /&gt;
  levelplot(topidx$atb)&lt;br /&gt;
  levelplot(topidx$area)&lt;br /&gt;
&lt;br /&gt;
If you want, you can compare with the analysis on the non-filled DEM that contains obvious artefacts &lt;br /&gt;
&lt;br /&gt;
  old &amp;lt;- atb(huagrahuma.dem, cellsize=25)&lt;br /&gt;
  levelplot(old$area)&lt;br /&gt;
  levelplot(topidx$area - old$area)&lt;br /&gt;
&lt;br /&gt;
Have a look at the potential outlet:&lt;br /&gt;
&lt;br /&gt;
  outlet(topidx$area,c(28,8),2)&lt;br /&gt;
&lt;br /&gt;
We know from manual catchment delineation (on a topographic map) that the area of the catchment is around 2.4 km2, so the following cells are likely to contain the outlet: c(28,8); c(29,8); c(29,9). Just try them out with the subcatch() function and take the one you like.&lt;br /&gt;
&lt;br /&gt;
  catchment &amp;lt;- subcatch(dem.filled, c(29,8)) &lt;br /&gt;
  image(catchment)&lt;br /&gt;
  catchment[catchment == 0] &amp;lt;- NA&lt;br /&gt;
&lt;br /&gt;
  flowlength &amp;lt;- flowlength(dem.filled, c(29,8))&lt;br /&gt;
&lt;br /&gt;
Headwater cells are identified on the basis of a topographic index&lt;br /&gt;
or an accumulation area threshold. This is an “intuitive” choice:&lt;br /&gt;
&lt;br /&gt;
  rivers &amp;lt;- river(dem.filled,topidx$atb,topidx$area,cellsize=25,thatb=12.35,tharea=10000)&lt;br /&gt;
  image(rivers)&lt;br /&gt;
&lt;br /&gt;
Play around with the values of thatb and tharea and look at the impact…&lt;br /&gt;
&lt;br /&gt;
Mask the rivers and topographic index maps outside the catchment:&lt;br /&gt;
&lt;br /&gt;
  rivers &amp;lt;- rivers * catchment&lt;br /&gt;
  topidxmap &amp;lt;- topidx$atb * catchment&lt;br /&gt;
&lt;br /&gt;
Eliminate the NA values from the topidxmap:&lt;br /&gt;
&lt;br /&gt;
  topidxarray &amp;lt;- as.vector(topidxmap)&lt;br /&gt;
  topidxarray &amp;lt;- topidxarray[!is.na(topidxarray)]&lt;br /&gt;
&lt;br /&gt;
And make topographic index classes which can be used with topmodel:&lt;br /&gt;
&lt;br /&gt;
  classes &amp;lt;- make.classes(topidxarray,16)&lt;br /&gt;
  plot(classes)&lt;br /&gt;
&lt;br /&gt;
The object ''classes'' can be used as input for [[topmodel]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5610</id>
		<title>RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5610"/>
		<updated>2008-08-26T21:24:33Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
RHydro is a set of topographical analysis tools that are not dissimilar to the ArcGIS ArcHydro toolbox (but more modest in scope). They are originally based on the [http://www.es.lancs.ac.uk/hfdg/freeware/hfdg_freeware_dta.htm DTM-ANALYSIS program] from the hydrology group at Lancaster University. &lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Digital terrain analysis with RHydro]] page.&lt;br /&gt;
&lt;br /&gt;
RHydro is experimental software and comes without any warranty. Currently it does not do much input checking but should be fairly save if used correctly.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.zip Windows]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tgz MacOSX]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tar.gz Linux]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installation can be done via the packages menu (install local packages from zip files) or directly from the command line with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;RHydro_0.1.zip&amp;quot;, repos=NULL)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(RHydro)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* atb()&lt;br /&gt;
* flowlength()&lt;br /&gt;
* outlet()&lt;br /&gt;
* river()&lt;br /&gt;
* sinkfind()&lt;br /&gt;
* subcatch()&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5609</id>
		<title>RHydro</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=RHydro&amp;diff=5609"/>
		<updated>2008-08-26T21:22:20Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
RHydro is a set of topographical analysis tools that are not dissimilar to the ArcGIS ArcHydro toolbox (but more modest in scope). They are originally based on the [http://www.es.lancs.ac.uk/hfdg/freeware/hfdg_freeware_dta.htm DTM-ANALYSIS program] from the hydrology group at Lancaster University. &lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Digital terrain analysis with RHydro]] page.&lt;br /&gt;
&lt;br /&gt;
RHydro is experimental software and comes without any warranty. Currently it does not do much input checking but should be fairly save if used correctly.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.zip Windows]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tgz MacOSX]&lt;br /&gt;
&lt;br /&gt;
*[http://www.paramo.be/RHydro/RHydro_0.1.tar.gz Linux]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installation can be done via the packages menu (install local packages from zip files) or directly from the command line with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;RHydro_0.1.zip&amp;quot;, repos=NULL)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(RHydro)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* atb()&lt;br /&gt;
* flowlength()&lt;br /&gt;
* outlet()&lt;br /&gt;
* river()&lt;br /&gt;
* sinkfind()&lt;br /&gt;
* streamorder()&lt;br /&gt;
* subcatch()&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=5608</id>
		<title>Hydrology in R</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Hydrology_in_R&amp;diff=5608"/>
		<updated>2008-08-26T20:57:45Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
This page contains examples of hydrological analysis and modelling using R. The routines use mainly functions that are available in the standard R packages. When non-standard packages are needed, they are listed at the beginning of each page. These can be downloaded and installed from [http://cran.r-project.org/mirrors.html CRAN]. We also make some specific packages available on this wiki.&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
* [[topmodel|TOPMODEL]]&lt;br /&gt;
&lt;br /&gt;
* [[RHydro|RHydro]]&lt;br /&gt;
&lt;br /&gt;
==Importing data==&lt;br /&gt;
&lt;br /&gt;
* [[miscellaneous data import]]&lt;br /&gt;
&lt;br /&gt;
Importing hydrological time series and basic preprocessing&lt;br /&gt;
&lt;br /&gt;
* [[GCM data from the IPCC data repository]]&lt;br /&gt;
&lt;br /&gt;
* [[CRU reanalysis data]]&lt;br /&gt;
&lt;br /&gt;
==Topographical analysis==&lt;br /&gt;
&lt;br /&gt;
* [[Calculating the topographical index]]&lt;br /&gt;
&lt;br /&gt;
* [[Digital terrain analysis with RHydro]]&lt;br /&gt;
&lt;br /&gt;
==Basic hydrological analysis==&lt;br /&gt;
&lt;br /&gt;
* [[baseflow separation]]&lt;br /&gt;
&lt;br /&gt;
* [[calculating catchment characteristics]]&lt;br /&gt;
&lt;br /&gt;
==Hydrological modelling==&lt;br /&gt;
&lt;br /&gt;
* [[Running Topmodel]]&lt;br /&gt;
&lt;br /&gt;
==Uncertainty analysis==&lt;br /&gt;
&lt;br /&gt;
* [[GLUE analysis]]&lt;br /&gt;
&lt;br /&gt;
* [[Performance measures]]&lt;br /&gt;
&lt;br /&gt;
==Visualisation==&lt;br /&gt;
&lt;br /&gt;
* [[plotting maps]]&lt;br /&gt;
&lt;br /&gt;
* [[Making nice hydrological graphs]]&lt;br /&gt;
&lt;br /&gt;
==Miscellaneous functions==&lt;br /&gt;
&lt;br /&gt;
* [[Data formatting and preprocessing]]&lt;br /&gt;
&lt;br /&gt;
==Feedback==&lt;br /&gt;
&lt;br /&gt;
* This page is maintained by [http://www.ggy.bris.ac.uk/staff/staff_buytaert.html Wouter Buytaert]. All feedback is welcome.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GCM_data_from_the_IPCC_data_repository&amp;diff=5607</id>
		<title>GCM data from the IPCC data repository</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=GCM_data_from_the_IPCC_data_repository&amp;diff=5607"/>
		<updated>2008-08-26T13:59:47Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
You can download [http://www.ipcc-data.org/ar4/gcm_data.html summary GCM data] from the [http://www.ipcc-data.org IPCC data centre] for free for research purposes. They come in NetCDF format, which you can read into R with the RNetCDF package. However, the GCMs run at different resolutions, which  complicates the combination of them to calculate characteristics such as the predicted mean and range. The best method is to interpolate the maps to a common grid for the region of interest, and then calculate the statistics for each cell. The interpolation methods used here is the nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
Note: some IPCC maps do not come in a perfectly regular grid. Gridcells are often smaller at the boundaries, and for some reason the grid centers are not completely aligned. This creates problems for making a SpatialGridDataFrame. Interpolating to a self-defined regular grid avoids this issue.&lt;br /&gt;
&lt;br /&gt;
==Required packages==&lt;br /&gt;
&lt;br /&gt;
RNetCDF ([http://cran.r-project.org/web/packages/RNetCDF/index.html CRAN]) is used to import the NetCDF data. sp ([http://cran.r-project.org/web/packages/sp/index.html CRAN]) defines the spatial classes.&lt;br /&gt;
&lt;br /&gt;
    library(RNetCDF)&lt;br /&gt;
    library(sp)&lt;br /&gt;
&lt;br /&gt;
==Procedure==&lt;br /&gt;
&lt;br /&gt;
Define the grid we are interested in. The example is for the northern Andes region in South America:&lt;br /&gt;
    grid &amp;lt;- GridTopology(c(-81.75,-5.25), c(0.5,0.5), c(24,36))&lt;br /&gt;
&lt;br /&gt;
Open the NetCDF file and get the required variables. Here we are interested in the air temperature.&lt;br /&gt;
    nc &amp;lt;- open.nc(&amp;quot;C:/GIAOM_SRA1B_1_tas-change_2080-2099.nc&amp;quot;)&lt;br /&gt;
    lat &amp;lt;- var.get.nc(nc,&amp;quot;latitude&amp;quot;)&lt;br /&gt;
    long &amp;lt;- var.get.nc(nc,&amp;quot;longitude&amp;quot;)&lt;br /&gt;
    data &amp;lt;- var.get.nc(nc, &amp;quot;air_temperature_anomaly&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
To make a SpatialPointsDataFrame we need a dataframe where each row consists of an entry of the form (x,y,a) where x and y are the coordinates and a is the value. So we need to reformat the lat, long and data objects to be in the right format, We also average the temperature to yearly values by taking the mean over the 12 months.&lt;br /&gt;
&lt;br /&gt;
    latx  &amp;lt;- rep(lat,length(long))&lt;br /&gt;
    longx &amp;lt;- rep(long, length(lat))&lt;br /&gt;
    longx &amp;lt;- as.vector(t(matrix(longx,nrow=length(long))))&lt;br /&gt;
    data &amp;lt;- data.frame(var  = as.vector(t(apply(data,c(1,2),&amp;quot;mean&amp;quot;))))&lt;br /&gt;
    map &amp;lt;- SpatialPointsDataFrame(cbind(longx,latx), data, proj4string = CRS(&amp;quot;+proj=latlong +datum=WGS84&amp;quot;))&lt;br /&gt;
&lt;br /&gt;
Now interpolate using the closest grid cell of the original predictions. First we need to convert the grid to a SpatialGridDataFrame, which we initialise with NA, and then we look for the closest gridcell in map using spDistsN1().&lt;br /&gt;
&lt;br /&gt;
    data &amp;lt;- data.frame(temperature = rep(NA,length(coordinates(grid)[,1])))&lt;br /&gt;
    grid &amp;lt;- SpatialGridDataFrame(grid, data, proj4string = CRS(&amp;quot;+proj=longlat +datum=WGS84&amp;quot;))&lt;br /&gt;
    GridPoints&amp;lt;- coordinates(grid)&lt;br /&gt;
    MapPoints &amp;lt;- coordinates(map)&lt;br /&gt;
    for(i in 1:dim(GridPoints)[1]) {&lt;br /&gt;
        distance &amp;lt;- spDistsN1(MapPoints, GridPoints[i,], longlat = TRUE)&lt;br /&gt;
        grid$temperature[i] &amp;lt;- map$var[which.min(distance)]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
Finally we can plot the map:&lt;br /&gt;
&lt;br /&gt;
    spplot(grid, scales=list(draw=T))&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5573</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5573"/>
		<updated>2008-08-14T16:25:14Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may be contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Topmodel is available from the [http://cran.r-project.org/mirrors.html Comprehensive R Archive Network]. It can be installed directly from within R with:&lt;br /&gt;
&lt;br /&gt;
  install.packages(&amp;quot;topmodel&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* ''infiltration()'' gives direct access to the Green-Ampt infiltration routine used by topmodel&lt;br /&gt;
* ''make.classes()'' makes topographic index classes from a topographic index map&lt;br /&gt;
* ''NSeff()'' calculates the Nash-Sutcliffe efficiency&lt;br /&gt;
* ''topidx()'' calculates the topographic index from a raster DEM&lt;br /&gt;
* ''topmodel()'' implements the original model&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Plotting_maps&amp;diff=5570</id>
		<title>Plotting maps</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Plotting_maps&amp;diff=5570"/>
		<updated>2008-08-07T08:57:14Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
R can plot very nice maps. I decided to give up plotting maps in [http://grass.itc.it grass]. The ps.map function is very powerful, but hard to remember for my not-so-frequent use. I use the [http://cran.r-project.org/src/contrib/Descriptions/spgrass6.html grass interface] but R imports very many [http://www.gdal.org/formats_list.html raster] and [http://www.gdal.org/ogr/ogr_formats.html vector] formats via the [http://cran.r-project.org/src/contrib/Descriptions/rgdal.html rgdal] package.&lt;br /&gt;
&lt;br /&gt;
Plotting GIS data is very nicely implemented in the [http://cran.r-project.org/src/contrib/Descriptions/sp.html sp] package, part of the [http://r-spatial.sourceforge.net/ spatial data in R] project, but getting your plot the way you want is quite challenging. Here is an example.&lt;br /&gt;
&lt;br /&gt;
==Required packages==&lt;br /&gt;
&lt;br /&gt;
spgrass6 reads data from the GRASS database, use rgdal for other formats. sp implements spplot, and lattice is used to define the colours (trellis.par.set).&lt;br /&gt;
&lt;br /&gt;
   library(maptools)&lt;br /&gt;
   library(spgrass6)&lt;br /&gt;
   library(lattice)&lt;br /&gt;
&lt;br /&gt;
==Plotting a map==&lt;br /&gt;
&lt;br /&gt;
  # read the DEM and the vectors (for importing other formats see the rgdal package)&lt;br /&gt;
  &lt;br /&gt;
  paute_DEM &amp;lt;- readAsciiGrid(&amp;quot;paute_DEM.arc&amp;quot;, proj4string = CRS(&amp;quot;+proj=tmerc +datum=WGS84&amp;quot;))&lt;br /&gt;
  paute_rivers &amp;lt;- readShapeLines(&amp;quot;paute_rivers&amp;quot;, proj4string = CRS(&amp;quot;+proj=tmerc +datum=WGS84&amp;quot;))&lt;br /&gt;
  paute_borders &amp;lt;- readShapeLines(&amp;quot;paute_borders&amp;quot;, proj4string = CRS(&amp;quot;+proj=tmerc +datum=WGS84&amp;quot;))&lt;br /&gt;
  &lt;br /&gt;
  # set some nice topographic colours, if you want dull greyscale colors, use:&lt;br /&gt;
  # colours &amp;lt;- gray(c(rep(100,10),100:15)/100)&lt;br /&gt;
  &lt;br /&gt;
  colours &amp;lt;- terrain.colors(1000)&lt;br /&gt;
  trellis.par.set(sp.theme(regions=list(col = colours)))&lt;br /&gt;
  &lt;br /&gt;
  # define the objects necessary to draw a scalebar and north arrow:&lt;br /&gt;
  &lt;br /&gt;
  scale = list(&amp;quot;SpatialPolygonsRescale&amp;quot;, layout.scale.bar(height=0.05), offset = c(-79.3,-2.45), scale = 0.18, fill=c(&amp;quot;transparent&amp;quot;,&amp;quot;black&amp;quot;))&lt;br /&gt;
  text1 = list(&amp;quot;sp.text&amp;quot;, c(-79.28,-2.45), &amp;quot;0&amp;quot;)&lt;br /&gt;
  text2 = list(&amp;quot;sp.text&amp;quot;, c(-79.1,-2.45), &amp;quot;20 km&amp;quot;)&lt;br /&gt;
  arrow = list(&amp;quot;SpatialPolygonsRescale&amp;quot;, layout.north.arrow(type=1), offset = c(-79.2,-2.35), scale = 0.1)&lt;br /&gt;
  &lt;br /&gt;
  # define the vectors:&lt;br /&gt;
  &lt;br /&gt;
  rivers  &amp;lt;- list(&amp;quot;sp.lines&amp;quot;,paute_rivers, col=&amp;quot;blue&amp;quot;, lwd=0.5)&lt;br /&gt;
  limits  &amp;lt;- list(&amp;quot;sp.lines&amp;quot;,paute_limits, col=&amp;quot;black&amp;quot;, lwd=1)&lt;br /&gt;
  &lt;br /&gt;
  # and finally plot the map:&lt;br /&gt;
   &lt;br /&gt;
  spplot(paute_DEM,draw = T, colorkey=list(space=&amp;quot;right&amp;quot;, height=0.5), cuts=127,&lt;br /&gt;
     scales=list(draw=T), sp.layout=list(scale,text1,text2,arrow,rivers,limits))&lt;br /&gt;
&lt;br /&gt;
Good to know:&lt;br /&gt;
* ''cuts'' defines the number of colour intervals. The default is 15 and that's not really nice for continuous DEM images&lt;br /&gt;
* the ''colorkey'' options are part of levelplot {lattice} and are quite customizable&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
[[Image:map_paute.png]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Anaconda&amp;diff=5569</id>
		<title>Anaconda</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Anaconda&amp;diff=5569"/>
		<updated>2008-08-06T14:20:17Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Anaconda]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Eunectes is a genus of non-venomous boas found in tropical South America, commonly called anacondas. An aquatic group of snakes inhabiting swamps and rivers, its members include some of the largest snakes in the world.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(from Wikipedia)&lt;br /&gt;
&lt;br /&gt;
The hydrologist's playground to experiment with python. Some projects:&lt;br /&gt;
&lt;br /&gt;
==A front-end to topmodel==&lt;br /&gt;
&lt;br /&gt;
some examples of how to call C functions from python at [[polyglot]]&lt;br /&gt;
&lt;br /&gt;
==ASAR analysis==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The model of everywhere==&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Anaconda&amp;diff=5567</id>
		<title>Anaconda</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Anaconda&amp;diff=5567"/>
		<updated>2008-08-06T13:06:43Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Anaconda]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Eunectes is a genus of non-venomous boas found in tropical South America, commonly called anacondas. An aquatic group of snakes inhabiting swamps and rivers, its members include some of the largest snakes in the world.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
(from Wikipedia)&lt;br /&gt;
&lt;br /&gt;
The hydrologist's playground to experiment with python. Some projects:&lt;br /&gt;
&lt;br /&gt;
==A front-end to topmodel==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ASAR analysis==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The model of everywhere==&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=5566</id>
		<title>Running Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Running_Topmodel&amp;diff=5566"/>
		<updated>2008-08-03T22:30:39Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Topmodel is a conceptual semi-distributed model developed for shallow, mountainous catchments. Despite being about 30 years old, it is still widely used. Nevertheless it is highly recommended to study the theory behind the model before applying it in any hydrological study. Some good resources are given in the references section below.&lt;br /&gt;
&lt;br /&gt;
===Important note===&lt;br /&gt;
&lt;br /&gt;
In its current stage, the model does very little checking of input data. Feeding the function with unrealistic parameter values, such as very small channel flows (&amp;lt;50 m / hour) are known to crash the underlying compiled libraries (and probably R with it). So be careful (and let me know any problems you come across)!&lt;br /&gt;
&lt;br /&gt;
===Packages and data===&lt;br /&gt;
&lt;br /&gt;
Topmodel is part of the [[topmodel]] package (duh!). A set of example data are available from a small mountainous catchment in the Ecuadorian Andes with the unpronouncable name ''Huagrahuma''.&lt;br /&gt;
&lt;br /&gt;
  library(topmodel)&lt;br /&gt;
  data(Huagrahuma)&lt;br /&gt;
&lt;br /&gt;
===Running the model===&lt;br /&gt;
&lt;br /&gt;
Topmodel needs the following parameters:&lt;br /&gt;
&lt;br /&gt;
* qs0 = Initial subsurface flow per unit area (m)&lt;br /&gt;
* lnTe = log of the areal average of T0 (m2/h)&lt;br /&gt;
* m = Model parameter &lt;br /&gt;
* Sr0 = Initial root zone storage deficit (m)&lt;br /&gt;
* Srmax = Maximum root zone storage deficit (m)&lt;br /&gt;
* td = Unsaturated zone time delay per unit storage deficit&lt;br /&gt;
* vch = channel flow outside the catchment catchment (m/h)&lt;br /&gt;
* vr = channel flow inside catchment (m/h)&lt;br /&gt;
* k0 = Surface hydraulic conductivity (m/h)&lt;br /&gt;
* CD = capillary drive, see Morel-Seytoux and Khanji (1974)&lt;br /&gt;
* dt = The timestep (hours)&lt;br /&gt;
&lt;br /&gt;
We need to construct a vector with the parameter values (the order is important):&lt;br /&gt;
&lt;br /&gt;
   parameters&amp;lt;-c(qs0,lnTe,m,Sr0,Srmax,td,vch,vr,k0,CD,dt)&lt;br /&gt;
&lt;br /&gt;
(good values for the example catchment come with the Huagrahuma dataset)&lt;br /&gt;
&lt;br /&gt;
Then the model is run with the inputs described above:&lt;br /&gt;
&lt;br /&gt;
   Qsim &amp;lt;- topmodel(parameters, topidx, delay, rain, ET0)&lt;br /&gt;
&lt;br /&gt;
===Special features===&lt;br /&gt;
&lt;br /&gt;
* The model can be run with several parameter sets at the time. Then &amp;quot;parameters&amp;quot; should be a 2-dimensional matrix with a parameter set in each row.&lt;br /&gt;
&lt;br /&gt;
* The Nash-Sutcliffe efficiency is calculated directly when observed discharge (&amp;quot;Qobs&amp;quot;) is passed to the function:&lt;br /&gt;
&lt;br /&gt;
   NS &amp;lt;- topmodel(parameters, topidx, delay, rain ,ET0, Qobs)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* Beven, K. J., Kirkby, M. J., 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24, 43-69.&lt;br /&gt;
* Beven K, Lamb R, Quinn P, Romanowicz R, Freer J, 1995. TOPMODEL. In: Sing VP (Ed), Computer Models of Watershed Hydrology. Water Resources Publications, Colorado. pp. 627-668.&lt;br /&gt;
* Morel-Seytoux, H.J., Khanji, J., 1974. Derivation of an Equation of Infiltration. Water Resources Research, 10, 795-800.&lt;br /&gt;
* Beven, K., 1984. Infiltration into a Class of Vertically Non-Uniform Soils. Hydrological Sciences Journal 29, 425-434.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Baseflow_separation&amp;diff=5565</id>
		<title>Baseflow separation</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Baseflow_separation&amp;diff=5565"/>
		<updated>2008-08-03T21:56:06Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Chapman (1999) gives an excellent overview of baseflow separation techniques. Recursive digital filters are easiest to automate. Below are a few R implementations of the filter equations listed on the site:&lt;br /&gt;
&lt;br /&gt;
NOTE: this is work in progress - the scripts have not yet been thoroughly tested and may contain bugs!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Filter equations==&lt;br /&gt;
&lt;br /&gt;
===One-parameter algorithm===&lt;br /&gt;
&lt;br /&gt;
Chapman (1999) equation 8:&lt;br /&gt;
&lt;br /&gt;
  bf_oneparam &amp;lt;- function(discharge, k){&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;bf &amp;lt;- rep(discharge[1],length(discharge))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;for(i in 2:length(discharge)) {&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;bf[i] &amp;lt;- (k*bf[i-1]/(2-k)) + ((1-k)*discharge[i]/(2-k))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;if(bf[i] &amp;gt; discharge[i]) bf[i] &amp;lt;- discharge[i]&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;}&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;return(bf)&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
Parameter k is the recession constant during periods without direct runoff.&lt;br /&gt;
&lt;br /&gt;
===Boughton two-parameter algorithm===&lt;br /&gt;
&lt;br /&gt;
Chapman (1999) equation 9:&lt;br /&gt;
&lt;br /&gt;
  bf_boughton &amp;lt;- function(discharge, k, C){&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;bf &amp;lt;- rep(discharge[1],length(discharge))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;for(i in 2:length(discharge)) {&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;bf[i] &amp;lt;- (k*bf[i-1]/(1+C)) + (C*discharge[i]/(1+C))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;if(bf[i] &amp;gt; discharge[i]) bf[i] &amp;lt;- discharge[i]&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;}&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;return(bf)&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
===IHACRES three-parameter algorithm===&lt;br /&gt;
&lt;br /&gt;
Chapman (1999) equation 11:&lt;br /&gt;
&lt;br /&gt;
  bf_IHACRES &amp;lt;- function(discharge, k, C, a){&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;bf &amp;lt;- rep(discharge[1],length(discharge))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;for(i in 2:length(discharge)) {&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;bf[i] &amp;lt;- (k*bf[i-1]/(1+C)) + (C*(discharge[i] + a*discharge[i-1])/(1+C))&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;if(bf[i] &amp;gt; discharge[i]) bf[i] &amp;lt;- discharge[i]&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;}&lt;br /&gt;
  &amp;amp;nbsp;&amp;amp;nbsp;return(bf)&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===Lyne and Hollick algorithm===&lt;br /&gt;
&lt;br /&gt;
===Chapman algorithm=== &lt;br /&gt;
&lt;br /&gt;
===Furey and Gupta filter=== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* Chapman, T., 1999. A comparison of algorithms for stream flow recession and baseflow separation. Hydrol. Process. 13, 701-714&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_catchment_characteristics&amp;diff=5564</id>
		<title>Calculating catchment characteristics</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Calculating_catchment_characteristics&amp;diff=5564"/>
		<updated>2008-08-03T18:20:53Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
A nice paper I came across recently (Latron et al., 2008), uses some simple indicators to determine rainfall–runoff relationship for a catchment. The R code for deriving them from time series is very simple and left as an excercise.&lt;br /&gt;
&lt;br /&gt;
* Rainfall depth (mm)&lt;br /&gt;
&lt;br /&gt;
* Mean rainfall intensity (mm)&lt;br /&gt;
&lt;br /&gt;
* Maximum rainfall intensity (mm)&lt;br /&gt;
&lt;br /&gt;
* Storm-flow (mm)&lt;br /&gt;
&lt;br /&gt;
* Storm-flow coefficient (%)&lt;br /&gt;
&lt;br /&gt;
* Base-flow specific discharge (at the start of the flood) (l/s/km2)&lt;br /&gt;
&lt;br /&gt;
* Peak-flow specific discharge (l/s/km2)&lt;br /&gt;
&lt;br /&gt;
* Specific discharge increment (l/s/km2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
* J. Latron, M. Soler, P. Llorens and F. Gallart, 2008. Spatial and temporal variability of the hydrological response in a small Mediterranean research catchment (Vallcebre, Eastern Pyrenees). Hydrol. Process. 22, 775-787.&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Plotting_maps&amp;diff=5563</id>
		<title>Plotting maps</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Plotting_maps&amp;diff=5563"/>
		<updated>2008-08-03T18:12:06Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
R can plot very nice maps. I decided to give up plotting maps in [http://grass.itc.it grass]. The ps.map function is very powerful, but hard to remember for my not-so-frequent use. I use the [http://cran.r-project.org/src/contrib/Descriptions/spgrass6.html grass interface] but R imports very many [http://www.gdal.org/formats_list.html raster] and [http://www.gdal.org/ogr/ogr_formats.html vector] formats via the [http://cran.r-project.org/src/contrib/Descriptions/rgdal.html rgdal] package.&lt;br /&gt;
&lt;br /&gt;
Plotting GIS data is very nicely implemented in the [http://cran.r-project.org/src/contrib/Descriptions/sp.html sp] package, part of the [http://r-spatial.sourceforge.net/ spatial data in R] project, but getting your plot the way you want is quite challenging. Here is an example.&lt;br /&gt;
&lt;br /&gt;
==Required packages==&lt;br /&gt;
&lt;br /&gt;
spgrass6 reads data from the GRASS database, use rgdal for other formats. sp implements spplot, and lattice is used to define the colours (trells.par.set).&lt;br /&gt;
&lt;br /&gt;
   library(sp)&lt;br /&gt;
   library(spgrass6)&lt;br /&gt;
   library(lattice)&lt;br /&gt;
&lt;br /&gt;
==Plotting a map==&lt;br /&gt;
&lt;br /&gt;
   #direct import from GRASS, use readGDAL() for other formats&lt;br /&gt;
   &lt;br /&gt;
   paute &amp;lt;- rast.get6(&amp;quot;paute_DEM&amp;quot;)&lt;br /&gt;
   &lt;br /&gt;
   # set some nice topographic colours, if you want dull greyscale colors, use:&lt;br /&gt;
   # colours &amp;lt;- gray(c(rep(100,10),100:15)/100)&lt;br /&gt;
   &lt;br /&gt;
   colours &amp;lt;- topo.colors(1000)&lt;br /&gt;
   trellis.par.set(sp.theme(regions=list(col = colours)))&lt;br /&gt;
   &lt;br /&gt;
   # define the objects necessary to draw a scalebar and north arrow:&lt;br /&gt;
   &lt;br /&gt;
   scale = list(&amp;quot;SpatialPolygonsRescale&amp;quot;, layout.scale.bar(height=0.1), offset = c(690000,9735000), scale = 20000, fill=c(&amp;quot;transparent&amp;quot;,&amp;quot;black&amp;quot;))&lt;br /&gt;
   text1 = list(&amp;quot;sp.text&amp;quot;, c(690000,9740000), &amp;quot;0&amp;quot;)&lt;br /&gt;
   text2 = list(&amp;quot;sp.text&amp;quot;, c(710000,9740000), &amp;quot;20 km&amp;quot;)&lt;br /&gt;
   arrow = list(&amp;quot;SpatialPolygonsRescale&amp;quot;, layout.north.arrow(type=1), offset = c(698000,9720000), scale = 10000)&lt;br /&gt;
   &lt;br /&gt;
   # and finally plot the map:&lt;br /&gt;
   &lt;br /&gt;
   spplot(paute_DEM,draw = T, colorkey=list(space=&amp;quot;right&amp;quot;, height=0.5), cuts=127,&lt;br /&gt;
      scales=list(draw=T), sp.layout=list(scale,text1,text2,arrow))&lt;br /&gt;
&lt;br /&gt;
Good to know:&lt;br /&gt;
* ''cuts'' defines the number of colour intervals. The default is 15 and that's not really nice for continuous DEM images&lt;br /&gt;
* the ''colorkey'' options are part of levelplot {lattice} and are quite customizable&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
[[Image:map_paute.png]]&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5562</id>
		<title>Performance measures</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5562"/>
		<updated>2008-08-03T17:48:01Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Here is a selection of measures you can use for assessing the performance of your model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Nash-Sutcliffe efficiency===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Nash-Sutcliffe_efficiency_coefficient Nash-Sutcliffe efficiency] is a widely used performance measure based on the error variance. It is implemented as ''NSeff()'' in the topmodel package. It takes two vectors, containing the simulated (Qsim) and observed (Qobs) discharge:&lt;br /&gt;
&lt;br /&gt;
   Eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
The underlying code is very simple:&lt;br /&gt;
&lt;br /&gt;
   NSeff &amp;lt;- function (Qobs, Qsim){&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qsim)]&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qsim)]&lt;br /&gt;
      NS &amp;lt;- 1 - (sum((Qobs - Qsim)^2)/sum((Qobs - mean(Qobs))^2))&lt;br /&gt;
      return(NS)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Coefficient of determination===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/R-squared coefficient of determination] is the square of the Pearson's product-moment correlation coefficient. Note that the COD only evaluates linear relations between variables!&lt;br /&gt;
&lt;br /&gt;
   COD &amp;lt;- cor(Qobs, Qsim, use=&amp;quot;complete.obs&amp;quot;)^2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Root mean squared error===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Root_mean_square_deviation root mean squared error] is the square root of the variance:&lt;br /&gt;
&lt;br /&gt;
   RMSE &amp;lt;- cov(Qobs, Qsim, use=&amp;quot;complete.obs&amp;quot;)^0.5&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5561</id>
		<title>Performance measures</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Performance_measures&amp;diff=5561"/>
		<updated>2008-08-03T17:47:13Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Here is a selection of measures you can use for assessing the performance of your model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Nash-Sutcliffe efficiency===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Nash-Sutcliffe_efficiency_coefficient Nash-Sutcliffe efficiency] is a widely used performance measure based on the error variance. It is implemented as ''NSeff()'' in the topmodel package. It takes two vectors, containing the simulated (Qsim) and observed (Qobs) discharge:&lt;br /&gt;
&lt;br /&gt;
   Eff &amp;lt;- NSeff(Qobs,Qsim)&lt;br /&gt;
&lt;br /&gt;
The underlying code is very simple:&lt;br /&gt;
&lt;br /&gt;
   NSeff &amp;lt;- function (Qobs, Qsim){&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qobs)]&lt;br /&gt;
      Qobs &amp;lt;- Qobs[!is.na(Qsim)]&lt;br /&gt;
      Qsim &amp;lt;- Qsim[!is.na(Qsim)]&lt;br /&gt;
      NS &amp;lt;- 1 - (sum((Qobs - Qsim)^2)/sum((Qobs - mean(Qobs))^2))&lt;br /&gt;
      return(NS)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Coefficient of determination===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/R-squared coefficient of determination] is the square of the Pearson's product-moment correlation coefficient. Note that the COD only evaluates linear relations between variables!&lt;br /&gt;
&lt;br /&gt;
   COD &amp;lt;- cor(Qobs,Qsim, use=&amp;quot;complete.obs&amp;quot;)^2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Root mean squared error===&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/Root_mean_square_deviation root mean squared error] is the square root of the variance:&lt;br /&gt;
&lt;br /&gt;
   RMSE &amp;lt;- cov(Qobs,Qsim, use=&amp;quot;complete.obs&amp;quot;)^0.5&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5560</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5560"/>
		<updated>2008-08-02T21:12:00Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may be contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Downloads==&lt;br /&gt;
&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.5.zip Windows binary]&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.5.tar.gz Linux source package]&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.5.tgz Universal MacOS X package]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
Local packages can be installed from the menu. Choose &amp;quot;install package(s) from local zip files&amp;quot; and select the downloaded topmodel_0.3.zip file.&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
Use the normal procedure of installing a package in R:&lt;br /&gt;
&lt;br /&gt;
   &amp;gt; R CMD install topmodel_0.5.tar.gz&lt;br /&gt;
&lt;br /&gt;
Developer tools, including gcc, must be installed.&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
Go to the Package Installer (Packages and Data menu), select &amp;quot;Local Binary Package&amp;quot;, click install and select the downloaded package&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   help.start()&lt;br /&gt;
&lt;br /&gt;
The current version contains the following functions:&lt;br /&gt;
&lt;br /&gt;
* ''infiltration()'' gives direct access to the Green-Ampt infiltration routine used by topmodel&lt;br /&gt;
* ''make.classes()'' makes topographic index classes from a topographic index map&lt;br /&gt;
* ''NSeff()'' calculates the Nash-Sutcliffe efficiency&lt;br /&gt;
* ''topidx()'' calculates the topographic index from a raster DEM&lt;br /&gt;
* ''topmodel()'' implements the original model&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5559</id>
		<title>Topmodel</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Topmodel&amp;diff=5559"/>
		<updated>2008-08-02T18:28:09Z</updated>

		<summary type="html">&lt;p&gt;Wbuytaert: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
The TOPMODEL package contains an implementation of the venerable TOPMODEL, along with some other useful functions. Although the package has been tested extensively, it may be contain bugs. All feedback is welcome (see the feedback page).&lt;br /&gt;
&lt;br /&gt;
Thanks go to [http://www.lec.lancs.ac.uk/cswm/Staff_kb.php Keith Beven], who wrote the original TOPMODEL in Fortran, and [http://geni.ath.cx/ Huidae Cho], for the C code base (originally implemented in [http://grass.osgeo.org/ GRASS GIS])&lt;br /&gt;
&lt;br /&gt;
For a fully documented example, see the [[Running Topmodel]] page.&lt;br /&gt;
&lt;br /&gt;
==Downloads==&lt;br /&gt;
&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.3.zip Windows binary]&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.3.tar.gz Linux source package]&lt;br /&gt;
* [http://www.paramo.be/topmodel/topmodel_0.3.tgz Universal MacOS X package]&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
Local packages can be installed from the menu. Choose &amp;quot;install package(s) from local zip files&amp;quot; and select the downloaded topmodel_0.3.zip file.&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
Use the normal procedure of installing a package in R:&lt;br /&gt;
&lt;br /&gt;
   &amp;gt; R CMD install topmodel_0.3.tar.gz&lt;br /&gt;
&lt;br /&gt;
Developer tools, including gcc, must be installed.&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
Go to the Package Installer (Packages and Data menu), select &amp;quot;Local Binary Package&amp;quot;, click install and select the downloaded package&lt;br /&gt;
&lt;br /&gt;
==Loading==&lt;br /&gt;
&lt;br /&gt;
Once in R you need to load the package before you can use it:&lt;br /&gt;
&lt;br /&gt;
   &amp;gt; library(topmodel)&lt;br /&gt;
&lt;br /&gt;
==Function overview==&lt;br /&gt;
&lt;br /&gt;
Full documentation is provided in the package, and can be opened with:&lt;br /&gt;
&lt;br /&gt;
   &amp;gt; help.start()&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
</feed>