Methods to run a network or node
Streamfall.align_time_frame
— Methodalign_time_frame(timeseries::T...)
Subset an arbitrary number of DataFrames to their shared period of time.
Returns subsetted copy of data in same order as input.
Example
julia> climate, streamflow = align_time_frame(climate, streamflow)
Streamfall.find_common_timeframe
— Methodfind_common_timeframe(timeseries::T...)
Find common time frame between time series.
Requires that all DataFrames have a "Date" column.
Streamfall.prep_state!
— Methodprep_state!(sn::StreamfallNetwork, timesteps::Int64)::Nothing
Prepare a network for a run by pre-allocating result stores.
Streamfall.run_basin!
— Methodrun_basin!(sn::StreamfallNetwork, climate::Climate; inflow=nothing, extraction=nothing, exchange=nothing)
Run scenario for an entire catchment/basin.
Streamfall.run_node!
— Methodrun_node!(
node::NetworkNode, climate::Climate, ts::Int;
inflow=nothing, extraction=nothing, exchange=nothing
)
Run a specific node for a specified time step.
Arguments
node
: A node in a networkclimate
: Climate datasetts
: current time stepinflow
: Time series of inflows from upstream nodes.extraction
: Time series of water orders (expects column of_releases
)exchange
: Time series of groundwater flux
Streamfall.run_node!
— Methodrun_node!(
node::NetworkNode, climate::Climate;
inflow=nothing, extraction=nothing, exchange=nothing
)::Nothing
Run a specific node, and only that node, for all time steps.
Arguments
node
: Any Streamfall NetworkNodeclimate
: Climate datainflow::Union{DataFrame, Vector, Number}
: Inflow to nodeextraction::Union{DataFrame, Vector, Number}
: Extractions from this subcatchmentexchange::Union{DataFrame, Vector, Number}
: Groundwater flux
Streamfall.run_node!
— Methodrun_node!(
sn::StreamfallNetwork, node_id::Int, climate::Climate, ts::Int64;
inflow=nothing, extraction=nothing, exchange=nothing
)::Nothing
Generic run method that runs a model attached to a given node for a given timestep. Recurses upstream as needed.
Arguments
sn::StreamfallNetwork
node_id
: Node to run in the networkclimate
: Climate object holding rainfall and evaporation data (or temperature)ts
: Timestep to runextraction
: Water orders for each time step (defaults to nothing)exchange
: Exchange with groundwater system at each time step (defaults to nothing)