View source: R/get_param_txt.R
get_param_txt | R Documentation |
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,
plant_id = NULL,
variety = NULL,
value_id = 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",
plant_id = NULL,
filepath = lifecycle::deprecated()
)
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. |
plant_id |
plant index (1, 2), default(NULL) calculated from from plant number in STICS initialization file |
variety |
Integer. The plant variety to get the parameter from. |
value_id |
index of technical interventions to be used to retrieve parameter values, or layer index for soil parameters |
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 |
|
... |
Further arguments to pass (for future-proofing only) |
file |
File path |
filepath |
|
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. |
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.
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 |
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.
gen_varmod()
,
get_param_txt()
.
path <- get_examples_path(file_type = "txt")
# Getting the interrow distance parameter value
get_param_txt(path, param = "interrang")
# Getting varietal parameters values
# Get the leaf lifespan of the variety used in the usm:
get_param_txt(workspace = path, param = "durvieF")
# Get the leaf lifespan of another variety available in the plant file:
get_param_txt(workspace = path, param = "durvieF", variety = "Furio")
# 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)
# Or get it from the output of the function returning all parameters:
get_param_txt(workspace = path)$plant$plant1$durvieF
# Get parameters for a specific plant
get_param_txt(workspace = path, plant_id = 1)
get_param_txt(workspace = path, param = "durvieF", plant_id = 1)
get_param_txt(workspace = path, param = "durvieF", plant_id = 1,
variety = varieties)
# Get parameters for specific interventions or soil layers
get_param_txt(workspace = path, param = "amount", value_id = c(1,3))
get_param_txt(workspace = path, param = "Hinitf", value_id = c(1,3))
get_param_txt(workspace = path, param = "epc", value_id = c(1,3))
## Not run:
# 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
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.