Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
FUSE-RHydro tutorial 4
# Load the package and prepare the list of models
# 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
# 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
# The instantaneous runoff is
U <- modx$U
# The routed discharge is
Qrout <- modx$fitted.values
# plot the Observed vs Simulated value
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment