set_param_txt {SticsRFiles}R Documentation

Set (replace) STICS input file parameters

Description

Replace or set an input parameter from a pre-existing STICS input file.

Usage

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()
)

Arguments

workspace

Path of the workspace containing the STICS (txt) input files.

param

Vector of parameter names.

value

New parameter value

append

Boolean. Append input to existing file

plant_id

The plant identifier (main crop: 1 ; associated crop: 2). Only used for plant, technical or initialisation parameters (default = 1).

variety

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).

value_id

The soil layers id or technical interventions id

stics_version

An optional version name as listed in get_stics_versions_compat() return

dirpath

[Deprecated] dirpath is no longer supported, use workspace instead.

add

[Deprecated] add is no longer supported, use append instead.

plant

[Deprecated] plant is no longer supported, use plant_id instead.

layer

[Deprecated] layer is no longer supported, use value_id instead.

file

Path (including name) of the file to modify

filepath

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

Details

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.

Value

None

Note

gen_varmod is not used by set_param_txt. To replace the output variables required from STICS, please directly call gen_varmod.

Examples

# 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)
# 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)




[Package SticsRFiles version 1.4.0 Index]