dynatop {dynatop} | R Documentation |
R6 Class for Dynamic TOPMODEL
R6 Class for Dynamic TOPMODEL
new()
Creates a dynatop class object from the a list based model description as generated by dynatopGIS.
dynatop$new(model, use_states = FALSE, delta = 1e-13)
model
a dynamic TOPMODEL list object
use_states
logical if states should be imported
delta
error term in checking redistribution sums
drop_map
logical if the map should be dropped
This function makes some basic consistency checks on a list representing a dynamic TOPMODEL model. The checks performed and basic 'sanity' checks. They do not check for the logic of the parameter values nor the consistency of states and parameters. Sums of the redistribution matrices are checked to be in the range 1 +/- delta.
invisible(self) suitable for chaining
add_data()
Adds observed data to a dynatop object
dynatop$add_data(obs_data)
obs_data
an xts object of observed data
This function makes some basic consistency checks on the observations to ensure they have uniform timestep and all required series are present.
invisible(self) suitable for chaining
clear_data()
Clears all forcing and simulation data except current states
dynatop$clear_data()
invisible(self) suitable for chaining
initialise()
Initialises a dynatop object in the most simple way possible.
dynatop$initialise(tol = 2 * .Machine$double.eps, max_it = 1000)
tol
tolerance for the solution for the saturated zone
max_it
maximum number of iterations to use in the solution of the saturated zone
invisible(self) suitable for chaining
initialise_channel()
Initialises only the channel part of a dynatop object in the most simple way possible.
dynatop$initialise_channel()
invisible(self) suitable for chaining
sim_hillslope()
Simulate the hillslope output of a dynatop object
dynatop$sim_hillslope( keep_states = NULL, sub_step = NULL, tol = 2 * .Machine$double.eps, max_it = 1000, ftol = Inf )
keep_states
a vector of POSIXct objects (e.g. from xts) giving the time stamp at which the states should be kept
sub_step
simulation timestep in seconds, default value of NULL results in data time step
tol
tolerance on width of bounds in the solution for the saturated zone
max_it
maximum number of iterations to use in the solution of the saturated zone
ftol
tolerance in closeness to 0 in the solution for the saturated zone
Both saving the states at every timestep and keeping the mass balance can generate very large data sets!!
While ftol is implemented it is currently set to Inf
to mimic the behaviour of previous versions. This will change in the future.
invisible(self) for chaining
sim_channel()
Simulate the channel output of a dynatop object
dynatop$sim_channel()
invisible(self) for chaining
sim()
Simulate the hillslope and channel components of a dynatop object
dynatop$sim( keep_states = NULL, sub_step = NULL, tol = 2 * .Machine$double.eps, max_it = 1000, ftol = Inf )
keep_states
a vector of POSIXct objects (e.g. from xts) giving the time stamp at which the states should be kept
sub_step
simulation timestep in seconds, default value of NULL results in data time step
tol
tolerance on width of bounds in the solution for the saturated zone
max_it
maximum number of iterations to use in the solution of the saturated zone
ftol
tolerance in closeness to 0 in the solution for the saturated zone
mass_check
Flag indicating is a record of mass balance errors should be kept
Calls the sim_hillslope and sim_channel in sequence. Both saving the states at every timestep and keeping the mass balance can generate very large data sets!!
invisible(self) for chaining
get_channel_inflow()
Return channel inflow as an xts series or list of xts series
dynatop$get_channel_inflow(total = FALSE, separate = FALSE)
total
logical if plot total inflow is to be plotted
separate
logical if the surface and saturated zone inflows should be returned separately
plot_channel_inflow()
Plot the channel inflow
dynatop$plot_channel_inflow(total = FALSE, separate = FALSE)
total
logical if total inflow is to be plotted
separate
logical logical if the surface and saturated zone inflows should be plotted separately
get_gauge_flow()
Return flow at the gauges as an xts series
dynatop$get_gauge_flow(gauge = colnames(private$time_series$gauge_flow))
gauge
names of gauges to return (default is all gauges)
plot_gauge_flow()
Get the flow at gauges
dynatop$plot_gauge_flow(gauge = colnames(private$time_series$gauge_flow))
gauge
names of gauges to return (default is all gauges)
get_obs_data()
Get the observed data
dynatop$get_obs_data()
get_model()
Return the model
dynatop$get_model()
get_mass_errors()
Return the model
dynatop$get_mass_errors()
get_states()
Return states
dynatop$get_states(record = FALSE)
record
logical TRUE if the record should be returned. Otherwise the current states returned
plot_state()
Plot a current state of the system
dynatop$plot_state(state, add_channel = TRUE)
state
the name of the state to be plotted
add_channel
Logical indicating if the channel should be added to the plot
clone()
The objects of this class are cloneable with this method.
dynatop$clone(deep = FALSE)
deep
Whether to make a deep clone.
## the vignettes contains further details of the method calls.
data("Swindale") ## example data
ctch_mdl <- dynatop$new(Swindale$model) ## create with model
ctch_mdl$add_data(Swindale$obs) ## add observations
ctch_mdl$initialise() ## initialise model
ctch_mdl$sim() ## simulate model