Skip to contents

Implementation behind f.rothc.dataframe.2.dat(vers = 2) – see there for the column requirements. Kept separate only to keep each layout's header/body writing readable; call the vers argument rather than this function directly.

Usage

f.rothc.dataframe.2.dat.v2(
  df.fixed.values,
  df.simul.values,
  output.dat.file = "./data_out/RothC_input.dat",
  opt_RMmoist = 1,
  opt_SMDbare = 1,
  pan_coefficient = 0.75
)

Arguments

df.fixed.values

One-row data frame of fixed soil parameters. For vers = 1: clay, depth, iom, nsteps. For vers = 2: clay, depth, IOM, nsteps, silt, BD, OC, min_RMmoist (any order; reordered internally). silt/BD/OC/min_RMmoist only affect the run when opt_RMmoist is 2 or 3, but the layout always carries them.

df.simul.values

Data frame of monthly driving data. For vers = 1, written as supplied. For vers = 2, must hold year, month, modern, Tmp, Rain, Evap, Pl_inp, OA_inp, PC, Pl_DPM_f, Pl_RPM_f, OA_DPM_f, OA_RPM_f, OA_Bio_f, OA_Hum_f (any order; reordered internally). Pl_DPM_f/Pl_RPM_f must sum to 1 per row, as must the four OA_*_f; for EOM categories with no established Bio-pool fraction use OA_Bio_f = 0 (see data_in/eom_params.csv).

output.dat.file

Path to write the .dat file to.

opt_RMmoist

Only used when vers = 2. 1 (default) = classic RothC moisture function; 2/3 = van Genuchten/Wosten-based function (Farina et al. 2013).

opt_SMDbare

Only used when vers = 2. 1 (default) = bare soil moisture deficit threshold as in classic RothC; 2 = threshold set to -1500 kPa.

pan_coefficient

Pan coefficient used by the destination engine's moisture function to convert open-pan evaporation to potential evapotranspiration (0.75 in the official RothC_R v2.1.x RMF_Moist). df.simul.values$Evap (assumed to already be true PET) is divided by this value before writing, so the official engine's pan_coefficient * Evap recovers the real PET.

Value

Invisibly NULL; called for its side effect of writing output.dat.file.

Details

The official moisture function (RMF_Moist/RMF_Moist_official) expects Evap to be open-pan evaporation and converts it to potential evapotranspiration internally via DF <- RAIN - pan_coefficient*PEVAP. Our own climate data already is potential evapotranspiration (that's why the "classic"/legacy engine's RMF_Moist() was patched to drop that factor – see RothC_R_fork_FrdVnW history). To feed the unmodified official formula a value it will itself multiply by pan_coefficient, we must pre-divide: Evap_written = Evap / pan_coefficient, so that pan_coefficient * Evap_written == Evap (the real PET) once the model applies its own conversion.