View source: R/rvn_flow_residuals.R
rvn_flow_residuals | R Documentation |
rvn_flow_residuals creates a residuals time series for flow values. Useful in diagnotic analysis of model outputs.
rvn_flow_residuals(
sim = NULL,
obs = NULL,
ma_smooth = 3,
add_line = FALSE,
winter_shading = FALSE,
wsdates = c(12, 1, 3, 31)
)
sim |
time series object of simulated flows |
obs |
time series object of observed flows |
ma_smooth |
optional length of rolling average to smooth residuals with (default 3) |
add_line |
optionally adds a horizontal line to the plot for reference
(default |
winter_shading |
optionally adds a light blue shading to winter months
(default |
wsdates |
integer vector of winter shading period dates (see details) |
Creates a residuals time series plot for flow values, with the option to smooth out the values using the rollmean function in zoo. The winter months are optionally shaded in the time series; winter period is defined as December 1st to March 31st.
The residuals are calculated as sim - obs.
The sim and obs should be of time series (xts) format. The flow series are assumed to be daily flows with units of m3/s.
Note that a plot title is purposely omitted in order to allow the automatic generation of plot titles.
The winter_shading argument will add a transparent grey shading for the specified period by wsdates in each year that is plotted.
wsdates is formatted as c(winter start month, winter start day, winter end month, winter end day).
resids |
residual time series |
rvn_flow_scatterplot
to create a scatterplot of flow
values
# load sample hydrograph data, two years worth of sim/obs
ff <- system.file("extdata/run1_Hydrographs.csv", package="RavenR")
run1 <- rvn_hyd_read(ff)
sim <- run1$hyd$Sub36
obs <- run1$hyd$Sub36_obs
# default with moving average smoothing shading of winter months
rvn_flow_residuals(sim,obs)$plot
# plot with more smoothing than the default 3
rvn_flow_residuals(sim, obs, ma_smooth=10)$plot
# with zero line and winter shading
rvn_flow_residuals(sim,obs, add_line=TRUE, winter_shading = TRUE)$plot
# change winter shading to Nov 1 - April 30
rvn_flow_residuals(sim,obs, add_line=TRUE,
winter_shading = TRUE, wsdates=c(11,1,4,30))$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.