Learn R Programming

SticsRFiles (version 1.7.0)

set_param_txt: Set (replace) STICS input file parameters

Description

Replace or set an input parameter from an existing STICS input file.

Usage

set_param_txt(
  workspace,
  param,
  value,
  append = FALSE,
  plant_id = 1,
  variety = NULL,
  value_id = NULL,
  stics_version = "latest"
)

set_usm_txt(file = "new_travail.usm", param, value, append = FALSE)

set_station_txt(file = "station.txt", param, value, append = FALSE)

set_ini_txt( file = "ficini.txt", param, value, append = FALSE, plant_id = 1, value_id = NULL, stics_version = "latest" )

set_general_txt(file = "tempopar.sti", param, value, append = FALSE)

set_tmp_txt(file = "tempoparv6.sti", param, value, append = FALSE)

set_plant_txt( file = "ficplt1.txt", param, value, append = FALSE, variety = NULL )

set_tec_txt( file = "fictec1.txt", param, value, append = FALSE, value_id = NULL )

set_soil_txt( file = "param.sol", param, value, value_id = NULL, stics_version = "latest" )

Value

None

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 initialization 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

file

Path (including name) of the file to modify

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab