Skip to contents

Reads parameter, forcing, flow, and upflow CSVs from an NWRFC autocalibration directory, auto-detects which model components are present, and runs the full chain: FA -> SAC-SMA/SNOW17 -> UH -> Lag-K -> Chanloss -> Consuse.

Usage

nwsrfs_run(
  autocalb_dir,
  run_dir = NULL,
  forcing_adj = TRUE,
  shift_sf = TRUE,
  return_inst = TRUE
)

Arguments

autocalb_dir

Path to an NWRFC autocalibration directory

run_dir

Name of results subdirectory (e.g. "results_por_02"). If NULL, uses the first results_* directory found.

forcing_adj

Apply monthly climatological forcing adjustments. TRUE adjusts all forcings, FALSE adjusts none, and a character vector naming a subset of "map", "mat", "ptps" and "pet" adjusts only those. Default TRUE.

shift_sf

Logical; shift UH-derived streamflow forward one timestep (required for NWRFC calibrations). Default TRUE.

return_inst

Logical; return instantaneous streamflow rather than period average. Default TRUE.

Value

A list with class "nwsrfs_run" containing model results and metadata. See Details.

Details

The returned list contains:

sim

Numeric vector of simulated flow (cfs)

sacsnow_sf

Numeric vector of SAC-SMA/SNOW17/UH flow per zone (cfs), or NULL

sacsnow_tci

Matrix of total channel inflow per zone (mm), or NULL

lagk_route

Numeric vector of Lag-K routed flow (cfs), or NULL

forcings

List of adjusted forcing data.frames, or NULL

pars

Parameter data.frame

forcing_raw

List of raw (unadjusted) forcing data.frames

upflow

List of upstream flow data.frames, or NULL

daily_flow

Daily observed flow data.frame

inst_flow

Instantaneous observed flow data.frame, or NULL

dt_hours

Model timestep in hours

zone_names

Character vector of zone names

upflow_names

Character vector of upstream reach names, or NULL

localflow_logic

Logical; SAC-SMA/SNOW17/UH present

upflow_logic

Logical; Lag-K routing present

chanloss_logic

Logical; chanloss present

consuse_logic

Logical; consuse present