R/gen_sta_xml.R
gen_sta_xml.Rd
Generate STICS sta xml file(s) from a template or an input file
gen_sta_xml(
param_df,
file = NULL,
out_dir,
stics_version = "latest",
param_table = lifecycle::deprecated(),
sta_in_file = lifecycle::deprecated(),
out_path = lifecycle::deprecated()
)
A table (df, tibble) containing the values of the parameters to use (see details)
Path of a sta xml file to be used as a template. Optional, if not provided, the function will use a standard template depending on the STICS version.
Path of the directory where to generate the file(s).
Name of the STICS version. Optional, used if
the file
argument is not provided. In this case the function uses a
standard template associated to the STICS version.
None
Please see get_stics_versions_compat()
for the full list of
STICS versions that can be used for the argument stics_version
.
param_df
is a data.frame
with the following format:
Sta_name | zr | NH3ref | latitude | patm | aclim |
climatex_sta.xml | 2.5 | 0 | 49 | 1000 | 20 |
climatex2_sta.xml | 2.8 | 0 | 49 | 1000 | 20 |
climatex3_sta.xml | 2.2 | 0 | 49 | 1000 | 20 |
The first column gives the sta file name (to be generated), all following columns give the parameter value to put in the file, and each line denotes a separate sta file (for e.g. several USMs).
The first column name must contain the keyword sta or Sta or STA as a prefix to be detected (as shown in the table extract above).
If not given (the default, NULL
), the function returns the template as is.
xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx")
#> Warning: inputs_stics_example.xlsx already exists in /var/folders/1y/56hdyx6x0_jb18k7b4ys9b6w0000gn/T//Rtmp6TMon6
#> Consider to set overwrite = TRUE to overwrite (it | them )
sta_param_df <- read_params_table(file = xl_path, sheet_name = "Station")
gen_sta_xml(out_dir = tempdir(), param_df = sta_param_df)