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

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.

Value

None

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_namearginorgcalcpHalbedoq0epc_1
USM_T120.350000.1000.528.230.229.63030
LF117.000001.9000.006.700.229.36030
LF217.000001.8000.006.700.229.36030
LAP22.000002.0000.006.500.229.76025
LAS24.050002.50030.008.000.229.92830
LA030.006752.3000.507.500.2210.40030
LC022.387502.00010.007.900.229.79225
Vill0925.000000.1010.407.900.2210.00030
Vill1014.300000.0991.508.200.229.14430
Vill1111.800000.1000.007.300.228.94430
Vill1214.300000.0910.608.300.229.14430
Vill1316.800000.0880.207.800.229.34430
Vill1415.100000.0951.307.900.229.20830

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.

Examples


xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx")
#> Warning: inputs_stics_example.xlsx already exists in  /var/folders/n2/pt_35rc53tdgkld9531s2tfh0000gn/T//Rtmp7KS4Yk 
#> Consider to set overwrite = TRUE to overwrite (it | them )

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)