Created
July 25, 2014 12:47
-
-
Save cvitolo/2248c569319f1f6dae5a to your computer and use it in GitHub Desktop.
FUSE-RHydro tutorial 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the package and prepare the list of models | |
library(hydromad) | |
library(RHydro) | |
data(modlist) | |
# read data in | |
temp <- read.csv("dummyData.csv") | |
# Convert to date | |
temp[,1] <- as.Date(temp[,1],format="%Y-%m-%d") | |
## Convert to zoo object | |
DATA <- read.zoo(temp) | |
## Step 1: set up FUSE and its parameter ranges using the hydromad approach | |
# Set the parameter ranges | |
hydromad.options(fusesma=fusesma.ranges(),fuserouting=fuserouting.ranges()) | |
# Set model | |
modspec <- hydromad(DATA, | |
sma = "fusesma", | |
routing = "fuserouting", | |
mid = 1:1248, | |
modlist = modlist) | |
# Randomly generate 1 parameter set | |
myNewParameterSet <- parameterSets( coef(modspec, warn=FALSE), 1, method="random") | |
## Step 2 run a simulation | |
# Run a simulation using the parameter set generated above | |
modx <- update(modspec, | |
newpars = myNewParameterSet) | |
# Generate a summary of the result | |
summary(modx) | |
# The instantaneous runoff is | |
U <- modx$U | |
# The routed discharge is | |
Qrout <- modx$fitted.values | |
# plot the Observed vs Simulated value | |
hydromad:::xyplot.hydromad(modx) | |
# Add the precipitation to the above plot | |
hydromad:::xyplot.hydromad(modx, with.P=TRUE) | |
##Step 3: calibrate FUSE using one of the hydromad's algorithms | |
modfit <- fitBySCE(modspec) | |
summary(modfit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment