Skip to contents

Groups by location and applies calc_water_balance to each group. Unlike `calc_water_balance`, the units here *do* matter – they should be `mm_day`.

Usage

apply_water_balance(
  df,
  idcol,
  whc_mm = 500,
  irrigation_max_mm = 150,
  flood_target = 125,
  flood_min = 62.5,
  flood_max = 175,
  seepage = 2.5
)

Arguments

df

Data frame with columns: `date`, `location_id`, `etc_mm_day`, `precip_mm_day`, `crop_name`, and `whc_min_frac` (optional, defaults to 0.375). If a `whc_mm` column is present, it is used as the water holding capacity.

idcol

Column name for grouping (typically, `location_id`, `parcel_id` or similar).

whc_mm

Water holding capacity (mm); ignored if `whc_mm` is a column in `df`.

irrigation_max_mm

Maximum irrigation to be applied at a time. See `irrigation_max` argument of [calc_water_balance()]. Ignored if `irrigation_max_mm` is a column of `df`.

flood_target

Numeric scalar. Target ponded water depth. Irrigation refills to this level.

flood_min

Numeric scalar. Minimum acceptable pond depth before irrigation is triggered.

flood_max

Numeric scalar. Maximum pond depth before bund overflow / runoff occurs.

seepage

Numeric scalar. Daily seepage + percolation loss Represents losses through the bund and downward percolation through the hardpan (if any). Typical range: 1-5 mm/day for well-puddled California soils.

Value

Data frame with added columns: `W_t` / `pond_depth`, `irr`, `runoff`