Skip to content

Instantly share code, notes, and snippets.

@cvitolo
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvitolo/15aa013dc72dd9b39130 to your computer and use it in GitHub Desktop.
Save cvitolo/15aa013dc72dd9b39130 to your computer and use it in GitHub Desktop.
new FUSE and HYDROMAD
# install/load dependent libraries
if(!require(zoo)) install.packages("zoo")
library(zoo)
if(!require(tgp)) install.packages("tgp")
library(tgp)
if(!require(qualV)) install.packages("qualV")
library(qualV)
if(!require(hydromad)) install.packages("hydromad",repos="http://hydromad.catchment.org")
library(hydromad)
if(!require(devtools)) install.packages("devtools")
library(devtools)
# install the fuse package directly from GitHub
install_github("ICHydro/r_fuse", subdir = "fuse")
library(fuse)
# Load sample data
data(DATA)
# Set the parameter ranges
hydromad.options(fusesma=fusesma.ranges(),fuserouting=fuserouting.ranges())
# Set model
modspec <- hydromad(DATA, sma = "fusesma", routing = "fuserouting", mid = 1:1248, deltim = 1)
# Randomly generate 1 parameter set
myNewParameterSet <- parameterSets( coef(modspec, warn=FALSE), 1, method="random")
# Run a simulation using the parameter set generated above
modx <- update(modspec, newpars = myNewParameterSet)
# Generate a summary of the result
summary(modx)
# Plot results
hydromad:::xyplot.hydromad(modx, with.P=TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment