gen_sols_xml: Generate STICS sols xml file from a template or an input file

View source: R/gen_sols_xml.R

gen_sols_xmlR Documentation

Generate STICS sols xml file from a template or an input file

Description

Generate STICS sols xml file from a template or an input file

Usage

gen_sols_xml(
  file,
  param_df,
  template = NULL,
  stics_version = "latest",
  sols_in_file = lifecycle::deprecated(),
  sols_param = lifecycle::deprecated(),
  sols_out_file = lifecycle::deprecated(),
  sols_nb = lifecycle::deprecated()
)

Arguments

file

Path (including name) of the sols file to generate.

param_df

A table (df, tibble) containing the values of the parameters to use (see details)

template

Path of a soil xml file to be used as a template. Optional, if not provided, the function will use a standard template depending on the STICS version.

stics_version

Name of the STICS version. Optional, used if the file argument is not provided. In this case the function uses a standard template associated to the STICS version.

sols_in_file

[Deprecated] sols_in_file is no longer supported, use template instead.

sols_param

[Deprecated] sols_param is no longer supported, use param_df instead.

sols_out_file

[Deprecated] sols_out_file is no longer supported, use file instead.

sols_nb

[Deprecated] sols_nb is no longer supported, it is now computed in the function.

Details

Please see get_stics_versions_compat() for the full list of STICS versions that can be used for the argument stics_version.

param_df is a data.frame with the following format:

Soil_name argi norg calc pH albedo q0 epc_1
USM_T1 20.35000 0.100 0.52 8.23 0.22 9.630 30
LF1 17.00000 1.900 0.00 6.70 0.22 9.360 30
LF2 17.00000 1.800 0.00 6.70 0.22 9.360 30
LAP 22.00000 2.000 0.00 6.50 0.22 9.760 25
LAS 24.05000 2.500 30.00 8.00 0.22 9.928 30
LA0 30.00675 2.300 0.50 7.50 0.22 10.400 30
LC0 22.38750 2.000 10.00 7.90 0.22 9.792 25
Vill09 25.00000 0.101 0.40 7.90 0.22 10.000 30
Vill10 14.30000 0.099 1.50 8.20 0.22 9.144 30
Vill11 11.80000 0.100 0.00 7.30 0.22 8.944 30
Vill12 14.30000 0.091 0.60 8.30 0.22 9.144 30
Vill13 16.80000 0.088 0.20 7.80 0.22 9.344 30
Vill14 15.10000 0.095 1.30 7.90 0.22 9.208 30

The first column gives the soil name, all following columns give the parameter values to put in the sols.xml file for each soil row.

The first column name must contain the keyword Soil or soil or SOIL as a prefix to be detected (as shown in the table extract above).

If not given (the default, NULL), the function returns the template as is.

Value

None

Examples


xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx")

sols_param_df <- read_params_table(file = xl_path, sheet_name = "Soils")
gen_sols_xml(file = file.path(tempdir(), "sols.xml"),
param_df = sols_param_df)


SticsRFiles documentation built on Sept. 12, 2024, 7:41 a.m.