ex_path <- get_examples_path(file_type = "xml")
# Soil file
sol_path <- file.path(ex_path, "sols.xml")
# For scalar parameters per soil
# Setting all soils "argi" values to 50
set_param_xml(sol_path, "argi", 50, overwrite = TRUE)
# Getting changed values
# get_param_xml(sol_path, "argi")
# Setting a specific value to "argi" for "solcanne" soil
set_param_xml(file = sol_path, param = "argi", values = 56,
select = "sol", select_value = "solcanne", overwrite = TRUE
)
# Getting changed values
# get_param_xml(sol_path, "argi",
# select = "sol", select_value = "solcanne"
#)
# Setting a specific values to 2 parameters "argi" and
# "norg" for "solcanne" soil
set_param_xml(sol_path, c("argi", "norg"), list(100, 150),
select = "sol", select_value = "solcanne", overwrite = TRUE
)
# Getting changed values
# get_param_xml(sol_path, c("argi", "norg"),
# select = "sol", select_value = "solcanne"
#)
# For vector parameters per soil (5 values, one per soil layer)
set_param_xml(sol_path, c("epc", "HCCF"),
select = "sol",
select_value = c("solcanne", "solbanane"),
values = list(c(20:24, 10:14), c(50:54, 40:44)),
overwrite = TRUE
)
# Getting changed values
# get_param_xml(sol_path, c("epc", "HCCF"),
# select = "sol",
# select_value = c("solcanne", "solbanane")
# )
# For specific values of vector parameters
set_param_xml(sol_path, "HCCF",
select = "sol",
select_value = "solcanne",
values = c(46.8, 48.5, 50.1),
value_id = c(1,3,5),
overwrite = TRUE
)
# Getting changed values
# get_param_xml(sol_path, "HCCF",
# select = "sol",
# select_value = "solcanne",
# value_id = c(1,3,5)
# )
# Crop management file
tec_path <- file.path(ex_path, "file_tec.xml")
# Modifying irrigations parameters
set_param_xml(tec_path, c("julapI_or_sum_upvt", "amount"),
values = list(200:215, 20:35), overwrite = TRUE
)
# Getting changed values
# get_param_xml(tec_path, c("julapI_or_sum_upvt", "amount"))
Run the code above in your browser using DataLab