Replace or set an input parameter from an existing STICS input file.
set_param_txt(
workspace,
param,
value,
append = FALSE,
plant_id = 1,
variety = NULL,
value_id = NULL,
stics_version = "latest",
dirpath = lifecycle::deprecated(),
add = lifecycle::deprecated(),
plant = lifecycle::deprecated(),
layer = lifecycle::deprecated()
)
set_usm_txt(
file = "new_travail.usm",
param,
value,
append = FALSE,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_station_txt(
file = "station.txt",
param,
value,
append = FALSE,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_ini_txt(
file = "ficini.txt",
param,
value,
append = FALSE,
plant_id = 1,
layer = NULL,
stics_version = "latest",
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_general_txt(
file = "tempopar.sti",
param,
value,
append = FALSE,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_tmp_txt(
file = "tempoparv6.sti",
param,
value,
append = FALSE,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_plant_txt(
file = "ficplt1.txt",
param,
value,
append = FALSE,
variety = NULL,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_tec_txt(
file = "fictec1.txt",
param,
value,
append = FALSE,
value_id = NULL,
filepath = lifecycle::deprecated(),
add = lifecycle::deprecated()
)
set_soil_txt(
file = "param.sol",
param,
value,
layer = NULL,
stics_version = "latest",
filepath = lifecycle::deprecated()
)Path of the workspace containing the STICS (txt) input files.
Vector of parameter names.
New parameter value
Boolean. Append input to existing file
The plant identifier (main crop: 1 ; associated crop: 2). Only used for plant, technical or initialization parameters (default = 1).
The plant variety to set the parameter value,
either the variety name (codevar in the plant file) or
the index (variete in the technical file).
The soil layers id or technical interventions id
An optional version name as listed in get_stics_versions_compat() return
Path (including name) of the file to modify
None
The plant parameter can be either equal to 1,
2 for the associated plant in the case of intercrop, or
c(1,2) for both Principal and associated plants.
get_var_info is a helper function that returns
all possible output variables.
If the variety is not given and if param
is a varietal parameter, the function will modify the value of
param for the simulated variety, as given
in the technical file.
gen_varmod is not used by set_param_txt.
To replace the output variables required from STICS,
please directly call gen_varmod.
# Getting example data path
path <- get_examples_path(file_type = "txt")
# Change the value of durvieF for the current variety:
set_param_txt(workspace = path, param = "durvieF", value = 245)
# Change the value of durvieF for another variety:
set_param_txt(
workspace = path, param = "durvieF",
variety = "Nefer", value = 178
)
#> ✖ Variety not found in plantfile. Possible varieties are: "DK250", "Pactol", "Cherif", "Furio", "Dunia", "Volga", "Cecilia", "DK604", "Nobilis-DE", "DK300", "Anjou285", "DK312", "DK240", "banguy", "magrite", and "clarica"
# Change the value of soil parameter "cailloux" for all layers
# or a specific one
set_param_txt(workspace = path, param = "cailloux", value = 1)
set_param_txt(workspace = path, param = "cailloux", value_id = 2, value = 2)
# Change the value of parameter "amount" for all water supply interventions
# or a specific one
set_param_txt(workspace = path, param = "amount", value = 50)
set_param_txt(workspace = path, param = "amount", value_id = 2, value = 40)