Read STICS model input parameters from a usm in text format (STICS input) Generally used after calling building a usm with JavaSTICS.

Read a specific STICS model input parameter file. Users would generally use the wrapper get_param_txt() instead.

get_param_txt(
  workspace,
  param = NULL,
  variety = NULL,
  exact = FALSE,
  stics_version = "latest",
  dirpath = lifecycle::deprecated(),
  ...
)

get_ini_txt(
  file = "ficini.txt",
  stics_version,
  filepath = lifecycle::deprecated()
)

get_general_txt(file = "tempopar.sti", filepath = lifecycle::deprecated())

get_tmp_txt(file = "tempoparv6.sti", filepath = lifecycle::deprecated())

get_plant_txt(
  file = "ficplt1.txt",
  variety = NULL,
  filepath = lifecycle::deprecated()
)

get_tec_txt(
  file = "fictec1.txt",
  stics_version = "latest",
  several_fert = NULL,
  several_thin = NULL,
  is_pasture = NULL,
  filepath = lifecycle::deprecated(),
  ...
)

get_soil_txt(
  file = "param.sol",
  stics_version,
  filepath = lifecycle::deprecated()
)

get_station_txt(file = "station.txt", filepath = lifecycle::deprecated())

get_usm_txt(file = "new_travail.usm", filepath = lifecycle::deprecated())

Arguments

workspace

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

param

Vector of parameter names. Optional, if not provided, the function returns an object with all parameters.

variety

Integer. The plant variety to get the parameter from.

exact

Boolean indicating if the function must return results only for exact match.

stics_version

An optional version name as listed in get_stics_versions_compat() return

dirpath

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

...

Further arguments to pass (for future-proofing only)

file

File path

filepath

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

several_fert

Is there several fertilization in the USM ? See details.

several_thin

Is there several thinning in the USM ? See details.

is_pasture

Is the plant a pasture ? See details.

Value

A list of parameters value(s), or if param = NULL a list of all parameters:

ini

Initialization parameters

general

General parameters

tec

Technical parameters

plant

Plant parameters

soil

Soil parameters

station

Station parameters

A list of parameters, depending on the file/function:

ini

Initialization parameters

general

General parameters

tec

Technical parameters

plant

Plant parameters

soil

Soil parameters

station

Station parameters

tmp

Temporary parameters

Details

If the variety is not given and a param is asked, the function will return the values for the variety that is simulated in the USM by checking the variete parameter in the technical file. If param is not provided by the user, the values from all varieties will be returned unless the user ask for a given variety.

several_fert, several_thin and is_pasture are read from the tmp file (tempoparv6.sti). get_param_txt() does it automatically. If you absolutely need to use directly get_tec_txt, please see example.

Note

Users would generally use get_param_txt to identify parameters names and values and pass them to other functions.

The functions are compatible with intercrops. Users generally only use get_param_txt(), which is a wrapper for all these functions.

See also

gen_varmod(),

get_param_txt().

Examples

path <- get_examples_path(file_type = "txt")

# Getting the interrow distance parameter value
get_param_txt(path, param = "interrang")
#> $tec
#> $tec$plant1
#> $tec$plant1$interrang
#> [1] 2
#> 
#> 
#> 

# Getting varietal parameters values
# Get the leaf lifespan of the variety used in the usm:
get_param_txt(workspace = path, param = "durvieF")
#> $plant
#> $plant$plant1
#> $plant$plant1$durvieF
#> Furio 
#>   200 
#> 
#> 
#> 
# Get the leaf lifespan of another variety available in the plant file:
get_param_txt(workspace = path, param = "durvieF", variety = "Furio")
#> $plant
#> $plant$plant1
#> $plant$plant1$durvieF
#> Furio 
#>   200 
#> 
#> 
#> 
# To get the values for several (or all) varieties, either put all varieties:
varieties <- c("Pactol", "Cherif", "Furio", "Dunia", "Volga", "Cecilia")
get_param_txt(workspace = path, param = "durvieF", variety = varieties)
#> $plant
#> $plant$plant1
#> $plant$plant1$durvieF
#>  Pactol  Cherif   Furio   Dunia   Volga Cecilia 
#>     200     200     200     200     200     200 
#> 
#> 
#> 
# Or get it from the output of the function returning all parameters:
get_param_txt(workspace = path)$plant$plant1$durvieF
#>      DK250     Pactol     Cherif      Furio      Dunia      Volga    Cecilia 
#>        200        200        200        200        200        200        200 
#>      DK604 Nobilis-DE      DK300   Anjou285      DK312      DK240     banguy 
#>        200        200        200        200        200        200        200 
#>    magrite    clarica 
#>        200        200 


if (FALSE) {
# Read the initialisation file (ficini.txt):
library(SticsRFiles)
path <- file.path(get_examples_path(file_type = "txt"), "ficini.txt")
get_ini_txt(path)

# Read the tec file directly:

# First, get the parameters from the tmp file:
tmp <- get_tmp_txt(file = file.path(get_examples_path(file_type = "txt"),
                                    "tempoparv6.sti"))
several_fert <- ifelse(tmp$option_engrais_multiple == 1, TRUE, FALSE)
several_thin <- ifelse(tmp$option_thinning == 1, TRUE, FALSE)
is_pasture <- ifelse(tmp$option_pature == 1, TRUE, FALSE)

# Then, get the technical parameters:
get_tec_txt(
  file = file.path(get_examples_path(file_type = "txt"), "fictec1.txt"),
  several_fert = several_fert, several_thin = several_thin,
  is_pasture = is_pasture
)
}