Skip to contents

Writes a RothC .dat input file, in either of the two layouts RothC has used, selected with vers:

Usage

f.rothc.dataframe.2.dat(
  df.fixed.values,
  df.simul.values,
  output.dat.file = "./data_out/RothC_input.dat",
  vers = 1,
  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.

vers

1 for the legacy layout (default, unchanged behaviour), 2 for the official v2.1.x layout.

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

Only used when vers = 2 – see f.rothc.dataframe.2.dat.v2(). df.simul.values$Evap (true potential evapotranspiration) is divided by this value before writing, so that the official engine's internal pan_coefficient * Evap recovers the real PET. Not applied for vers = 1, whose destination engine (the "classic" RMF_Moist()) already expects true PET directly.

Value

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

Details

  • vers = 1 (default, legacy): header, one row of fixed soil parameters (clay, depth, iom, nsteps), then one row per month ending with the single DPM_RPM ratio. This is the layout RothC used up to version 2.0.x and the one the "classic" / kh-r_dpm engine (ROTH_C(), ROTH_C_SPIN_UP()) reads.

  • vers = 2 (official v2.1.x): adds an opt_RMmoist/opt_SMDbare option header and the extended soil row (clay/depth/IOM/nsteps/silt/BD/OC/min_RMmoist), and replaces DPM_RPM with explicit monthly allocation fractions Pl_DPM_f/Pl_RPM_f (plant carbon) and OA_DPM_f/OA_RPM_f/OA_Bio_f/OA_Hum_f (organic amendment carbon, 4 pools since RothC 2.1.0). Files written this way are read by Rothamsted's own RothC_R_function.R.