diff --git a/inst/extdata/src_files/xsd/V10.0/ini.xsd b/inst/extdata/src_files/xsd/V10.0/ini.xsd
new file mode 100644
index 00000000..f7346a5a
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V10.0/ini.xsd
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V10.0/sols.xsd b/inst/extdata/src_files/xsd/V10.0/sols.xsd
new file mode 100644
index 00000000..515bbae7
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V10.0/sols.xsd
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V10.0/usms.xsd b/inst/extdata/src_files/xsd/V10.0/usms.xsd
new file mode 100644
index 00000000..6eb6fba2
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V10.0/usms.xsd
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V11.0/ini.xsd b/inst/extdata/src_files/xsd/V11.0/ini.xsd
new file mode 100644
index 00000000..f7346a5a
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V11.0/ini.xsd
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V11.0/sols.xsd b/inst/extdata/src_files/xsd/V11.0/sols.xsd
new file mode 100644
index 00000000..515bbae7
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V11.0/sols.xsd
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V11.0/usms.xsd b/inst/extdata/src_files/xsd/V11.0/usms.xsd
new file mode 100644
index 00000000..6eb6fba2
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V11.0/usms.xsd
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V8.5/ini.xsd b/inst/extdata/src_files/xsd/V8.5/ini.xsd
new file mode 100644
index 00000000..fae30acf
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V8.5/ini.xsd
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V8.5/sols.xsd b/inst/extdata/src_files/xsd/V8.5/sols.xsd
new file mode 100644
index 00000000..5216d31b
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V8.5/sols.xsd
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V8.5/usms.xsd b/inst/extdata/src_files/xsd/V8.5/usms.xsd
new file mode 100644
index 00000000..54e02c8c
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V8.5/usms.xsd
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.0/ini.xsd b/inst/extdata/src_files/xsd/V9.0/ini.xsd
new file mode 100644
index 00000000..fae30acf
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.0/ini.xsd
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.0/sols.xsd b/inst/extdata/src_files/xsd/V9.0/sols.xsd
new file mode 100644
index 00000000..5216d31b
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.0/sols.xsd
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.0/usms.xsd b/inst/extdata/src_files/xsd/V9.0/usms.xsd
new file mode 100644
index 00000000..54e02c8c
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.0/usms.xsd
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.1/ini.xsd b/inst/extdata/src_files/xsd/V9.1/ini.xsd
new file mode 100644
index 00000000..fae30acf
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.1/ini.xsd
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.1/sols.xsd b/inst/extdata/src_files/xsd/V9.1/sols.xsd
new file mode 100644
index 00000000..5216d31b
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.1/sols.xsd
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.1/usms.xsd b/inst/extdata/src_files/xsd/V9.1/usms.xsd
new file mode 100644
index 00000000..54e02c8c
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.1/usms.xsd
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/inst/extdata/src_files/xsd/V9.2/ini.xsd b/inst/extdata/src_files/xsd/V9.2/ini.xsd
new file mode 100644
index 00000000..5ad50b07
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.2/ini.xsd
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V9.2/sols.xsd b/inst/extdata/src_files/xsd/V9.2/sols.xsd
new file mode 100644
index 00000000..42d4614a
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.2/sols.xsd
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/src_files/xsd/V9.2/usms.xsd b/inst/extdata/src_files/xsd/V9.2/usms.xsd
new file mode 100644
index 00000000..9698adb5
--- /dev/null
+++ b/inst/extdata/src_files/xsd/V9.2/usms.xsd
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/extdata/sti.zip b/inst/extdata/sti.zip
index 3c380354..ce855e5d 100644
Binary files a/inst/extdata/sti.zip and b/inst/extdata/sti.zip differ
diff --git a/inst/extdata/txt.zip b/inst/extdata/txt.zip
index ecf25b99..81dff603 100644
Binary files a/inst/extdata/txt.zip and b/inst/extdata/txt.zip differ
diff --git a/inst/extdata/versions/stics_versions_info.csv b/inst/extdata/versions/stics_versions_info.csv
index 194cc444..1cca30d6 100644
--- a/inst/extdata/versions/stics_versions_info.csv
+++ b/inst/extdata/versions/stics_versions_info.csv
@@ -1,9 +1,10 @@
versions;csv;obs;sti;txt;xml;xml_tmpl;xml_param;xsl;xsd;xl;study_case_1;study_case_intercrop
-V8.5.0;V8.5;BASE;BASE;V8.5;examples/V8.5;templates/V8.5;BASE;V8.5;BASE;BASE;;
-V9.0.0;V9.0;BASE;BASE;V9.0;examples/V9.0;templates/V9.0;BASE;V9.0;BASE;V9.0;BASE;
-V9.1.0;V9.1;BASE;BASE;V9.1;examples/V9.1;templates/V9.1;BASE;V9.1;BASE;BASE;;
-V9.2.0;V9.2;BASE;BASE;V9.2;examples/V9.2;templates/V9.2;BASE;V9.2;BASE;BASE;BASE;
-V10.0.0;V10.0;V10.0;BASE;V10.0;examples/V10.0;templates/V10.0;param/V10.0;V10.0;V10.0;V10.0;V10.0;V10.0
-V10.1.0;V10.1.0;V10.0;V10.1.0;V10.0;examples/V10.1.0;templates/V10.1.0;param/V10.0;V10.0;V10.0;V10.0;V10.1.0;V10.1.0
-V10.2.0;V10.1.0;V10.0;V10.1.0;V10.0;examples/V10.1.0;templates/V10.1.0;param/V10.0;V10.0;V10.0;V10.0;V10.1.0;V10.1.0
-V10.5.0;V10.1.0;V10.0;V10.1.0;V10.0;examples/V10.1.0;templates/V10.1.0;param/V10.0;V10.0;V10.0;V10.0;V10.1.0;V10.1.0
+V8.5.0;V8.5;BASE;BASE;V8.5;examples/V8.5;templates/V8.5;BASE;BASE;BASE;BASE;;
+V9.0.0;V9.0;BASE;BASE;V9.0;examples/V9.0;templates/V9.0;BASE;BASE;BASE;BASE;V9.0;
+V9.1.0;V9.1;BASE;BASE;V9.1;examples/V9.1;templates/V9.1;BASE;BASE;BASE;BASE;;
+V9.2.0;V9.2;BASE;BASE;V9.2;examples/V9.2;templates/V9.2;BASE;BASE;BASE;BASE;V9.2;
+V10.0.0;V10.0;V10.0;V10.0;V10.0;examples/V10.0;templates/V10.0;param/V10.0;V10.0;V10.0;V10.0;V10.0;V10.0
+V10.1.0;V10.1.0;V10.0;V10.0;V10.0;examples/V10.0;templates/V10.0;param/V10.0;V10.0;V10.0;V10.0;V10.0;V10.0
+V10.2.0;V10.1.0;V10.0;V10.0;V10.0;examples/V10.0;templates/V10.0;param/V10.0;V10.0;V10.0;V10.0;V10.0;V10.0
+V10.5.0;V10.1.0;V10.0;V10.0;V10.0;examples/V10.0;templates/V10.0;param/V10.0;V10.0;V10.0;V10.0;V10.0;V10.0
+V11.0.0;V11.0;V10.0;V10.0;V10.0;examples/V11.0;templates/V11.0; ;V10.0;V11.0;V10.0;V11.0;V11.0
diff --git a/inst/extdata/xl.zip b/inst/extdata/xl.zip
index 8c97963e..a16ce8b0 100644
Binary files a/inst/extdata/xl.zip and b/inst/extdata/xl.zip differ
diff --git a/inst/extdata/xml.zip b/inst/extdata/xml.zip
index 7f28b48e..8c1ab28e 100644
Binary files a/inst/extdata/xml.zip and b/inst/extdata/xml.zip differ
diff --git a/inst/extdata/xsd.zip b/inst/extdata/xsd.zip
new file mode 100644
index 00000000..12936fda
Binary files /dev/null and b/inst/extdata/xsd.zip differ
diff --git a/inst/extdata/xsl.zip b/inst/extdata/xsl.zip
index 27db7856..02877e44 100644
Binary files a/inst/extdata/xsl.zip and b/inst/extdata/xsl.zip differ
diff --git a/man/approx_vapour_pressure.Rd b/man/approx_vapour_pressure.Rd
index acfbe234..14ca3049 100644
--- a/man/approx_vapour_pressure.Rd
+++ b/man/approx_vapour_pressure.Rd
@@ -15,8 +15,14 @@ approx_vapour_pressure(mean_temp, rel_humid)
numeric vector
}
\description{
-Approximates vapour pressure as the saturated vapour pressure at the daily mean air temperature using relative humidity.
-See section 9.3 of the STICS book, as well as M. Launay's explanations on the STICS forum (\href{https://w3.avignon.inrae.fr/forge/boards/26/topics/2237?r=2243#message-2243}{link}).
+Approximates vapour pressure as the saturated vapour pressure at the daily
+mean air temperature using relative humidity.
+See section 9.3 of the STICS book, as well as M. Launay's explanations on the STICS forum
+(\href{https://w3.avignon.inrae.fr/forge/boards/26/topics/2237?r=2243#message-2243}{link}).
+}
+\examples{
+approx_vapour_pressure(15, 60)
+
}
\author{
Timothee Flutre
diff --git a/man/compute_day_from_date.Rd b/man/compute_day_from_date.Rd
index 237e53f1..51084016 100644
--- a/man/compute_day_from_date.Rd
+++ b/man/compute_day_from_date.Rd
@@ -24,13 +24,10 @@ Leap years are properly handled.
}
\examples{
-date <- as.Date("2015-02-10")
-compute_day_from_date(date = date)
-
+compute_day_from_date(date = as.Date("2015-02-10"))
compute_day_from_date(date = "2015-02-10", start_year = 2014)
-date <- as.Date("2009-02-10")
-compute_day_from_date(date = date, start_year = 2008)
+compute_day_from_date(date = as.Date("2009-02-10"), start_year = 2008)
dates <- c(as.Date("2008-02-10"), as.Date("2009-02-10"))
compute_day_from_date(date = dates, start_year = 2008)
diff --git a/man/get_dev_stages.Rd b/man/get_dev_stages.Rd
index d929d6b7..f5a32bb0 100644
--- a/man/get_dev_stages.Rd
+++ b/man/get_dev_stages.Rd
@@ -25,6 +25,13 @@ List of data.frame, one per USM, with one row per developmental stage.
}
\description{
Extracts the values of developmental stages from simulations
+}
+\examples{
+\dontrun{
+simulations <- get_sim(workspace)
+get_dev_stages(simulations, "iplts")
+}
+
}
\seealso{
\code{\link{get_sim}}
diff --git a/man/get_param_info.Rd b/man/get_param_info.Rd
index b7d71e90..e2fde703 100644
--- a/man/get_param_info.Rd
+++ b/man/get_param_info.Rd
@@ -41,4 +41,6 @@ SticsRFiles::get_param_info(keyword = "bdil")
# Find for a particular version:
SticsRFiles::get_param_info("alb", stics_version = "V9.0")
+get_param_info()
+
}
diff --git a/man/get_param_txt.Rd b/man/get_param_txt.Rd
index 4a4669a2..8120abd4 100644
--- a/man/get_param_txt.Rd
+++ b/man/get_param_txt.Rd
@@ -165,9 +165,9 @@ get_ini_txt(path)
tmp <- get_tmp_txt(
workspace = get_examples_path(file_type = "txt")
)
-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)
+several_fert <- tmp$option_engrais_multiple == 1
+several_thin <- tmp$option_thinning == 1
+is_pasture <- tmp$option_pature == 1
# Then, get the technical parameters:
get_tec_txt(
diff --git a/man/get_plant_files.Rd b/man/get_plant_files.Rd
index 5fc17ace..cdd234f6 100644
--- a/man/get_plant_files.Rd
+++ b/man/get_plant_files.Rd
@@ -9,7 +9,7 @@ get_plant_files(usms_file, usms = NULL)
\arguments{
\item{usms_file}{usms.xml file path}
-\item{usms}{usms names to get, if NULL all teh usms are taken into account}
+\item{usms}{usms names to get, if NULL all the usms are taken into account}
}
\value{
A named list with usm names containing plant files names
diff --git a/man/get_var_info.Rd b/man/get_var_info.Rd
index 448502b2..bef1d4c1 100644
--- a/man/get_var_info.Rd
+++ b/man/get_var_info.Rd
@@ -41,4 +41,7 @@ SticsRFiles::get_var_info(keyword = "lai")
# Find for a particular version:
SticsRFiles::get_var_info("lai", stics_version = "V9.0")
+
+get_var_info()
+
}
diff --git a/man/upgrade_ini_xml.Rd b/man/upgrade_ini_xml.Rd
index 17d0a0fd..9456b0fb 100644
--- a/man/upgrade_ini_xml.Rd
+++ b/man/upgrade_ini_xml.Rd
@@ -1,54 +1,31 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_ini_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_ini_xml}
\alias{upgrade_ini_xml}
-\title{Upgrading _ini.xml file(s) to a newer version}
+\title{Upgrade _ini.xml file(s) to a next major version}
\usage{
-upgrade_ini_xml(
- file,
- out_dir,
- param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE,
- ...
-)
+upgrade_ini_xml(file, out_dir, param_gen_file, overwrite = FALSE)
}
\arguments{
-\item{file}{Path of an initialization (*_ini.xml) file or a vector of}
+\item{file}{xml plant file path or a vector of}
-\item{out_dir}{Output directory path of the generated files}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
-to the file version}
-
-\item{stics_version}{Name of the STICS version (VX.Y format)}
-
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
+to the initial version}
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
-
-\item{...}{Additional input arguments}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading _ini.xml file(s) to a newer version
-}
-\details{
-See SticsRFiles::get_stics_versions_compat() for listing versions
+Upgrade _ini.xml file(s) to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_ini_xml(
file = file.path(dir_path, "file_ini.xml"),
diff --git a/man/upgrade_ini_xml_10_11.Rd b/man/upgrade_ini_xml_10_11.Rd
new file mode 100644
index 00000000..be9b0ff5
--- /dev/null
+++ b/man/upgrade_ini_xml_10_11.Rd
@@ -0,0 +1,33 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_ini_xml_10_11}
+\alias{upgrade_ini_xml_10_11}
+\title{Upgrade _ini.xml file(s) from STICS version 10 to 11}
+\usage{
+upgrade_ini_xml_10_11(file, out_dir, overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml plant file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade _ini.xml file(s) from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_ini_xml_10_11(
+ file = file.path(dir_path, "file_ini.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_ini_xml_9_10.Rd b/man/upgrade_ini_xml_9_10.Rd
new file mode 100644
index 00000000..b1279760
--- /dev/null
+++ b/man/upgrade_ini_xml_9_10.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_ini_xml_9_10}
+\alias{upgrade_ini_xml_9_10}
+\title{Upgrade _ini.xml file(s) from STICS version 9 to 10}
+\usage{
+upgrade_ini_xml_9_10(file, out_dir, param_gen_file, overwrite = FALSE)
+}
+\arguments{
+\item{file}{Path of an initialization (*_ini.xml) file or a vector of}
+
+\item{out_dir}{Output directory path of the generated files}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade _ini.xml file(s) from STICS version 9 to 10
+}
+\details{
+See SticsRFiles::get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_ini_xml_9_10(
+ file = file.path(dir_path, "file_ini.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_param_gen_xml.Rd b/man/upgrade_param_gen_xml.Rd
index ec82b0c6..e25f01d5 100644
--- a/man/upgrade_param_gen_xml.Rd
+++ b/man/upgrade_param_gen_xml.Rd
@@ -1,49 +1,33 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_param_gen_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_param_gen_xml}
\alias{upgrade_param_gen_xml}
-\title{Upgrading a param_gen.xml file to a newer version}
+\title{Upgrade a param_gen.xml file to a next major version}
\usage{
-upgrade_param_gen_xml(
- file,
- out_dir,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE
-)
+upgrade_param_gen_xml(file, out_dir, ..., overwrite = FALSE)
}
\arguments{
-\item{file}{Path of a param_gen.xml file}
-
-\item{out_dir}{Output directory path of the generated file}
+\item{file}{xml param_gen file path or a vector of}
-\item{stics_version}{Name of the STICS version (VX.Y format)}
+\item{out_dir}{Output directory path}
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
+\item{...}{additional argument(s) to pass to called functions}
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading a param_gen.xml file to a newer version
-}
-\details{
-See get_stics_versions_compat() for listing versions
+Upgrade a param_gen.xml file to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_param_gen_xml(
file = file.path(dir_path, "param_gen.xml"),
out_dir = tempdir()
)
+
}
diff --git a/man/upgrade_param_gen_xml_10_11.Rd b/man/upgrade_param_gen_xml_10_11.Rd
new file mode 100644
index 00000000..c82f1afb
--- /dev/null
+++ b/man/upgrade_param_gen_xml_10_11.Rd
@@ -0,0 +1,35 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_param_gen_xml_10_11}
+\alias{upgrade_param_gen_xml_10_11}
+\title{Upgrade a param_gen.xml file from STICS version 10 to 11}
+\usage{
+upgrade_param_gen_xml_10_11(file, out_dir, ..., overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml param_gen file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{...}{additional argument(s) to pass}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade a param_gen.xml file from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_param_gen_xml_10_11(
+ file = file.path(dir_path, "param_gen.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_param_gen_xml_9_10.Rd b/man/upgrade_param_gen_xml_9_10.Rd
new file mode 100644
index 00000000..76854b9f
--- /dev/null
+++ b/man/upgrade_param_gen_xml_9_10.Rd
@@ -0,0 +1,36 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_param_gen_xml_9_10}
+\alias{upgrade_param_gen_xml_9_10}
+\title{Upgrade a param_gen.xml file from STICS version 9 to 10}
+\usage{
+upgrade_param_gen_xml_9_10(file, out_dir, overwrite = FALSE)
+}
+\arguments{
+\item{file}{Path of a param_gen.xml file}
+
+\item{out_dir}{Output directory path of the generated file}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade a param_gen.xml file from STICS version 9 to 10
+}
+\details{
+See get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_param_gen_xml_9_10(
+ file = file.path(dir_path, "param_gen.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_param_newform_xml.Rd b/man/upgrade_param_newform_xml.Rd
index 913e1c22..2b068f75 100644
--- a/man/upgrade_param_newform_xml.Rd
+++ b/man/upgrade_param_newform_xml.Rd
@@ -1,56 +1,44 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_param_newform_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_param_newform_xml}
\alias{upgrade_param_newform_xml}
-\title{Upgrading a param_newform.xml file to a newer version}
+\title{Upgrade a param_newform.xml file to a next major version}
\usage{
upgrade_param_newform_xml(
file,
out_dir,
param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
+ ...,
overwrite = FALSE
)
}
\arguments{
-\item{file}{Path of a param_newform.xml file}
+\item{file}{xml param_newform file path or a vector of}
-\item{out_dir}{Output directory path of the generated file}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
to the file version}
-\item{stics_version}{Name of the STICS version (VX.Y format)}
+\item{...}{additional argument(s) to pass to called functions}
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
-
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading a param_newform.xml file to a newer version
-}
-\details{
-See SticsRFiles::get_stics_versions_compat() for listing versions
+Upgrade a param_newform.xml file to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_param_newform_xml(
- file = file.path(dir_path,"param_newform.xml"),
+ file = file.path(dir_path, "param_newform.xml"),
out_dir = tempdir(),
param_gen_file = file.path(dir_path, "param_gen.xml")
)
-
}
diff --git a/man/upgrade_param_newform_xml_10_11.Rd b/man/upgrade_param_newform_xml_10_11.Rd
new file mode 100644
index 00000000..b380765e
--- /dev/null
+++ b/man/upgrade_param_newform_xml_10_11.Rd
@@ -0,0 +1,35 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_param_newform_xml_10_11}
+\alias{upgrade_param_newform_xml_10_11}
+\title{Upgrade a param_newform.xml file from STICS version 10 to 11}
+\usage{
+upgrade_param_newform_xml_10_11(file, out_dir, ..., overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml param_newform file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{...}{additional argument(s) to pass}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade a param_newform.xml file from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_param_newform_xml_10_11(
+ file = file.path(dir_path, "param_newform.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_param_newform_xml_9_10.Rd b/man/upgrade_param_newform_xml_9_10.Rd
new file mode 100644
index 00000000..0c810cdc
--- /dev/null
+++ b/man/upgrade_param_newform_xml_9_10.Rd
@@ -0,0 +1,45 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_param_newform_xml_9_10}
+\alias{upgrade_param_newform_xml_9_10}
+\title{Upgrade a param_newform.xml file from STICS version 9 to 10}
+\usage{
+upgrade_param_newform_xml_9_10(
+ file,
+ out_dir,
+ param_gen_file,
+ overwrite = FALSE
+)
+}
+\arguments{
+\item{file}{Path of a param_newform.xml file}
+
+\item{out_dir}{Output directory path of the generated file}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade a param_newform.xml file from STICS version 9 to 10
+}
+\details{
+See SticsRFiles::get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_param_newform_xml_9_10(
+ file = file.path(dir_path, "param_newform.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_plt_xml.Rd b/man/upgrade_plt_xml.Rd
index f6c52859..d4aaea41 100644
--- a/man/upgrade_plt_xml.Rd
+++ b/man/upgrade_plt_xml.Rd
@@ -1,64 +1,52 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_plt_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_plt_xml}
\alias{upgrade_plt_xml}
-\title{Upgrading _plt.xml file(s) to a newer version}
+\title{Upgrade _plt.xml file(s) to a next major version}
\usage{
upgrade_plt_xml(
file,
out_dir,
- param_newform_file,
param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
+ param_newform_file,
+ ...,
overwrite = FALSE,
- ...
+ warning = TRUE
)
}
\arguments{
-\item{file}{Path of an plant (*_plt.xml) file or a vector of}
-
-\item{out_dir}{Output directory path of the generated files}
+\item{file}{xml plant file path or a vector of}
-\item{param_newform_file}{Path of the param_newform.xml file corresponding
-to the file version}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
-to the file version}
-
-\item{stics_version}{Name of the STICS version (VX.Y format)}
+to the initial version}
-\item{target_version}{Name of the STICS version to upgrade files to
-(VX.Y format)}
+\item{param_newform_file}{Path of the param_newform.xml file corresponding
+to the file version}
-\item{check_version}{Perform version consistency between \code{stics_version}
-and the file version, for finally checking if an upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
+\item{...}{additional argument(s) to pass to called functions}
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
-\item{...}{Additional input arguments}
+\item{warning}{Logical for rising warnings, FALSE otherwise}
}
\value{
None
}
\description{
-Upgrading _plt.xml file(s) to a newer version
-}
-\details{
-See get_stics_versions_compat() for listing versions
+Upgrade _plt.xml file(s) to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_plt_xml(
file = file.path(dir_path, "file_plt.xml"),
out_dir = tempdir(),
- param_newform_file = file.path(dir_path, "param_newform.xml"),
- param_gen_file = file.path(dir_path, "param_gen.xml")
+ param_gen_file = file.path(dir_path, "param_gen.xml"),
+ param_newform_file = file.path(dir_path, "param_newform.xml")
)
}
diff --git a/man/upgrade_plt_xml_10_11.Rd b/man/upgrade_plt_xml_10_11.Rd
new file mode 100644
index 00000000..e25d893f
--- /dev/null
+++ b/man/upgrade_plt_xml_10_11.Rd
@@ -0,0 +1,37 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_plt_xml_10_11}
+\alias{upgrade_plt_xml_10_11}
+\title{Upgrade _plt.xml file(s) from version 10 to 11}
+\usage{
+upgrade_plt_xml_10_11(file, out_dir, ..., overwrite = FALSE, warning = TRUE)
+}
+\arguments{
+\item{file}{xml plant file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{...}{additional argument(s) to pass}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+
+\item{warning}{Logical for rising warnings, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade _plt.xml file(s) from version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_plt_xml_10_11(
+ file = file.path(dir_path, "file_plt.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_plt_xml_9_10.Rd b/man/upgrade_plt_xml_9_10.Rd
new file mode 100644
index 00000000..f0acd65f
--- /dev/null
+++ b/man/upgrade_plt_xml_9_10.Rd
@@ -0,0 +1,50 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_plt_xml_9_10}
+\alias{upgrade_plt_xml_9_10}
+\title{Upgrade _plt.xml file(s) from STICS version 9 to 10}
+\usage{
+upgrade_plt_xml_9_10(
+ file,
+ out_dir,
+ param_gen_file,
+ param_newform_file,
+ overwrite = FALSE
+)
+}
+\arguments{
+\item{file}{Path of an plant (*_plt.xml) file or a vector of}
+
+\item{out_dir}{Output directory path of the generated files}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{param_newform_file}{Path of the param_newform.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade _plt.xml file(s) from STICS version 9 to 10
+}
+\details{
+See get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_plt_xml_9_10(
+ file = file.path(dir_path, "file_plt.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml"),
+ param_newform_file = file.path(dir_path, "param_newform.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_sols_xml.Rd b/man/upgrade_sols_xml.Rd
index 3daaff9d..c3768e05 100644
--- a/man/upgrade_sols_xml.Rd
+++ b/man/upgrade_sols_xml.Rd
@@ -1,51 +1,31 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_sols_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_sols_xml}
\alias{upgrade_sols_xml}
-\title{Upgrading a sols.xml file to a newer version}
+\title{Upgrade a sols.xml file to a next major version}
\usage{
-upgrade_sols_xml(
- file,
- out_dir,
- param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE
-)
+upgrade_sols_xml(file, out_dir, param_gen_file, overwrite = FALSE)
}
\arguments{
-\item{file}{Path of a sols.xml file}
+\item{file}{xml sols file path}
-\item{out_dir}{Output directory path of the generated file}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
to the file version}
-\item{stics_version}{Name of the STICS version (VX.Y format)}
-
-\item{target_version}{Name of the STICS version to upgrade files to
-(VX.Y format)}
-
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading a sols.xml file to a newer version
-}
-\details{
-See SticsRFiles::get_stics_versions_compat() for listing versions
+Upgrade a sols.xml file to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_sols_xml(
file = file.path(dir_path, "sols.xml"),
diff --git a/man/upgrade_sols_xml_10_11.Rd b/man/upgrade_sols_xml_10_11.Rd
new file mode 100644
index 00000000..2af06658
--- /dev/null
+++ b/man/upgrade_sols_xml_10_11.Rd
@@ -0,0 +1,33 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_sols_xml_10_11}
+\alias{upgrade_sols_xml_10_11}
+\title{Upgrade a sols.xml file from STICS version 10 to 11}
+\usage{
+upgrade_sols_xml_10_11(file, out_dir, overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml sols file path}
+
+\item{out_dir}{Output directory path}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade a sols.xml file from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_sols_xml_10_11(
+ file = file.path(dir_path, "sols.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_sols_xml_9_10.Rd b/man/upgrade_sols_xml_9_10.Rd
new file mode 100644
index 00000000..64483373
--- /dev/null
+++ b/man/upgrade_sols_xml_9_10.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_sols_xml_9_10}
+\alias{upgrade_sols_xml_9_10}
+\title{Upgrade a sols.xml file from STICS version 9 to 10}
+\usage{
+upgrade_sols_xml_9_10(file, out_dir, param_gen_file, overwrite = FALSE)
+}
+\arguments{
+\item{file}{Path of a sols.xml file}
+
+\item{out_dir}{Output directory path of the generated file}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade a sols.xml file from STICS version 9 to 10
+}
+\details{
+See SticsRFiles::get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_sols_xml_9_10(
+ file = file.path(dir_path, "sols.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_sta_xml.Rd b/man/upgrade_sta_xml.Rd
index 4816e372..b8b721b2 100644
--- a/man/upgrade_sta_xml.Rd
+++ b/man/upgrade_sta_xml.Rd
@@ -1,54 +1,31 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_sta_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_sta_xml}
\alias{upgrade_sta_xml}
-\title{Upgrading _sta.xml file(s) to a newer version}
+\title{Upgrade _sta.xml file(s) to a next major version}
\usage{
-upgrade_sta_xml(
- file,
- out_dir,
- param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE,
- ...
-)
+upgrade_sta_xml(file, out_dir, param_gen_file, overwrite = FALSE)
}
\arguments{
-\item{file}{Path of a station (*_sta.xml) file or a vector of}
+\item{file}{xml plant file path or a vector of}
-\item{out_dir}{Output directory path of the generated files}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
-to the file version}
-
-\item{stics_version}{Name of the STICS version (VX.Y format)}
-
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
+to the initial version}
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
-
-\item{...}{Additional input arguments}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading _sta.xml file(s) to a newer version
-}
-\details{
-See SticsRFiles::get_stics_versions_compat() for listing versions
+Upgrade _sta.xml file(s) to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_sta_xml(
file = file.path(dir_path, "file_sta.xml"),
diff --git a/man/upgrade_sta_xml_10_11.Rd b/man/upgrade_sta_xml_10_11.Rd
new file mode 100644
index 00000000..88d4ccfc
--- /dev/null
+++ b/man/upgrade_sta_xml_10_11.Rd
@@ -0,0 +1,33 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_sta_xml_10_11}
+\alias{upgrade_sta_xml_10_11}
+\title{Upgrade _sta.xml file(s) from STICS version 10 to 11}
+\usage{
+upgrade_sta_xml_10_11(file, out_dir, overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml plant file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade _sta.xml file(s) from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_sta_xml_10_11(
+ file = file.path(dir_path, "file_sta.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_sta_xml_9_10.Rd b/man/upgrade_sta_xml_9_10.Rd
new file mode 100644
index 00000000..1f4e79c1
--- /dev/null
+++ b/man/upgrade_sta_xml_9_10.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_sta_xml_9_10}
+\alias{upgrade_sta_xml_9_10}
+\title{Upgrade _sta.xml file(s) from STICS version 9 to 10}
+\usage{
+upgrade_sta_xml_9_10(file, out_dir, param_gen_file, overwrite = FALSE)
+}
+\arguments{
+\item{file}{Path of a station (*_sta.xml) file or a vector of}
+
+\item{out_dir}{Output directory path of the generated files}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade _sta.xml file(s) from STICS version 9 to 10
+}
+\details{
+See SticsRFiles::get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_sta_xml_9_10(
+ file = file.path(dir_path, "file_sta.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_tec_xml.Rd b/man/upgrade_tec_xml.Rd
index 0497f2f8..eddbdd87 100644
--- a/man/upgrade_tec_xml.Rd
+++ b/man/upgrade_tec_xml.Rd
@@ -1,64 +1,48 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_tec_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_tec_xml}
\alias{upgrade_tec_xml}
-\title{Upgrading _tec.xml file(s) to a newer version}
+\title{Upgrade _tec.xml file(s) to a next major version}
\usage{
upgrade_tec_xml(
file,
out_dir,
- param_newform_file,
param_gen_file,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE,
- ...
+ param_newform_file,
+ ...,
+ overwrite = FALSE
)
}
\arguments{
-\item{file}{Path of a crop management (*_tec.xml) file or a vector of}
-
-\item{out_dir}{Output directory path of the generated files}
+\item{file}{xml technical file path or a vector of}
-\item{param_newform_file}{Path of the param_newform.xml file corresponding
-to the file version}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
-to the file version}
+to the initial version}
-\item{stics_version}{Name of the STICS version (VX.Y format)}
-
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
-
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
+\item{param_newform_file}{Path of the param_newform.xml file corresponding
+to the file version}
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{...}{additional argument(s) to pass to called functions}
-\item{...}{Additional input arguments}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading _tec.xml file(s) to a newer version
-}
-\details{
-See get_stics_versions_compat() for listing versions
+Upgrade _tec.xml file(s) to a next major version
}
\examples{
-
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_tec_xml(
file = file.path(dir_path, "file_tec.xml"),
out_dir = tempdir(),
- param_newform_file = file.path(dir_path, "param_newform.xml"),
- param_gen_file = file.path(dir_path, "param_gen.xml")
+ param_gen_file = file.path(dir_path, "param_gen.xml"),
+ param_newform_file = file.path(dir_path, "param_newform.xml")
)
}
diff --git a/man/upgrade_tec_xml_10_11.Rd b/man/upgrade_tec_xml_10_11.Rd
new file mode 100644
index 00000000..c397fcec
--- /dev/null
+++ b/man/upgrade_tec_xml_10_11.Rd
@@ -0,0 +1,35 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_tec_xml_10_11}
+\alias{upgrade_tec_xml_10_11}
+\title{Upgrade _tec.xml file(s) from version 10 to 11}
+\usage{
+upgrade_tec_xml_10_11(file, out_dir, ..., overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml technical file path or a vector of}
+
+\item{out_dir}{Output directory path}
+
+\item{...}{additional argument(s) to pass}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade _tec.xml file(s) from version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_tec_xml_10_11(
+ file = file.path(dir_path, "file_tec.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_tec_xml_9_10.Rd b/man/upgrade_tec_xml_9_10.Rd
new file mode 100644
index 00000000..444cf0e5
--- /dev/null
+++ b/man/upgrade_tec_xml_9_10.Rd
@@ -0,0 +1,50 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_tec_xml_9_10}
+\alias{upgrade_tec_xml_9_10}
+\title{Upgrade _tec.xml file(s) from STICS version 9 to 10}
+\usage{
+upgrade_tec_xml_9_10(
+ file,
+ out_dir,
+ param_gen_file,
+ param_newform_file,
+ overwrite = FALSE
+)
+}
+\arguments{
+\item{file}{Path of a crop management (*_tec.xml) file or a vector of}
+
+\item{out_dir}{Output directory path of the generated files}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{param_newform_file}{Path of the param_newform.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade _tec.xml file(s) from STICS version 9 to 10
+}
+\details{
+See get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_tec_xml_9_10(
+ file = file.path(dir_path, "file_tec.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml"),
+ param_newform_file = file.path(dir_path, "param_newform.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_usms_xml.Rd b/man/upgrade_usms_xml.Rd
index 9232da08..8d1fff05 100644
--- a/man/upgrade_usms_xml.Rd
+++ b/man/upgrade_usms_xml.Rd
@@ -1,54 +1,31 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_usms_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_usms_xml}
\alias{upgrade_usms_xml}
-\title{Upgrading a usms.xml file to a newer version}
+\title{Upgrade a usms.xml file to a next major version}
\usage{
-upgrade_usms_xml(
- file,
- out_dir,
- param_gen_file,
- obs_dir = NULL,
- stics_version = "V9.2",
- target_version = "V10.0",
- check_version = TRUE,
- overwrite = FALSE
-)
+upgrade_usms_xml(file, out_dir, param_gen_file, overwrite = FALSE)
}
\arguments{
-\item{file}{Path of a usms.xml file}
+\item{file}{xml usms file path}
-\item{out_dir}{Output directory path of the generated file}
+\item{out_dir}{Output directory path}
\item{param_gen_file}{Path of the param_gen.xml file corresponding
to the file version}
-\item{obs_dir}{Directory path of the observation data files}
-
-\item{stics_version}{Name of the STICS version (VX.Y format)}
-
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
-
-\item{check_version}{Perform version consistency with in stics_version input
-with the file version and finally checking if the upgrade is possible
-allowed to the target_version. If TRUE, param_gen_file is mandatory.}
-
-\item{overwrite}{logical (optional),
-TRUE for overwriting file if it exists, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading a usms.xml file to a newer version
-}
-\details{
-See get_stics_versions_compat() for listing versions
+Upgrade a usms.xml file to a next major version
}
\examples{
-dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
upgrade_usms_xml(
file = file.path(dir_path, "usms.xml"),
diff --git a/man/upgrade_usms_xml_10_11.Rd b/man/upgrade_usms_xml_10_11.Rd
new file mode 100644
index 00000000..1f95dbbf
--- /dev/null
+++ b/man/upgrade_usms_xml_10_11.Rd
@@ -0,0 +1,33 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v10_v11.R
+\name{upgrade_usms_xml_10_11}
+\alias{upgrade_usms_xml_10_11}
+\title{Upgrade a usms.xml file from STICS version 10 to 11}
+\usage{
+upgrade_usms_xml_10_11(file, out_dir, overwrite = FALSE)
+}
+\arguments{
+\item{file}{xml usms file path}
+
+\item{out_dir}{Output directory path}
+
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
+}
+\value{
+None
+}
+\description{
+Upgrade a usms.xml file from STICS version 10 to 11
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V10.0")
+
+upgrade_usms_xml_10_11(
+ file = file.path(dir_path, "usms.xml"),
+ out_dir = tempdir()
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_usms_xml_9_10.Rd b/man/upgrade_usms_xml_9_10.Rd
new file mode 100644
index 00000000..39affc6a
--- /dev/null
+++ b/man/upgrade_usms_xml_9_10.Rd
@@ -0,0 +1,40 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/upgrade_v9_v10.R
+\name{upgrade_usms_xml_9_10}
+\alias{upgrade_usms_xml_9_10}
+\title{Upgrade a usms.xml file from STICS version 9 to 10}
+\usage{
+upgrade_usms_xml_9_10(file, out_dir, param_gen_file, overwrite = FALSE)
+}
+\arguments{
+\item{file}{Path of a usms.xml file}
+
+\item{out_dir}{Output directory path of the generated file}
+
+\item{param_gen_file}{Path of the param_gen.xml file corresponding
+to the file version}
+
+\item{overwrite}{logical (optional),
+TRUE for overwriting file if it exists, FALSE otherwise}
+}
+\value{
+None
+}
+\description{
+Upgrade a usms.xml file from STICS version 9 to 10
+}
+\details{
+See get_stics_versions_compat() for listing versions
+}
+\examples{
+\dontrun{
+dir_path <- get_examples_path(file_type = "xml", stics_version = "V9.2")
+
+upgrade_usms_xml_9_10(
+ file = file.path(dir_path, "usms.xml"),
+ out_dir = tempdir(),
+ param_gen_file = file.path(dir_path, "param_gen.xml")
+)
+}
+}
+\keyword{internal}
diff --git a/man/upgrade_workspace_xml.Rd b/man/upgrade_workspace_xml.Rd
index 8bf2fa04..4a0561d6 100644
--- a/man/upgrade_workspace_xml.Rd
+++ b/man/upgrade_workspace_xml.Rd
@@ -1,64 +1,47 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/upgrade_workspace_xml.R
+% Please edit documentation in R/upgrade_xml_files.R
\name{upgrade_workspace_xml}
\alias{upgrade_workspace_xml}
-\title{Upgrading XML files of a JavaSTICS workspace directory
-to a newer STICS version format}
+\title{Upgrade a Javastics STICS xml workspace directory to a next major version}
\usage{
upgrade_workspace_xml(
workspace,
- javastics,
out_dir,
- stics_version = "V9.2",
- target_version = "V10.0",
- plant = FALSE,
+ ...,
+ javastics = NULL,
overwrite = FALSE,
- ...
+ verbose = FALSE
)
}
\arguments{
-\item{workspace}{Path of a JavaSTICS workspace}
+\item{workspace}{JavaStics xml workspace path}
-\item{javastics}{Path of JavaSTICS containing the STICS version corresponding
-to the version of the files to be converted}
-
-\item{out_dir}{Output directory of the generated files}
+\item{out_dir}{Output directory path}
-\item{stics_version}{Name of the STICS version (VX.Y format)}
+\item{...}{additional argument(s) to pass to called functions}
-\item{target_version}{Name of the STICS version to upgrade files
-to (VX.Y format)}
-
-\item{plant}{logical (optional), TRUE for upgrading plant files if a "plant"
-sub-directory of workspace exists, FALSE otherwise}
+\item{javastics}{Path of JavaSTICS containing the STICS version corresponding
+to the version of the files to be converted (optional)}
-\item{overwrite}{logical (optional),
-TRUE for overwriting files if they exist, FALSE otherwise}
+\item{overwrite}{Logical TRUE for overwriting files,
+FALSE otherwise (default)}
-\item{...}{Additional input arguments}
+\item{verbose}{logical, TRUE for displaying a copy message
+FALSE otherwise (default)}
}
\value{
None
}
\description{
-Upgrading XML files of a JavaSTICS workspace directory
-to a newer STICS version format
-}
-\details{
-\itemize{
-\item See SticsRFiles::get_stics_versions_compat() for listing versions
-\item If general parameters files exist in \code{workspace}, they are also upgraded.
-In that case, residues parameters values are kept and might not be adapted
-to the target model version.
-\item Weather data and observations files are fully copied to \code{out_dir}
-}
+Upgrade a Javastics STICS xml workspace directory to a next major version
}
\examples{
\dontrun{
upgrade_workspace_xml(
workspace = "/path/to/JavaSTICS/workspace",
- javastics = "/path/to/JavaSTICS/folder",
- out_dir = "/path/to/an/output/directory"
+ out_dir = "/path/to/an/output/directory",
+ javastics = "/path/to/JavaSTICS/folder"
)
}
+
}
diff --git a/tests/testthat/test-exist_param.R b/tests/testthat/test-exist_param.R
index e08f7f13..f3ce3b04 100644
--- a/tests/testthat/test-exist_param.R
+++ b/tests/testthat/test-exist_param.R
@@ -1,4 +1,3 @@
-stics_version <- get_stics_versions_compat()$latest_version
xml_sols <- file.path(get_examples_path(file_type = "xml"), "sols.xml")
xml_doc <- xmldocument(xml_sols)
@@ -9,7 +8,9 @@ context("Exist param ")
test_that("exist parameter", {
expect_true(exists_param(xml_doc, "cfes"))
- expect_vector(exists_param(xml_doc, c("cfes", "mulchbat")),
- ptype = NULL, size = 2
+ expect_vector(
+ exists_param(xml_doc, c("cfes", "mulchbat")),
+ ptype = NULL,
+ size = 2
)
})
diff --git a/tests/testthat/test-gen_tec_xml.R b/tests/testthat/test-gen_tec_xml.R
index afe4705a..db978b2f 100644
--- a/tests/testthat/test-gen_tec_xml.R
+++ b/tests/testthat/test-gen_tec_xml.R
@@ -100,7 +100,7 @@ xl_fert_values <- dplyr::select(
tec_param[4, ],
starts_with(sort(names(xml_fert_values)))
) %>%
- dplyr::select_if(~ !any(is.na(.)))
+ dplyr::select_if(~ !anyNA(.))
xl_names <- sort(unique(gsub(
@@ -117,7 +117,7 @@ xl_fert_values <- dplyr::select(
tec_param[4, ],
starts_with(common_names)
) %>%
- dplyr::select_if(~ !any(is.na(.)))
+ dplyr::select_if(~ !anyNA(.))
context("Comparing table values vs xml tec file values")
diff --git a/tests/testthat/test-gen_varmod.R b/tests/testthat/test-gen_varmod.R
index 80c43e24..dde805bb 100644
--- a/tests/testthat/test-gen_varmod.R
+++ b/tests/testthat/test-gen_varmod.R
@@ -1,7 +1,9 @@
context("Creating a varmod file to latest version")
out_dir <- file.path(tempdir(), "varmod")
-if (!dir.exists(out_dir)) dir.create(out_dir)
+if (!dir.exists(out_dir)) {
+ dir.create(out_dir)
+}
gen_varmod(out_dir, "lai(n)")
diff --git a/tests/testthat/test-get_cultivars_param.R b/tests/testthat/test-get_cultivars_param.R
index c1a3d031..557419fc 100644
--- a/tests/testthat/test-get_cultivars_param.R
+++ b/tests/testthat/test-get_cultivars_param.R
@@ -14,5 +14,5 @@ test_that("type, data.frame", {
context("Checking presence of row names")
test_that("rownames", {
- expect_identical(!is.null(rownames(cv_param_df)), TRUE)
+ expect_true(!is.null(rownames(cv_param_df)))
})
diff --git a/tests/testthat/test-get_files_list.R b/tests/testthat/test-get_files_list.R
index 41030489..8c2ffda5 100644
--- a/tests/testthat/test-get_files_list.R
+++ b/tests/testthat/test-get_files_list.R
@@ -32,7 +32,7 @@ test_that("one name", {
context("testing returned object type")
test_that("is list", {
- expect_true(is.list(usms_files))
+ expect_type(usms_files, "list")
})
context("Checking list fields types")
@@ -46,14 +46,14 @@ context("Checking if mod files exist")
test_that("mod files exist in files", {
usms_files <- get_files_list(workspace_path, use_mod_files = TRUE)
- expect_true(
+ expect_gt(
length(
grep(
pattern = "\\.mod$",
x = usms_files[["bou00t1"]][["paths"]]
)
- ) >
- 0
+ ),
+ 0
)
})
diff --git a/tests/testthat/test-get_is_os_name.R b/tests/testthat/test-get_is_os_name.R
index a8b349b2..3bca4b67 100644
--- a/tests/testthat/test-get_is_os_name.R
+++ b/tests/testthat/test-get_is_os_name.R
@@ -1,7 +1,7 @@
context("Is OS name")
test_that("Is OS name", {
- expect_equal(length(is_os_name()), 4)
+ expect_length(is_os_name(), 4)
expect_type(is_os_name("windows"), "logical")
expect_type(is_os_name("linux"), "logical")
expect_type(is_os_name("mac"), "logical")
diff --git a/tests/testthat/test-get_obs.R b/tests/testthat/test-get_obs.R
index 72e7cda2..3088b4c5 100644
--- a/tests/testthat/test-get_obs.R
+++ b/tests/testthat/test-get_obs.R
@@ -1,6 +1,5 @@
options(warn = -1)
stics_version <- get_stics_versions_compat()$latest_version
-host <- "github.com"
context("reading observations")
@@ -48,7 +47,7 @@ meas_mixed3 <- get_obs(workspace = path_mixed, usms_file = usms_path)
test_that("filtering observation list works", {
- expect_equal(length(meas_banana), 1)
+ expect_length(meas_banana, 1)
})
test_that("filtering observation list return a list of data.frame", {
diff --git a/tests/testthat/test-get_options_choices.R b/tests/testthat/test-get_options_choices.R
index 50608d44..887e8fbb 100644
--- a/tests/testthat/test-get_options_choices.R
+++ b/tests/testthat/test-get_options_choices.R
@@ -6,7 +6,7 @@ xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml")
test_that("Option choice", {
expect_equal(
length(unlist(get_options_choices(xml_path), use.names = FALSE)),
- 93
+ 95
)
expect_equal(
length(unlist(
diff --git a/tests/testthat/test-get_options_names.R b/tests/testthat/test-get_options_names.R
index ab5db52f..f1a3ce38 100644
--- a/tests/testthat/test-get_options_names.R
+++ b/tests/testthat/test-get_options_names.R
@@ -1,13 +1,16 @@
stics_version <- get_stics_versions_compat()$latest_version
-context("Reaserching option names")
+if (get_version_num(stics_version) < get_version_num(11)) {
+ options_number <- 45
+} else {
+ options_number <- 46
+}
+
+context("Searching option names")
xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml")
-test_that("Reaserching option names", {
- expect_equal(length(get_options_names(xml_path)), 45)
- expect_equal(
- length(get_options_names(xml_path, c("codemonocot", "codlainet"))),
- 2
- )
+test_that("Researching option names", {
+ expect_length(get_options_names(xml_path), options_number)
+ expect_length(get_options_names(xml_path, c("codemonocot", "codlainet")), 2)
})
diff --git a/tests/testthat/test-get_param_bounds.R b/tests/testthat/test-get_param_bounds.R
index f51b9c85..8276eeb4 100644
--- a/tests/testthat/test-get_param_bounds.R
+++ b/tests/testthat/test-get_param_bounds.R
@@ -9,19 +9,15 @@ xml_file <- file.path(
)
xml_doc <- xmldocument(xml_file)
test_that("Researching parameter bounds", {
- expect_equal(length(get_param_bounds(xml_doc, "profhum", "min")), 2)
- expect_equal(
- length(
- suppressWarnings(get_param_bounds(xml_doc, "profhum"))
- ),
+ expect_length(get_param_bounds(xml_doc, "profhum", "min"), 2)
+ expect_length(
+ suppressWarnings(get_param_bounds(xml_doc, "profhum")),
3
)
expect_warning(length(get_param_bounds(xml_doc, "profhum")))
- expect_equal(
- length(
- suppressWarnings(
- get_param_bounds(xml_doc, "profhum", c("min", "max"))
- )
+ expect_length(
+ suppressWarnings(
+ get_param_bounds(xml_doc, "profhum", c("min", "max"))
),
3
)
diff --git a/tests/testthat/test-get_param_info.R b/tests/testthat/test-get_param_info.R
index d5d1d3ca..8fb0e7c0 100644
--- a/tests/testthat/test-get_param_info.R
+++ b/tests/testthat/test-get_param_info.R
@@ -10,8 +10,7 @@ empty_df <- data.frame(
max = character(0),
definition = character(0),
unit = character(0),
- cultivar = logical(0),
- stringsAsFactors = FALSE
+ cultivar = logical(0)
)
@@ -20,7 +19,7 @@ p <- get_examples_path(file_type = "csv")
lines_inputs <- readLines(file.path(p, "inputs.csv"))
df_inputs <- get_param_info()
test_that("getting all parameters from inputs.csv", {
- testthat::expect_equal(length(lines_inputs), dim(df_inputs)[1])
+ testthat::expect_length(lines_inputs, dim(df_inputs)[1])
})
# Testing empty result
@@ -34,14 +33,14 @@ test_that("giving a unknown variable name returns a 0 row data", {
stics_version = stics_version
)
- testthat::expect_equal(nrow(empty_df), nrow(empty_df_var))
- testthat::expect_equal(length(empty_df), length(empty_df_var))
- testthat::expect_equal(nrow(empty_df), nrow(empty_df_keyword))
- testthat::expect_equal(length(empty_df), length(empty_df_keyword))
+ testthat::expect_identical(nrow(empty_df), nrow(empty_df_var))
+ testthat::expect_length(empty_df, length(empty_df_var))
+ testthat::expect_identical(nrow(empty_df), nrow(empty_df_keyword))
+ testthat::expect_length(empty_df, length(empty_df_keyword))
})
-
+version_num <- get_version_num(stics_version)
test_that("fuzzy name", {
- if (get_version_num() < get_version_num(10)) {
+ if (version_num < get_version_num(10)) {
lai_params <-
c(
"lai0",
@@ -65,7 +64,7 @@ test_that("fuzzy name", {
"lairesiduel",
"flai"
)
- } else {
+ } else if (version_num < get_version_num(11)) {
lai_params <-
c(
"cielclair",
@@ -122,6 +121,32 @@ test_that("fuzzy name", {
"udlaimax",
"vlaimax"
)
+ } else {
+ lai_params <-
+ c(
+ "cielclair",
+ "codeclaircie",
+ "codelaitr",
+ "codlainet",
+ "dlaimax",
+ "dlaimaxbrut",
+ "dlaimin",
+ "flai",
+ "inilai",
+ "juleclair",
+ "lai0",
+ "laicomp",
+ "laidebeff",
+ "laieffeuil",
+ "laiplantule",
+ "lairesiduel",
+ "pentlaimax",
+ "seuilLAIapex",
+ "splaimax",
+ "splaimin",
+ "udlaimax",
+ "vlaimax"
+ )
}
testthat::expect_equal(
get_param_info("lai", stics_version = stics_version)$name,
@@ -130,9 +155,8 @@ test_that("fuzzy name", {
})
test_that("regex name", {
- testthat::expect_equal(
- get_param_info("^lai")$name,
- c(
+ if (version_num < get_version_num(11)) {
+ lai_params <- c(
"lai",
"lai0",
"laicomp",
@@ -161,7 +185,17 @@ test_that("regex name", {
"lairesiduel(8)",
"lairesiduel(9)"
)
- )
+ } else {
+ lai_params <- c(
+ "lai0",
+ "laicomp",
+ "laidebeff",
+ "laieffeuil",
+ "laiplantule",
+ "lairesiduel"
+ )
+ }
+ testthat::expect_equal(get_param_info("^lai")$name, lai_params)
})
@@ -174,10 +208,15 @@ test_that("different STICS versions", {
"vlaimax",
stics_version = complete_version_num("V9.2")
)
+ v_10 <- get_param_info(
+ "vlaimax",
+ stics_version = complete_version_num("V10.0")
+ )
vlast <- get_param_info("vlaimax", stics_version = stics_version)
testthat::expect_equal(attr(v_90, "version"), "V9.0.0")
testthat::expect_equal(attr(v_92, "version"), "V9.2.0")
+ testthat::expect_equal(attr(v_10, "version"), "V10.0.0")
testthat::expect_equal(attr(vlast, "version"), stics_version)
# Set both versions to the same value for comparison:
diff --git a/tests/testthat/test-get_param_ini.R b/tests/testthat/test-get_param_ini.R
index 4a663c09..000cb97a 100644
--- a/tests/testthat/test-get_param_ini.R
+++ b/tests/testthat/test-get_param_ini.R
@@ -1,5 +1,5 @@
stics_version <- get_stics_versions_compat()$latest_version
-version_num <- get_version_num()
+version_num <- get_version_num(stics_version)
xml_path <- file.path(
get_examples_path("xml", stics_version = stics_version),
diff --git a/tests/testthat/test-get_param_newform.R b/tests/testthat/test-get_param_newform.R
index e0050998..aeab0712 100644
--- a/tests/testthat/test-get_param_newform.R
+++ b/tests/testthat/test-get_param_newform.R
@@ -1,5 +1,5 @@
stics_version <- get_stics_versions_compat()$latest_version
-version_num <- get_version_num()
+version_num <- get_version_num(stics_version)
xml_path <- file.path(
get_examples_path("xml", stics_version = stics_version),
diff --git a/tests/testthat/test-get_sim.R b/tests/testthat/test-get_sim.R
index e6ecd510..f13f32cb 100644
--- a/tests/testthat/test-get_sim.R
+++ b/tests/testthat/test-get_sim.R
@@ -2,8 +2,6 @@ options(warn = -1)
stics_version <- get_stics_versions_compat()$latest_version
-host <- "github.com"
-
context("get model outputs")
path <- get_examples_path(file_type = "sti", stics_version = stics_version)
diff --git a/tests/testthat/test-get_soils_list.R b/tests/testthat/test-get_soils_list.R
index 0dd558d2..8e7f91be 100644
--- a/tests/testthat/test-get_soils_list.R
+++ b/tests/testthat/test-get_soils_list.R
@@ -15,8 +15,8 @@ context("Getting returned type")
test_that("type, character vector", {
expect_is(soils_names_usms, "character")
expect_is(soils_names_sols, "character")
- expect_equal(length(soils_names_usms), 26)
- expect_equal(length(soils_names_sols), 33)
+ expect_length(soils_names_usms, 26)
+ expect_length(soils_names_sols, 33)
})
diff --git a/tests/testthat/test-get_stics_version_compat.R b/tests/testthat/test-get_stics_version_compat.R
new file mode 100644
index 00000000..95f39ed0
--- /dev/null
+++ b/tests/testthat/test-get_stics_version_compat.R
@@ -0,0 +1,18 @@
+versions <- get_stics_versions_compat()
+latest <- get_stics_versions_compat()$latest_version
+
+test_that("latest version", {
+ expect_equal(versions$versions_list[length(versions$versions_list)], latest)
+})
+
+test_that("latest version", {
+ expect_equal(get_stics_versions_compat(0), latest)
+ expect_equal(
+ get_stics_versions_compat(-1),
+ versions$versions_list[length(versions$versions_list) - 1]
+ )
+ expect_equal(
+ get_stics_versions_compat(1),
+ versions$versions_list[1]
+ )
+})
diff --git a/tests/testthat/test-get_usms_list.R b/tests/testthat/test-get_usms_list.R
index f7f91317..b16cb45d 100644
--- a/tests/testthat/test-get_usms_list.R
+++ b/tests/testthat/test-get_usms_list.R
@@ -12,7 +12,7 @@ context("Getting returned type")
test_that("type, character vector", {
expect_is(usms_names, "character")
- expect_equal(length(get_usms_list(file = xml_usms)), 44)
+ expect_length(get_usms_list(file = xml_usms), 44)
})
diff --git a/tests/testthat/test-get_var_info.R b/tests/testthat/test-get_var_info.R
index 4a1e15e7..c1ac46ab 100644
--- a/tests/testthat/test-get_var_info.R
+++ b/tests/testthat/test-get_var_info.R
@@ -10,8 +10,7 @@ empty_df <- data.frame(
name = character(0),
definition = character(0),
unit = character(0),
- type = character(0),
- stringsAsFactors = FALSE
+ type = character(0)
)
# getting all parameters
@@ -19,7 +18,7 @@ p <- get_examples_path(file_type = "csv")
lines_outputs <- readLines(file.path(p, "outputs.csv"))
df_outputs <- get_var_info()
test_that("getting all variables from outputs.csv", {
- testthat::expect_equal(length(lines_outputs), dim(df_outputs)[1])
+ testthat::expect_length(lines_outputs, dim(df_outputs)[1])
})
# Testing empty result
@@ -27,10 +26,10 @@ test_that("giving a unknown variable name returns a 0 row data", {
empty_df_var <- get_var_info("myunknownvariable")
empty_df_keyword <- get_var_info(keyword = "myunknownvariable")
- testthat::expect_equal(nrow(empty_df), nrow(empty_df_var))
- testthat::expect_equal(length(empty_df), length(empty_df_var))
- testthat::expect_equal(nrow(empty_df), nrow(empty_df_keyword))
- testthat::expect_equal(length(empty_df), length(empty_df_keyword))
+ testthat::expect_identical(nrow(empty_df), nrow(empty_df_var))
+ testthat::expect_length(empty_df, length(empty_df_var))
+ testthat::expect_identical(nrow(empty_df), nrow(empty_df_keyword))
+ testthat::expect_length(empty_df, length(empty_df_keyword))
})
var_lai_df <- data.frame(
@@ -40,8 +39,7 @@ var_lai_df <- data.frame(
"reduction factor on leaf growth due to water excess"
),
unit = c("SD", "0-1"),
- type = c("real", "real"),
- stringsAsFactors = FALSE
+ type = c("real", "real")
)
keyword_lai_df <- data.frame(
@@ -54,8 +52,7 @@ keyword_lai_df <- data.frame(
)
),
unit = c("SD", "degreeC"),
- type = c("real", "real"),
- stringsAsFactors = FALSE
+ type = c("real", "real")
)
# Testing result for searching a variable name using lai
@@ -86,8 +83,7 @@ var_etmetr_df <- data.frame(
name = "cep2",
definition = "cumulative transpiration over the cropping season of plants 1 and 2",
unit = "mm",
- type = "real",
- stringsAsFactors = FALSE
+ type = "real"
)
# Testing with different versions: last , previous
diff --git a/tests/testthat/test-get_version_num.R b/tests/testthat/test-get_version_num.R
new file mode 100644
index 00000000..47636fe7
--- /dev/null
+++ b/tests/testthat/test-get_version_num.R
@@ -0,0 +1,31 @@
+test_that("Get version number as svlist object", {
+ expect_s3_class(get_version_num("10"), "svlist")
+ expect_s3_class(get_version_num("V10"), "svlist")
+ expect_s3_class(get_version_num("v10"), "svlist")
+ expect_s3_class(get_version_num(10), "svlist")
+ ver <- get_version_num("10")
+ expect_equal(ver, get_version_num("10.0"))
+ expect_equal(ver, get_version_num("10.0.0"))
+ expect_equal(ver, get_version_num(10))
+})
+
+test_that("Get version number as character object", {
+ expect_true(inherits(get_version_num("10", numeric = FALSE), "character"))
+ expect_true(inherits(get_version_num(10, numeric = FALSE), "character"))
+ ver <- get_version_num("10", numeric = FALSE)
+ expect_identical(ver, get_version_num("10.0", numeric = FALSE))
+ expect_identical(ver, get_version_num("v10.0", numeric = FALSE))
+ expect_identical(ver, get_version_num("V10.0", numeric = FALSE))
+ expect_identical(ver, get_version_num("10.0.0", numeric = FALSE))
+ expect_identical(ver, get_version_num(10, numeric = FALSE))
+})
+
+
+test_that("Comparing versions with svlist objects", {
+ expect_true(get_version_num("11") > get_version_num("10"))
+ expect_true(get_version_num("v11") > get_version_num("v10"))
+ expect_true(get_version_num("V11") > get_version_num("V10"))
+ expect_true(get_version_num("11") > get_version_num("10.1"))
+ expect_true(get_version_num(11) > get_version_num(10))
+ expect_true(get_version_num(11) > get_version_num(10.1))
+})
diff --git a/tests/testthat/test-get_xml_doc_example.R b/tests/testthat/test-get_xml_doc_example.R
index a315b5b0..175a6ded 100644
--- a/tests/testthat/test-get_xml_doc_example.R
+++ b/tests/testthat/test-get_xml_doc_example.R
@@ -4,7 +4,7 @@ context("get example doc")
usm_doc <- get_xml_doc_example("usms.xml")
test_that("get example doc", {
- expect_equal(usm_doc@name, "usms.xml")
+ expect_identical(usm_doc@name, "usms.xml")
expect_error(get_xml_doc_example("usm.xml"))
- expect_equal(length(unlist(get_xml_doc_example())), 8)
+ expect_length(unlist(get_xml_doc_example()), 8)
})
diff --git a/tests/testthat/test-get_year_from_file_name.R b/tests/testthat/test-get_year_from_file_name.R
index 3f23b19c..4cb4bea0 100644
--- a/tests/testthat/test-get_year_from_file_name.R
+++ b/tests/testthat/test-get_year_from_file_name.R
@@ -10,7 +10,7 @@ test_that("single file path no year in file name", {
test_that("vector of file paths", {
years <- get_year_from_file_name(c("abc.2000", "abc.1999"))
- expect_equal(length(years), 2)
- expect_equal(years[1], 2000)
- expect_equal(years[2], 1999)
+ expect_length(years, 2)
+ expect_identical(years[1], 2000)
+ expect_identical(years[2], 1999)
})
diff --git a/tests/testthat/test-set_get_param_txt.R b/tests/testthat/test-set_get_param_txt.R
index a7c3d3cb..a26837c5 100644
--- a/tests/testthat/test-set_get_param_txt.R
+++ b/tests/testthat/test-set_get_param_txt.R
@@ -211,8 +211,8 @@ tmp2 <- unlist(get_param_txt(
stics_version = stics_version
))
test_that("Set and get of a non-varietal parameter for a unique plant", {
- expect_equal(length(tmp), 1)
- expect_equal(tmp + 1, tmp2)
+ expect_length(tmp, 1)
+ expect_identical(tmp + 1, tmp2)
})
# Get and modify the varietal parameter "stlevamf" for the simulated variety
diff --git a/tests/testthat/test-set_get_param_xml.R b/tests/testthat/test-set_get_param_xml.R
index 3fd27079..808a5bdf 100644
--- a/tests/testthat/test-set_get_param_xml.R
+++ b/tests/testthat/test-set_get_param_xml.R
@@ -85,8 +85,8 @@ tmp2 <- unlist(get_param_xml(
stics_version = stics_version
))
test_that("Set and get of a non-varietal parameter for a unique plant", {
- expect_equal(length(tmp), 1)
- expect_equal(tmp + 1, tmp2)
+ expect_length(tmp, 1)
+ expect_identical(tmp + 1, tmp2)
})
# Get and modify the varietal parameter "stlevamf" for the simulated variety
diff --git a/tests/testthat/test-upgrade_workspace.R b/tests/testthat/test-upgrade_workspace.R
new file mode 100644
index 00000000..82699c11
--- /dev/null
+++ b/tests/testthat/test-upgrade_workspace.R
@@ -0,0 +1,57 @@
+# Getting data sets for upgrades and comparison with target files
+# for each version
+workspace_9 <- file.path(
+ download_data(stics_version = "V9.2", example_dirs = "study_case_1"),
+ "XmlFiles"
+)
+
+workspace_10 <- file.path(
+ download_data(stics_version = "V10", example_dirs = "study_case_1"),
+ "XmlFiles"
+)
+
+workspace_11 <- file.path(
+ download_data(stics_version = "V11", example_dirs = "study_case_1"),
+ "XmlFiles"
+)
+
+# from 9 to 10
+
+out_dir <- file.path(workspace_9, "V10")
+if (!dir.exists(out_dir)) dir.create(out_dir)
+
+upgrade_workspace_xml(
+ workspace = workspace_9,
+ out_dir = out_dir,
+ verbose = FALSE
+)
+# checking that every upgraded file matches target version files
+for (file_path in list.files(pattern = "\\.xml", out_dir, full.names = TRUE)) {
+ file_name <- basename(file_path)
+ # loading files
+ out_xml <- SticsRFiles:::xmldocument(file_path)
+ target_xml <- SticsRFiles:::xmldocument(file.path(workspace_10, file_name))
+
+ test_that(paste(file_name, "XML documents match"), {
+ expect_equal(out_xml@content, target_xml@content)
+ })
+}
+
+
+# from 10 to 11
+out_dir <- file.path(workspace_9, "V11")
+if (!dir.exists(out_dir)) dir.create(out_dir)
+workspace <- file.path(workspace_9, "V10")
+upgrade_workspace_xml(workspace = workspace, out_dir = out_dir, verbose = FALSE)
+
+# checking that every upgraded file matches target version files
+for (file_path in list.files(pattern = "\\.xml", out_dir, full.names = TRUE)) {
+ file_name <- basename(file_path)
+ # loading files
+ out_xml <- SticsRFiles:::xmldocument(file_path)
+ target_xml <- SticsRFiles:::xmldocument(file.path(workspace_10, file_name))
+
+ test_that(paste(file_name, "XML documents match"), {
+ expect_equal(out_xml@content, target_xml@content)
+ })
+}
diff --git a/tests/testthat/test-upgrade_xml_file.R b/tests/testthat/test-upgrade_xml_file.R
deleted file mode 100644
index dfaab4ab..00000000
--- a/tests/testthat/test-upgrade_xml_file.R
+++ /dev/null
@@ -1,88 +0,0 @@
-stics_from_version <- "V9.2"
-stics_to_version <- get_stics_versions_compat()$latest_version
-
-context("Upgrading xml files to latest version")
-
-path_from <- get_examples_path("xml", stics_version = stics_from_version)
-
-# Copy example to test in tempdir since the files will be modified by set_param
-file.copy(
- from = file.path(path_from, list.files(path_from)),
- to = tempdir(),
- overwrite = TRUE
-)
-path <- tempdir()
-
-out_path <- file.path(path, "out_xml")
-if (!dir.exists(out_path)) dir.create(out_path)
-
-upgrade_ini_xml(
- file = file.path(path, "file_ini.xml"),
- out_dir = out_path,
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-upgrade_plt_xml(
- file = file.path(path, "file_plt.xml"),
- out_dir = out_path,
- param_newform_file = file.path(path, "param_newform.xml"),
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-upgrade_sta_xml(
- file = file.path(path, "file_sta.xml"),
- out_dir = out_path,
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-upgrade_tec_xml(
- file = file.path(path, "file_tec.xml"),
- out_dir = out_path,
- param_newform_file = file.path(path, "param_newform.xml"),
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-
-upgrade_param_gen_xml(
- file = file.path(path, "param_gen.xml"),
- out_dir = out_path,
- stics_version = stics_from_version
-)
-
-upgrade_param_newform_xml(
- file = file.path(path, "param_newform.xml"),
- out_dir = out_path,
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-upgrade_sols_xml(
- file = file.path(path, "sols.xml"),
- out_dir = out_path,
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-upgrade_usms_xml(
- file = file.path(path, "usms.xml"),
- out_dir = out_path,
- param_gen_file = file.path(path, "param_gen.xml"),
- stics_version = stics_from_version
-)
-
-
-for (file_path in list.files(out_path, full.names = TRUE)) {
- file_name <- basename(file_path)
- # loading files
- out_xml <- xmldocument(file_path)
- target_path <- get_examples_path("xml", stics_version = stics_to_version)
- target_xml <- xmldocument(file.path(target_path, file_name))
-
- test_that(paste(file_name, "XML documents match"), {
- expect_equal(out_xml@content, target_xml@content)
- })
-}
diff --git a/tests/testthat/test-upgrade_xml_files.R b/tests/testthat/test-upgrade_xml_files.R
new file mode 100644
index 00000000..54ba0dd7
--- /dev/null
+++ b/tests/testthat/test-upgrade_xml_files.R
@@ -0,0 +1,175 @@
+# first test from 10 to 11------------------------------------------------------
+
+starting_version <- "V10.0"
+target_version <- "V11.0"
+
+context(paste("Upgrading xml files to", target_version))
+
+path_from <- get_examples_path("xml", stics_version = starting_version)
+
+# Copy example to test in tempdir since the files will be modified by set_param
+path <- file.path(tempdir(), paste0("upgrade_to_", target_version))
+if (!dir.exists(path)) dir.create(path)
+file.copy(
+ from = file.path(path_from, list.files(path_from)),
+ to = file.path(path, list.files(path_from)),
+ overwrite = TRUE
+)
+
+
+out_path <- file.path(path, paste0("out_xml_", target_version))
+if (!dir.exists(out_path)) dir.create(out_path)
+
+#
+par_gen <- file.path(path, "param_gen.xml")
+par_new <- file.path(path, "param_newform.xml")
+
+upgrade_ini_xml(
+ file = file.path(path, "file_ini.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_plt_xml(
+ file = file.path(path, "file_plt.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen,
+ param_newform_file = par_new,
+ warning = FALSE
+)
+
+upgrade_sta_xml(
+ file = file.path(path, "file_sta.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_tec_xml(
+ file = file.path(path, "file_tec.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen,
+ param_newform_file = par_new
+)
+
+
+upgrade_param_gen_xml(
+ file = par_gen,
+ out_dir = out_path
+)
+
+upgrade_param_newform_xml(
+ file = par_new,
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_sols_xml(
+ file = file.path(path, "sols.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_usms_xml(
+ file = file.path(path, "usms.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+target_path <- get_examples_path("xml", stics_version = target_version)
+for (file_path in list.files(out_path, full.names = TRUE)) {
+ file_name <- basename(file_path)
+ # loading files
+ out_xml <- xmldocument(file_path)
+ target_xml <- xmldocument(file.path(target_path, file_name))
+
+ test_that(paste(file_name, "XML documents match"), {
+ expect_equal(out_xml@content, target_xml@content)
+ })
+}
+
+# second test from 9 to 10------------------------------------------------------
+starting_version <- "V9.2"
+target_version <- "V10.0"
+
+context(paste("Upgrading xml files to", target_version))
+
+path_from <- get_examples_path("xml", stics_version = starting_version)
+
+# Copy example to test in tempdir since the files will be modified by set_param
+path <- file.path(tempdir(), paste0("upgrade_to_", target_version))
+if (!dir.exists(path)) dir.create(path)
+file.copy(
+ from = file.path(path_from, list.files(path_from)),
+ to = file.path(path, list.files(path_from)),
+ overwrite = TRUE
+)
+
+
+out_path <- file.path(path, paste0("out_xml", target_version))
+if (!dir.exists(out_path)) dir.create(out_path)
+
+par_gen <- file.path(path, "param_gen.xml")
+par_new <- file.path(path, "param_newform.xml")
+
+upgrade_ini_xml(
+ file = file.path(path, "file_ini.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_plt_xml(
+ file = file.path(path, "file_plt.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen,
+ param_newform_file = par_new,
+ warning = FALSE
+)
+
+upgrade_sta_xml(
+ file = file.path(path, "file_sta.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_tec_xml(
+ file = file.path(path, "file_tec.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen,
+ param_newform_file = par_new
+)
+
+
+upgrade_param_gen_xml(
+ file = par_gen,
+ out_dir = out_path
+)
+
+upgrade_param_newform_xml(
+ file = par_new,
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_sols_xml(
+ file = file.path(path, "sols.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+upgrade_usms_xml(
+ file = file.path(path, "usms.xml"),
+ out_dir = out_path,
+ param_gen_file = par_gen
+)
+
+target_path <- get_examples_path("xml", stics_version = target_version)
+for (file_path in list.files(out_path, full.names = TRUE)) {
+ file_name <- basename(file_path)
+ # loading files
+ out_xml <- xmldocument(file_path)
+ target_xml <- xmldocument(file.path(target_path, file_name))
+
+ test_that(paste(file_name, "XML documents match"), {
+ expect_equal(out_xml@content, target_xml@content)
+ })
+}
diff --git a/vignettes/Upgrading_STICS_XML_files.Rmd b/vignettes/Upgrading_STICS_XML_files.Rmd
index a9dace71..3c9b94cf 100644
--- a/vignettes/Upgrading_STICS_XML_files.Rmd
+++ b/vignettes/Upgrading_STICS_XML_files.Rmd
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
)
```
-```{r eval=FALSE}
+```{r eval=FALSE, ,include=FALSE}
library(SticsRFiles)
```
@@ -29,11 +29,15 @@ stics_version <- get_stics_versions_compat()$latest_version
```
-The XML files structure has changed between STICS version **9.2** and versions **10.X.Y** and a transformation is mandatory.
+The XML files structure has changed either between STICS version **9.2** and versions **10.X.Y** or between STICS versions **10.X.Y** and version 11.0.0. Files conversions are mandatory to be able to use them with a upper major version.
So, to avoid difficulties and errors with manual XML files modifications, functionalities have been developed to do so automatically.
-One can either transform a complete workspace directory at once or each kind of file individually.
+One can either transform each kind of file individually (i.e. _tec, _ini,.. files) or a full workspace directory at once.
+
+Here are some examples of use of upgrade generic functions either from version 9 to 10 or 10 to 11.
+The initial version is detected and the target version as well. One have to chain upgrades for converting files version 9 to version 11.
+
```{r, include = FALSE, eval=FALSE}
@@ -54,39 +58,111 @@ upgrade_workspace_xml(
## Upgrading a whole workspace
-In that case, a workspace adapted to the new version is recreated.
+In that case, a workspace adapted to the new version is generated.
+
+Apart from the XML files, some other files as outputs definition files (\*.mod), weather files attached to USMs and also observation files (named with the USM name, \*.obs) are copied to the new upgraded workspace.
+
+To achieve conversions, the JavaStics folder path may be needed by functions and it must corresponds to the initial STICS version of the workspace you want to upgrade.
-So, apart from the XML files, some other files as outputs definition files (*.mod), weather files attached to USMs and also observation files (named with the USM name, \*.obs) are copied to the new workspace.
+The output directory will contain all needed files to run simulations. But, there are slight differences in the content considering the 2 following cases.
+### Case 1: the initial workspace does not contain all needed files
+In that case the JavaStics folder path have to be set in the function inputs
```{r, eval = FALSE, results='markup'}
workspace <- "/path/to/workspace/dir/V9.2"
-out_dir <- "/path/to/out/dir/V10.2.0"
+out_dir <- "/path/to/out/dir/V10"
javastics <- "/path/to/JavaSTICS-1.41-stics-9.2"
upgrade_workspace_xml(
- workspace = workspace, javastics = javastics,
+ workspace = workspace,
+ javastics = javastics,
out_dir = out_dir
)
```
-Here is the output display indicating the treated files:
+The plant files (referenced in the usms.xml file) are not converted and copied in the output directory. Those given
+with the JavaStics distribution of the target release have to be used.
+
+### Case 2: the initial workspace contains all the input files
+In that case, a sub-directory `plant` exists and contains all the needed plant files (referenced in the usms.xml file).
+And the general parameter files also are in the workspace (param_gen.xml and param_newform.xml).
+So, no need to specify the JavaStics folder path.
+
+```{r, eval = FALSE, results='markup'}
+workspace <- "/path/to/workspace/dir/V9.2"
+out_dir <- "/path/to/out/dir/V10"
+upgrade_workspace_xml(
+ workspace = workspace,
+ out_dir = out_dir,
+ verbose = TRUE
+)
+```
+Here is the output display indicating the treated files (can be deactivated using the `verbose` argument set to `FALSE`):
-Upgrading files from version V9.2 to V10.2.0
-From: /path/to/workspace/dir/V9.2
-To: /path/to/out/dir/V10.2.0
------------------------------------
-param_gen.xml
-param_new_form.xml
-usms.xml
-sols.xml
-*_sta.xml
-*_ini.xml
-*_tec.xml
-Copying *.mod files.
-Copying *.obs files.
-Copying weather files.
-*_plt.xml
------------------------------------
-Files upgrade and copy is complete.
+Upgrading files from version 9 to 10
+From: /path/to/workspace/dir/V9.2
+To: /path/to/out/dir/V10
+-----------------------------------
+
+param_gen.xml
+
+param_new_form.xml
+
+usms.xml
+
+sols.xml
+
+*_sta.xml
+
+*_ini.xml
+
+*_tec.xml
+
+Copying output definition (*.mod) files.
+[1] "/path/to/out/dir/V10/prof.mod" "/path/to/out/dir/V10/rap.mod" "/path/to/out/dir/V10/var.mod"
+Copying observation (*.obs) files.
+ [1] "/path/to/out/dir/V10/banana.obs" "/path/to/out/dir/V10/BareSoil.obs"
+ [3] "/path/to/out/dir/V10/cc_BristleOat.obs" "/path/to/out/dir/V10/cc_CrimsonClover.obs"
+ [5] "/path/to/out/dir/V10/cc_ItalianRyegrass.obs" "/path/to/out/dir/V10/cc_mustard.obs"
+ [7] "/path/to/out/dir/V10/cc_vetch.obs" "/path/to/out/dir/V10/DurumWheat.obs"
+ [9] "/path/to/out/dir/V10/fescue.obs" "/path/to/out/dir/V10/flax.obs"
+[11] "/path/to/out/dir/V10/grass.obs" "/path/to/out/dir/V10/lettuce.obs"
+[13] "/path/to/out/dir/V10/maize.obs" "/path/to/out/dir/V10/potato.obs"
+[15] "/path/to/out/dir/V10/proto_rice.obs" "/path/to/out/dir/V10/rapeseed.obs"
+[17] "/path/to/out/dir/V10/sorghum.obs" "/path/to/out/dir/V10/soybean.obs"
+[19] "/path/to/out/dir/V10/strawberry.obs" "/path/to/out/dir/V10/sugarbeet.obs"
+[21] "/path/to/out/dir/V10/SugarCane.obs" "/path/to/out/dir/V10/sunflower.obs"
+[23] "/path/to/out/dir/V10/timothy.obs" "/path/to/out/dir/V10/tomato.obs"
+[25] "/path/to/out/dir/V10/Turmeric.obs" "/path/to/out/dir/V10/usms_fobs.xml"
+[27] "/path/to/out/dir/V10/vine.obs" "/path/to/out/dir/V10/wheat.obs"
+Copying LAI dynamics (*.lai) files.
+[1] "/path/to/out/dir/V10/ble.lai" "/path/to/out/dir/V10/bledur.lai"
+[3] "/path/to/out/dir/V10/colza.lai" "/path/to/out/dir/V10/mais.lai"
+[5] "/path/to/out/dir/V10/salade.lai" "/path/to/out/dir/V10/soja.lai"
+[7] "/path/to/out/dir/V10/sortie.lai" "/path/to/out/dir/V10/toursol.lai"
+[9] "/path/to/out/dir/V10/vigne.lai"
+Copying weather data (*.YYYY) files.
+ [1] "/path/to/out/dir/V10/Auzeville.2012" "/path/to/out/dir/V10/Auzeville.2013"
+ [3] "/path/to/out/dir/V10/Auzeville.2014" "/path/to/out/dir/V10/chapaisj.2001"
+ [5] "/path/to/out/dir/V10/clim_snow.2009" "/path/to/out/dir/V10/clim_snow.2010"
+ [7] "/path/to/out/dir/V10/climaisj.1996" "/path/to/out/dir/V10/climbanj.1996"
+ [9] "/path/to/out/dir/V10/climbetj.1994" "/path/to/out/dir/V10/climbldj.2000"
+[11] "/path/to/out/dir/V10/climbldj.2001" "/path/to/out/dir/V10/climblej.1994"
+[13] "/path/to/out/dir/V10/climblej.1995" "/path/to/out/dir/V10/climcanj.1998"
+[15] "/path/to/out/dir/V10/climcanj.1999" "/path/to/out/dir/V10/climcolj.1994"
+[17] "/path/to/out/dir/V10/climcolj.1995" "/path/to/out/dir/V10/climfetj.2004"
+[19] "/path/to/out/dir/V10/climfraj.2001" "/path/to/out/dir/V10/climlinj.2002"
+[21] "/path/to/out/dir/V10/climpdtj.1997" "/path/to/out/dir/V10/climsalj.2000"
+[23] "/path/to/out/dir/V10/climsnuj.1998" "/path/to/out/dir/V10/climsojj.1990"
+[25] "/path/to/out/dir/V10/climsorj.1996" "/path/to/out/dir/V10/climtomj.2000"
+[27] "/path/to/out/dir/V10/climtomj.2001" "/path/to/out/dir/V10/climtouj.1996"
+[29] "/path/to/out/dir/V10/climvigj.2003" "/path/to/out/dir/V10/climvigj.2004"
+[31] "/path/to/out/dir/V10/flux000j.2013" "/path/to/out/dir/V10/fourquej.1988"
+[33] "/path/to/out/dir/V10/prairiej.1995" "/path/to/out/dir/V10/readingj.2004"
+[35] "/path/to/out/dir/V10/statio5j.1992" "/path/to/out/dir/V10/statio5j.1993"
+[37] "/path/to/out/dir/V10/statio5j.1994" "/path/to/out/dir/V10/statio5j.1995"
+[39] "/path/to/out/dir/V10/statio5j.1996"
+-----------------------------------
+Files upgrade and copy is complete.
@@ -107,7 +183,7 @@ For each kind of file, a specific function is to be used for upgrading its forma
The input arguments of these functions may vary, refer to each function help for details
about its use.
-Sometimes, general parameter files are needed as function inputs because of parameters or options codes movement to specific files.
+Sometimes, general parameter files (`param_gen.xml` or/and `param_newform.xml`) corresponding to the initial version are needed as function inputs because of parameters or options codes transfer to specific files.
For example, the **`usms.xml`** file is to be upgraded as follows:
@@ -116,22 +192,36 @@ usms_path <- file.path(example_data, "XmlFiles", "usms.xml")
out_dir <- file.path(tempdir(), "XmlFiles_V10.2.0")
param_gen_path <- file.path(javastics, "config", "param_gen.xml")
upgrade_usms_xml(
- file = usms_path, param_gen_file = param_gen_path,
- out_dir = out_dir, overwrite = TRUE
+ file = usms_path,
+ param_gen_file = param_gen_path,
+ out_dir = out_dir
)
```
```{r, eval = FALSE}
usms_path <- "/path/to/workspace/dir/V9.2/usms.xml"
-out_dir <- "/path/to/workspace/dir/V10.2.0"
+out_dir <- "/path/to/workspace/dir/V10"
param_gen_path <- "/path/to/JavaSTICS-1.41-stics-9.2/config/param_gen.xml"
+# or param_gen_path <- "/path/to/workspace/param_gen.xml"
upgrade_usms_xml(
- file = usms_path, param_gen_file = param_gen_path,
+ file = usms_path,
+ param_gen_file = param_gen_path,
out_dir = out_dir
)
```
+## Warnings and messages
+
+* When files **already exist**, warnings are displayed and in any case consider adding the optional
+functions' argument `overwrite = TRUE` for overwriting them.
+* When **new parameters** are introduced in an upper version, when converting them, their values can be fixed
+with default values. But, if their values depend on other parameters values, specific values
+will be used.
+For example, when parameters values depend on species, for some of them, parameters values may exist
+and will be used.
+But if they are not, a message will be displayed indicating that default values are
+assigned to parameters.