Skip to contents

Replicates the CHPS FEWS AdjustQ tool. Adjusts observed mean daily discharges using observed instantaneous and simulated discharges. If both observed mean daily and instantaneous data are missing, simulated discharge is used.

Usage

adjustq(
  daily_flow,
  inst_flow,
  sim = NULL,
  blend = 10L,
  interp_type = "ratio",
  error_tol = 0.01,
  max_iterations = 15L
)

Arguments

daily_flow

Data.frame with columns year, month, day, flow_cfs (daily obs)

inst_flow

Data.frame with columns year, month, day, hour, flow_cfs (instantaneous obs)

sim

Data.frame with columns year, month, day, hour, flow_cfs (simulated 6hr flow), or NULL. If provided, small/large gap filling uses simulation as fallback.

blend

Integer; threshold for small vs large gap in timesteps. Default 10.

interp_type

"ratio" or "difference". Default "ratio".

error_tol

Numeric; daily volume matching tolerance (fraction). Default 0.01.

max_iterations

Integer; max daily correction iterations. Default 15.

Value

A data.frame with columns: datetime (POSIXct), flow_cfs (adjusted flow)