Skip to contents

Reads 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 ID columns), or "all" for every ID present.

vers

Rotation sheet layout version: 2 is the current one used by run.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's Météo sheet, or a path to a standalone climate CSV with one row per month and a month column (e.g. data_in/climate/<station>.csv/data_in/97_climate/*.csv, one file per weather station). A generic file is applied to every requested ids (there is no per-ID climate when read this way).

source.soil.data

Either "main.xlsx.file" (default) to read soil from the workbook's Sol sheet, or a path to a standalone soil CSV in long var/value format (one row per soil property: clay, soil.depth, soc.stock, latitude, longitude...; see data_in/98_soil/*.csv for examples). As with climate, a generic file is applied identically to every requested ids.

Value

A list with:

  • crop – rotation data frame (or a named list of them, one per ID, when length(ids) > 1).

  • climate – monthly climate data frame(s), same one-or-list shape.

  • soil – one-row soil data frame(s), same shape.

  • info – the Info sheet row(s) for the requested IDs.

See also