Read a SocMo input workbook into crop/climate/soil/info data frames
f.rothc.xlsx.2.dataframe.RdReads the Rotation, Météo, Sol and Info sheets of a SocMo
input workbook (the input_<case>.xlsx format used by
run.socmo()) for one or more rotation IDs. Climate and soil can
each independently be read from the workbook itself, or from a
standalone generic file shared across workbooks/cases – useful when
several scenarios (e.g. different management practices) sit on the
same physical site and shouldn't each re-type the same soil/climate
values.
Usage
f.rothc.xlsx.2.dataframe(
input.xlsx.file = NULL,
ids = "all",
vers = 1,
source.climate.data = "main.xlsx.file",
source.soil.data = "main.xlsx.file"
)Arguments
- input.xlsx.file
Path to the input workbook.
- ids
Rotation ID(s) to read (as found in the workbook's
IDcolumns), or"all"for every ID present.- vers
Rotation sheet layout version:
2is the current one used byrun.socmo()(skips columns 3:7); anything else assumes the older layout (skips columns 3:4).- source.climate.data
Either
"main.xlsx.file"(default) to read climate from the workbook'sMétéosheet, or a path to a standalone climate CSV with one row per month and amonthcolumn (e.g.data_in/climate/<station>.csv/data_in/97_climate/*.csv, one file per weather station). A generic file is applied to every requestedids(there is no per-ID climate when read this way).- source.soil.data
Either
"main.xlsx.file"(default) to read soil from the workbook'sSolsheet, or a path to a standalone soil CSV in longvar/valueformat (one row per soil property:clay,soil.depth,soc.stock,latitude,longitude...; seedata_in/98_soil/*.csvfor examples). As with climate, a generic file is applied identically to every requestedids.
Value
A list with:
crop– rotation data frame (or a named list of them, one per ID, whenlength(ids) > 1).climate– monthly climate data frame(s), same one-or-list shape.soil– one-row soil data frame(s), same shape.info– theInfosheet row(s) for the requested IDs.