Write fixed/monthly RothC inputs to a .dat file
f.rothc.dataframe.2.dat.RdWrites 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. Forvers = 2:clay,depth,IOM,nsteps,silt,BD,OC,min_RMmoist(any order; reordered internally).silt/BD/OC/min_RMmoistonly affect the run whenopt_RMmoistis 2 or 3, but the layout always carries them.- df.simul.values
Data frame of monthly driving data. For
vers = 1, written as supplied. Forvers = 2, must holdyear,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_fmust sum to 1 per row, as must the fourOA_*_f; for EOM categories with no established Bio-pool fraction useOA_Bio_f = 0(seedata_in/eom_params.csv).- output.dat.file
Path to write the
.datfile to.- vers
1for the legacy layout (default, unchanged behaviour),2for 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– seef.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 internalpan_coefficient * Evaprecovers the real PET. Not applied forvers = 1, whose destination engine (the "classic"RMF_Moist()) already expects true PET directly.
Details
vers = 1(default, legacy): header, one row of fixed soil parameters (clay,depth,iom,nsteps), then one row per month ending with the singleDPM_RPMratio. This is the layout RothC used up to version 2.0.x and the one the"classic"/kh-r_dpmengine (ROTH_C(),ROTH_C_SPIN_UP()) reads.vers = 2(official v2.1.x): adds anopt_RMmoist/opt_SMDbareoption header and the extended soil row (clay/depth/IOM/nsteps/silt/BD/OC/min_RMmoist), and replacesDPM_RPMwith explicit monthly allocation fractionsPl_DPM_f/Pl_RPM_f(plant carbon) andOA_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 ownRothC_R_function.R.