diff --git a/docs/404.html b/docs/404.html index 80eb3ec..82481ab 100644 --- a/docs/404.html +++ b/docs/404.html @@ -76,7 +76,7 @@
diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 9b47a10..806802c 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -76,7 +76,7 @@ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 1f0997c..9f69338 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -76,7 +76,7 @@ diff --git a/docs/apple-touch-icon-120x120.png b/docs/apple-touch-icon-120x120.png index 4c2b535..d5c5b0c 100644 Binary files a/docs/apple-touch-icon-120x120.png and b/docs/apple-touch-icon-120x120.png differ diff --git a/docs/apple-touch-icon-152x152.png b/docs/apple-touch-icon-152x152.png index 6799b45..979f83d 100644 Binary files a/docs/apple-touch-icon-152x152.png and b/docs/apple-touch-icon-152x152.png differ diff --git a/docs/apple-touch-icon-180x180.png b/docs/apple-touch-icon-180x180.png index 026c533..eef2742 100644 Binary files a/docs/apple-touch-icon-180x180.png and b/docs/apple-touch-icon-180x180.png differ diff --git a/docs/apple-touch-icon-60x60.png b/docs/apple-touch-icon-60x60.png index b52251f..d6e386b 100644 Binary files a/docs/apple-touch-icon-60x60.png and b/docs/apple-touch-icon-60x60.png differ diff --git a/docs/apple-touch-icon-76x76.png b/docs/apple-touch-icon-76x76.png index 8e2c4b3..2e176a7 100644 Binary files a/docs/apple-touch-icon-76x76.png and b/docs/apple-touch-icon-76x76.png differ diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png index daa1a0b..eef2742 100644 Binary files a/docs/apple-touch-icon.png and b/docs/apple-touch-icon.png differ diff --git a/docs/authors.html b/docs/authors.html index 49d0037..b1b749b 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -76,7 +76,7 @@ diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png index f564619..5ce8a59 100644 Binary files a/docs/favicon-16x16.png and b/docs/favicon-16x16.png differ diff --git a/docs/favicon-32x32.png b/docs/favicon-32x32.png index 23ee80d..2506560 100644 Binary files a/docs/favicon-32x32.png and b/docs/favicon-32x32.png differ diff --git a/docs/index.html b/docs/index.html index c858719..64b3b63 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,7 +39,7 @@ @@ -76,7 +76,7 @@The goal of SticsOnR is to perform simulations of the Stics model, downloadable with its graphical user interface from https://www6.paca.inra.fr/stics_eng/Download.
@@ -87,81 +87,398 @@The development version from GitHub can be installed with:
- +Or using the lightweight remotes package:
+remotes::install_github("SticsRPacks/SticsOnR@*release")Normaly, all packages dependencies will be installed, either CRAN packages or SticsRPacks needed packages. In that case SticsRFiles and CroptimizR will be installed as well.
Here are basic examples which show you how to run the model either from a R model interface or a JavaStics (command line) one. More complete examples will be detailed in a specific documentation soon.
+Here are basic examples which show you how to run the model either from a R model interface or a JavaStics (command line) one. More complete examples will be detailed in a specific documentation later.
We need for that a JavaStics folder and a JavaStics workspace folder. For example using the last distribution version for Stics 9.1 (JavaSTICS-1.41-stics-9.1).
+
We need for that a JavaStics installed and a JavaStics workspace folder. For example using the last distribution version for Stics 9.1, (JavaSTICS-1.41-stics-9.1 downloadable here).
It contains an example
folder with a set of runnable usms.
For running simulations from it, we can use the run_javastics
function as follows:
# Spefifying the JavaStics folder
-javastics_path <- "/path/to/JavaSTICS-1.41-stics-9.1"
-# specifying a workspace as a subfolder of JavaStics
-workspace_path <- "example"
-# or an absolute path to an extrenal folder
-# workspace_path <- "/path/to/javastics/workspace"
+For running simulations from it, we can use the run_javastics
function.
+In this SticsOnR package, for the moment, only one Stics version can be used with it (i.e. the one delivered with the JavaStics installation archive). JavaStics GUI, allows to manage several Stics executables, but in that case one must take care of consistency between executables version and input files format (advanced use case).
+So, at this point, it is at your own risk if you try to use another version than the JavaStics distribution one.
+
+# Specifying the JavaStics folder
+javastics_path <- "/path/to/JavaSTICS-1.41-stics-9.1"
+
+# Specifying a workspace as a subfolder of JavaStics
+workspace_path <- "example"
-# Running all usms contained in the workspace
-run_javatics(javastics_path, workspace_path)
+# or an absolute path to an external folder
+# workspace_path <- "/path/to/javastics/workspace"
+# Running specific usms from the workspace
+run_javastics(javastics_path, workspace_path, usms_list = c("banana","wheat"))
+#> [1] "banana"
+#> [1] "wheat"
+
+# Running all usms contained in the workspace
+run_javastics(javastics_path, workspace_path)
+#> [1] "SugarCane"
+#> [1] "potato"
+#> [1] "banana"
+#> [1] "sorghum"
+#> [1] "barley"
+#> [1] "sugarbeet"
+#> [1] "wheat"
+#> [1] "maize"
+#> [1] "soybean"
+#> [1] "lettuce"
+#> [1] "tomato"
+#> [1] "DurumWheat"
+#> [1] "rapeseed"
+#> [1] "sunflower"
+#> [1] "grass"
+#> [1] "BareSoil"
+#> [1] "demo_Wheat1"
+#> [1] "demo_BareSoil2"
+#> [1] "demo_maize3"
+#> [1] "DurumWheat_4years"
+#> [1] "maize_4years"
+#> [1] "strawberry"
+#> [1] "pea"
+#> [1] "vine"
+#> [1] "fescue"
+#> [1] "flax"
+#> [1] "intercrop_pea_barley"
+#> [1] "timothy"
+#> [1] "DurumWheat_snow"
+#> [1] "Turmeric"
+#> [1] "cc_BristleOat"
+#> [1] "cc_mustard"
+#> [1] "cc_ItalianRyegrass"
+#> [1] "cc_vetch"
+#> [1] "cc_CrimsonClover"
+#> [1] "proto_rice"
+
+# Getting returned information about execution
+runs_info <- run_javastics(javastics_path, workspace_path, usms_list = c("banana","wheat"), display = FALSE)
+
+runs_info
+#> $names
+#> [1] "banana" "wheat"
+#>
+#> $error
+#> [1] "[13/01/20]-[15:52:22] INFO - Modulostics files generation..\n[13/01/20]-[15:52:22] INFO - Generating txt files ...\n[13/01/20]-[15:52:23] INFO - Files generated under /home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example\nFiles generated :\n\t/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/mod_bbanana.sti\n\t/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/modhistory.sti"
+#> [2] "[13/01/20]-[15:52:23] INFO - Modulostics files generation..\n[13/01/20]-[15:52:23] INFO - Generating txt files ...\n[13/01/20]-[15:52:24] INFO - Files generated under /home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example\nFiles generated :\n\t/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/mod_bwheat.sti\n\t/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/modhistory.sti"
In the returned information, the error field name gives a list of messages got from JavaStics commandline interface. If any Error
key word appears in a message, the corresponding simulation failed. But, at the moment it is impossible to identify what is the the error’s origin. Things must be checked manually in the workspace, after running again the faulty usm (because the model input files are overwritten at each usms simulation).
For using the model directly neither using the JavaStics graphical interface nor the run_javastics function interface, we provide a function, gen_usms_xml2txt
, for converting JavasStics XML files to Stics text files from a JavaStics workspace.
For using the model directly neither using the JavaStics graphical interface nor the run_javastics
function interface, we provide a function, gen_usms_xml2txt
, for converting JavasStics XML files to Stics text files from a JavaStics workspace.
Observation files may also be copied if they have a standard name as an usm name and a .obs
extension. If not, they must be renamed to do so.
# Spefifying the JavaStics folder
-javastics_path <- "/path/to/JavaSTICS-1.41-stics-9.1"
-# specifying a workspace as a subfolder of JavaStics
-workspace_path <- "example"
-# or an absolute path to an extrenal folder
-# workspace_path <- "/path/to/javastics/workspace"
-
-# Generating files for all the usms contained in the workspace
-# one directory per usm
-# In the workspace
-gen_usms_xml2txt(javastics_path, workspace_path)
-# In a specific folder
-gen_usms_xml2txt(javastics_path, workspace_path, target_path = "/path/to/output/folder")
-
-# Generating files for a subset of usms
-# In the workspace
-gen_usms_xml2txt(javastics_path, workspace_path, usms_list = c("banana","wheat"))
-# In a specific folder
-gen_usms_xml2txt(javastics_path, workspace_path, usms_list = c("banana","wheat"), target_path = "/path/to/output/folder")
-
-# Generating files directly in the workspace or a specific folder (no usm sub-folder)
-# In the workspace
-gen_usms_xml2txt(javastics_path, workspace_path, dir_per_usm_flag = FALSE)
-# In a specific folder
-gen_usms_xml2txt(javastics_path, workspace_path, target_path = "/path/to/output/folder", dir_per_usm_flag = FALSE)
# Specifying the JavaStics folder
+javastics_path <- "/path/to/JavaSTICS-1.41-stics-9.1"
+
+# Specifying a workspace as a subfolder of JavaStics
+workspace_path <- "example"
+# or an absolute path to an extrenal folder
+# workspace_path <- "/path/to/javastics/workspace"
+
+# Specifying an output folder path
+output_path <- "/path/to/output/folder"
# Generating files for all the usms contained in the workspace
+# In the workspace
+gen_usms_xml2txt(javastics_path, workspace_path)
+# In a specific output folderfolder
+gen_usms_xml2txt(javastics_path, workspace_path, target_path = output_path)
+
+# Generating files for a subset of usms
+# In the workspace
+gen_usms_xml2txt(javastics_path, workspace_path, usms_list = c("banana","wheat"))
+# In a specific folder
+gen_usms_xml2txt(javastics_path, workspace_path, usms_list = c("banana","wheat"), target_path = output_path)
+
+# Getting returned information about files generation
+gen_info <- gen_usms_xml2txt(javastics_path, workspace_path, usms_list = c("banana","wheat"), target_path = output_path)
+
+gen_info
+#> $usms_paths
+#> [1] "banana" "wheat"
+#>
+#> $files_path
+#> [1] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/climat.txt"
+#> [2] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/param.sol"
+#> [3] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/ficini.txt"
+#> [4] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/ficplt1.txt"
+#> [5] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/fictec1.txt"
+#> [6] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/station.txt"
+#> [7] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/new_travail.usm"
+#> [8] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/tempopar.sti"
+#> [9] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/tempoparv6.sti"
+#> [10] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/ficplt2.txt"
+#> [11] "/home/plecharpent/Work/projet_tests_modulostics/JavaSTICS-v141-stics-v9.0/example/fictec2.txt"
+#>
+#> $copy_status
+#> [1] TRUE TRUE
+#>
+#> $obs_copy_status
+#> [1] TRUE TRUE
# Generating files directly in the workspace or a specific folder (no usm sub-folder)
+# In this case the model files are overwritten at each gen_usms_xml2txt call !
+# In the workspace
+gen_usms_xml2txt(javastics_path, workspace_path, usms_list = "banana", dir_per_usm_flag = FALSE)
+
+# In a specific folder
+gen_usms_xml2txt(javastics_path, workspace_path, usms_list = "banana",
+ target_path = output_path, dir_per_usm_flag = FALSE)
We need for that a JavaStics folder and a directory, or a folder containing usms subdirectories with text input files (converted from xml JavaStics files).
+We need for that a JavaStics folder and a directory, or a folder containing usms subdirectories with text input files (converted from xml JavaStics files, see previous section).
The run_stics
function can be used as follows with one folder or multiple sub-folders.
# Spefifying the Stics executable file path
-# for windows/linux
-stics_path <- "/path/to/JavaSTICS-1.41-stics-9.1/stics_modulo"
-# for Mac
-# stics_path <- "/path/to/JavaSTICS-1.41-stics-9.1/stics_modulo_mac
-
-# Specifying a directory containing Stics input files
-files_dir_path <- "/path/to/files/dir"
-run_stics(stics_path, files_dir_path)
-# or a root directory containing usms indicidual directories
-# files_root_dirs_path <- "/path/to/files/dirs/root"
-run_stics(stics_path, files_root_dirs_path)
# Spefifying the Stics executable file path
+
+# for windows/linux
+stics_path <- file.path(javastics_path,"bin","stics_modulo")
+
+# for Mac
+# stics_path <- file.path(javastics_path,"bin","stics_modulo_mac")
+
+# Specifying a directory containing Stics input files
+# For example reusing a generated sub-directory in the previous section
+# of the document
+# Running on usm
+files_dir_path <- file.path(output_path,"banana")
+run_stics(stics_path, files_dir_path)
+
+# Specifying a root directory containing usms individual directories
+# For example reusing a generated directory in the previous section
+# of the document
+# Running two usms
+run_stics(stics_path, output_path, usm_dir_names = c("banana","wheat"))
+
+# Running all usms sub-directories
+run_stics(stics_path, output_path, usm_dir_names = "all")
+
+# Getting returned information about stics runs
+runs_info <- run_stics(stics_path, output_path, usm_dir_names = c("banana","wheat"))
+
+runs_info
+#> [[1]]
+#> [[1]]$name
+#> [1] "banana"
+#>
+#> [[1]]$error
+#> [1] FALSE
+#>
+#>
+#> [[2]]
+#> [[2]]$name
+#> [1] "wheat"
+#>
+#> [[2]]$error
+#> [1] FALSE
A specific function stics_wrapper
is dedicated to manage simulations with a higher level of parameterization than the run_stics
function which only executes runs.
This is a transitional version of the function that will be modified in order to simplify parameter forcing independently from the optimization goal, so apart from the CroptimizR package context.
+This stics_wrapper
function allows:
As the run_stics
function, the stics_wrapper
operates on directories containing text stics input files.
In the next uses case, the directory in which usms sub-directories with text input files were generated will be used.
+The mandatory simulation options are fixed using the stics_wrapper_options
: the model executable path and the directory path containing usms sub-directories with text input files.
stics_path <- file.path(javastics_path, "bin","stics_modulo")
+sim_options <- stics_wrapper_options(stics_path = stics_path, data_dir = output_path)
Optional fields in the sim_options
list will be set later in this document, when paralellized executions will be activated.
The content of the options list with default values, can be displayed using the stics_wrapper_options
function without any argument as follows:
+usms_list <- c("wheat", "pea", "maize")
+
+results <- stics_wrapper(model_options = sim_options, sit_var_dates_mask = usms_list)
The argument sit_var_dates_mask
must contain a named list (with usms names) containing data.frames organized as observations data or corresponding to observations data.
obs_filenames <- paste0(usms_list,".obs")
+obs_list <- get_obs(dirpath = workspace_path, obs_filenames = obs_filenames)
+
+# Observations table for wheat
+obs_list$wheat
+#> Date lai_n masec_n HR_1 HR_2 HR_3 resmes AZnit_1 AZnit_2 AZnit_3
+#> 1 1995-01-30 0.29 0.25 NA NA NA NA NA NA NA
+#> 2 1995-02-03 NA NA 21.1 18.8 12.4 133.26 3.1 2.9 4
+#> 3 1995-02-07 0.37 0.31 NA NA NA NA NA NA NA
+#> 4 1995-02-16 0.40 0.32 NA NA NA NA NA NA NA
+#> 5 1995-02-24 0.45 0.40 NA NA NA NA NA NA NA
+#> 6 1995-03-06 0.44 0.38 NA NA NA NA NA NA NA
+#> 7 1995-03-16 0.60 0.59 NA NA NA NA NA NA NA
+#> 8 1995-03-23 0.85 0.87 NA NA NA NA NA NA NA
+#> 9 1995-04-03 1.47 1.28 NA NA NA NA NA NA NA
+#> 10 1995-04-11 2.37 2.68 NA NA NA NA NA NA NA
+#> 11 1995-04-18 2.65 3.70 NA NA NA NA NA NA NA
+#> 12 1995-04-26 4.55 4.67 NA NA NA NA NA NA NA
+#> 13 1995-05-02 4.41 5.77 NA NA NA NA NA NA NA
+#> 14 1995-05-05 NA 6.01 NA NA NA NA NA NA NA
+#> 15 1995-05-09 5.20 7.51 NA NA NA NA NA NA NA
+#> 16 1995-05-12 NA 9.73 NA NA NA NA NA NA NA
+#> 17 1995-05-15 5.98 9.87 NA NA NA NA NA NA NA
+#> 18 1995-05-19 NA 11.08 NA NA NA NA NA NA NA
+#> 19 1995-05-29 NA 14.08 NA NA NA NA NA NA NA
+#> 20 1995-07-17 NA 21.91 NA NA NA NA NA NA NA
+#> QNplante
+#> 1 9.24
+#> 2 NA
+#> 3 10.85
+#> 4 12.61
+#> 5 13.32
+#> 6 16.65
+#> 7 24.59
+#> 8 38.86
+#> 9 60.99
+#> 10 98.98
+#> 11 103.36
+#> 12 141.99
+#> 13 170.03
+#> 14 NA
+#> 15 188.57
+#> 16 NA
+#> 17 216.06
+#> 18 NA
+#> 19 258.38
+#> 20 258.45
+
+results <- stics_wrapper(model_options = sim_options, sit_var_dates_mask = obs_list)
+#> Warning: Variable(s) INN, hmax not simulated by the Stics model for USM pea =>
+#> try to add it(them) in /home/plecharpent/tmp/tests_SticsOnR/gen_usms_xml2txt/
+#> pea/var.mod
+#> Warning: Requested date(s) 1996-04-16 is(are) not simulated for USM maize
Some warnings may occur, indicating that observed variables and/or observations dates are missing in simulated data. Simulation period and output variables list may be fixed before restarting simulations.
+But, for variables names, perhaps they can be badly written and do not correspond exactly the model variables names.
+In this case, we can define variables containing information used for parameters forcing management. They are transmitted to stics_wrapper
through 2 arguments, one containing a named vector of parameters values param_values
and the other storing corresponding usms groups to which each parameter value of param_values
will be applied before running the model.
+# No group list information given
+# Paratemers vector with unique values
+param_values <- c(0.002,50)
+names(param_values) <- c("dlaimax", "durvieF")
+
+results <- stics_wrapper(model_options = sim_options, sit_var_dates_mask = usms_list, param_values = param_values)
# Defining usms groups using same parameters values
+# (may be used in parameter optimization)
+# Parameters vector, with parameters values per usms groups
+param_values <- c(0.001, 0.002, 50, 51)
+names(param_values) <- c("dlaimax", "dlaimax", "durvieF", "durvieF")
+
+# Groups list
+# parameters_data <- data.frame(usm=c("wheat", "pea", "maize"), dlaimax=c(0.002,0.002, 0.001), durvieF=c(50, 51, 51), stringsAsFactors = F)
+groups_list <- list(dlaimax=list(sit_list=list(c("maize"),c("wheat", "pea"))),
+ durvieF=list(sit_list=list(c("wheat"), c("maize", "pea"))))
+
+
+results <- stics_wrapper(model_options = sim_options, sit_var_dates_mask = usms_list, param_values = param_values, prior_information = groups_list)
For the moment, usms names must be restricted to usms names existing in groups_list. So usms names list must be provided as sit_var_dates_mask
argument value (in this case c("wheat", "pea", "maize")
)
sim_options <- stics_wrapper_options(stics_path = stics_path, data_dir = output_path,
+ time_display = TRUE)
+
+results <- stics_wrapper(model_options = sim_options)
+#> Time difference of 21.86298 secs
# Used cores number
+detectCores() - 1
+#> [1] 3
+
+sim_options <- stics_wrapper_options(stics_path = stics_path, data_dir = output_path,
+ parallel =TRUE, time_display = TRUE)
+
+results <- stics_wrapper(model_options = sim_options)
+#> Time difference of 14.46257 secs
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
+R/add_java_model.R
+ add_java_model.Rd
Creating a new entry in preferences with a new model name +and executable file, and select it
+add_java_model(javastics_path, java_model_tag, java_model_exe)+ +
javastics_path | +JavaStics installation root folder |
+
---|---|
java_model_tag | +Model name/identifier (not executable file) |
+
java_model_exe | +Model executable name or path |
+
The executable file may be in the current JavaStics bin folder, +or elsewhere and will be copied in the bin directory
+ ++if (FALSE) { + add_java_model("/path/to/JavaSTICS/dir", + "model_name","model_exe_name") +}
Checking if directory exists and if it contains JavaStics jar files
+check_java_path(javastics_path)+ +
javastics_path | +JavaStics installation root folder |
+
---|
Rising an exception for each checking step !
+ ++if (FALSE) { +check_java_path("/home/plecharpent/Work/JavaSTICS-v131-stics-v841") +}
R/check_java_workspace.R
+ check_java_workspace.Rd
Looking in JavaStics for a workspace path in JavasStics preferences +or producing a full path to a workspace located in JavaStics root directory +or validating an external absolute path. And also checking if the path is a +valid JavaStics workspace
+check_java_workspace(javastics_path, javastics_workspace_path = NULL)+ +
javastics_path | +Path of JavaStics installation directory |
+
---|---|
javastics_workspace_path | +An absolute or relative path (to JavsStics path) +of a workspace (Optional) |
+
An absolute javastics workspace path
+ +This function checks if the model outputs files are correctly produced
+check_output_files(run_dir, usm_name = NULL)+ +
run_dir | +Directory name or path (absolute) of a working directory, +or root directory of working directories |
+
---|---|
usm_name | +Usm name, to be set if it is the name of a sub-directory of the given argument run_dir |
+
A list with fields $error (logical, TRUE if any missing file, FALSE otherwise), $missing (missing files vector)
+ ++if (FALSE) { +check_output_files("/home/username/Work/SticsInputsDir") +check_output_files("/home/username/Work/SticsInputsRootDir","usmDir") +}
Checking if given path is a Stics executable path
+check_stics(model_path, version = FALSE, stop = TRUE)+ +
model_path | +Model executable path |
+
---|---|
version | +Logical, or getting system command return i.e. +model version or not (default) |
+
stop | +Logical for stopping or not execution |
+
System output (error,...)
+ +R/exist_java_model.R
+ exist_java_model.Rd
Finding in JavaStics preference.xml file in the given JavaStics path, +if the given model name exists
+exist_java_model(javastics_path, java_model_tag)+ +
javastics_path | +JavaStics installation root folder |
+
---|---|
java_model_tag | +Model name in JavaStics configuration |
+
Existing status, logical
+ ++if (FALSE) { +exist_java_model("/home/plecharpent/Work/JavaSTICS-v131-stics-v841/example","stics_name") +}
Testing if preferences.xml file exist in JavaSTICS installation folder
+exists_java_pref(javastics_path)+ +
javastics_path | +JavaStics installation root folder |
+
---|
logical value, TRUE if file exists, FALSE otherwise
+ ++if (FALSE) { +exists_pref <- exists_java_pref("/home/plecharpent/Work/JavaSTICS-v131-stics-v841") +}
if (FALSE) { javastics <- "/path/to/javastics" javastics_workspace <- "/path/to/workspace" + # For all usms gen_usms_xml2txt(javastics, javastics_workspace) + # For an usms list usm_list <- c("usm1", "usm2") gen_usms_xml2txt(javastics, javastics_workspace, usm_list) + # For one usm gen_usms_xml2txt(javastics, javastics_workspace, dir_per_usm_flag=F, "usm1") diff --git a/docs/reference/get_java_model.html b/docs/reference/get_java_model.html new file mode 100644 index 0000000..b704364 --- /dev/null +++ b/docs/reference/get_java_model.html @@ -0,0 +1,175 @@ + + + + + + + + +diff --git a/docs/reference/is_os_name.html b/docs/reference/is_os_name.html new file mode 100644 index 0000000..996412e --- /dev/null +++ b/docs/reference/is_os_name.html @@ -0,0 +1,176 @@ + + + + + + + + +Getting current Stics instance in use — get_java_model • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/get_java_models.html b/docs/reference/get_java_models.html new file mode 100644 index 0000000..a501d48 --- /dev/null +++ b/docs/reference/get_java_models.html @@ -0,0 +1,175 @@ + + + + + + + + ++ + + + + + +++ + + ++ + ++ +++ +Extracting the last used model from preferences file
+get_java_model(javastics_path)+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
Value
+ +Current Stics model name used in JavaStics configuration
+ +Examples
++if (FALSE) { +current_model <- get_java_model("/home/plecharpent/Work/JavaSTICS-v131-stics-v841") +}Getting models list from a JavaStics configuration — get_java_models • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/get_java_models_nb.html b/docs/reference/get_java_models_nb.html new file mode 100644 index 0000000..8a4172b --- /dev/null +++ b/docs/reference/get_java_models_nb.html @@ -0,0 +1,175 @@ + + + + + + + + ++ + + + + + +++ + + +++ +++ +Getting models list from a JavaStics configuration
+ Source:R/get_java_models.R
++get_java_models.Rd
++ +Extracting Stics model names and executables file names from preferences file
+get_java_models(javastics_path)+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
Value
+ +A list with model name list ($tag), and model executables names ($exe)
+ +Examples
++if (FALSE) { +models <- get_java_models("/home/plecharpent/Work/JavaSTICS-v131-stics-v841") +}Getting the number of Stics executable registered in JavaStics — get_java_models_nb • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/get_java_models_version.html b/docs/reference/get_java_models_version.html new file mode 100644 index 0000000..a20ac7f --- /dev/null +++ b/docs/reference/get_java_models_version.html @@ -0,0 +1,175 @@ + + + + + + + + ++ + + + + + +++ + + +++ +++ +Getting the number of Stics executable registered in JavaStics
+ Source:R/get_java_models_nb.R
++get_java_models_nb.Rd
++ +Getting the number of Stics executable registered in JavaStics
+get_java_models_nb(javastics_path, check = FALSE)+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
+ +check ++ Logical for executing or not a check on executables files
Value
+ +a number of registered models in JavaStics preferences, +and corresponding exiseing executable file
+ +Getting Stics versions list of executable in a JavaStics directory — get_java_models_version • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/get_java_workspace.html b/docs/reference/get_java_workspace.html new file mode 100644 index 0000000..09ae259 --- /dev/null +++ b/docs/reference/get_java_workspace.html @@ -0,0 +1,173 @@ + + + + + + + + ++ + + + + + +++ + + +++ +++ +Getting Stics versions list of executable in a JavaStics directory
+ Source:R/get_java_models_version.R
++get_java_models_version.Rd
++ +Getting Stics versions list of executable in a JavaStics directory
+get_java_models_version(javastics_path, exe_tags = NULL)+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
+ +exe_tags ++ Versions tags vector
Value
+ +A named list ( with model tags ) of versions strings +(got from the model executable)
+ +Getting current workspace in JavaStics preferences configuration — get_java_workspace • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/get_model_exe.html b/docs/reference/get_model_exe.html new file mode 100644 index 0000000..f6c961b --- /dev/null +++ b/docs/reference/get_model_exe.html @@ -0,0 +1,184 @@ + + + + + + + + ++ + + + + + +++ + + +++ +++ +Getting current workspace in JavaStics preferences configuration
+ Source:R/get_java_workspace.R
++get_java_workspace.Rd
++ +Getting current JavaStics working directory, +if not any setting to
+example
directoryget_java_workspace(javastics_path)+ +Arguments
++
+ + ++ + +javastics_path ++ JavaStics installation root folder
Examples
++if (FALSE) { +get_java_wd("/path/to/JavaStics/directory") +}Getting Stics model executable name — get_model_exe • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 351f2ea..6c19232 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -76,7 +76,7 @@+ + + + + + +++ + + ++ + ++ +++ +Extracting the current used model executable name from preferences file
+or corresponding one to the given model_name
+get_model_exe(javastics_path, model_name = character(0))+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
+ +model_name ++ Model name in model name list
Value
+ +Stics model executable name (current, matching given model name)
+ +Examples
++if (FALSE) { +# Getting the current model executable +model_exe <- get_model_exe("/home/plecharpent/Work/JavaSTICS-v131-stics-v841") +# Getting model executable correponding to the given "model_name" +model_exe <- get_model_exe("/home/plecharpent/Work/JavaSTICS-v131-stics-v841","model_name") +}Testing OS name — is_os_name • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/remove_java_model.html b/docs/reference/remove_java_model.html new file mode 100644 index 0000000..c56f476 --- /dev/null +++ b/docs/reference/remove_java_model.html @@ -0,0 +1,180 @@ + + + + + + + + ++ + + + + + +++ + + ++ + ++ +++ +Returning if the given OS name is the system name
+is_os_name(os_tag_name = character())+ +Arguments
++
+ ++ + +os_tag_name ++ OS name(s) (see os_names list), optional
Value
+ +TRUE if os_tag_name is the current system OS, FALSE otherwise; OS names list if os_tag_name not provided
+ +Examples
++if (FALSE) { +os_list <- is_os_name() +is_os_name <- is_os_name("windows") +}Removing a Stics model version to use from JavaStics — remove_java_model • SticsOnR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++ + + + + + + + diff --git a/docs/reference/run_javastics.html b/docs/reference/run_javastics.html index f4254d3..bb1dad4 100644 --- a/docs/reference/run_javastics.html +++ b/docs/reference/run_javastics.html @@ -43,7 +43,8 @@ - + @@ -77,7 +78,7 @@ @@ -119,15 +120,17 @@+ + + + + + +++ + + +++ +++ +Removing a Stics model version to use from JavaStics
+ Source:R/remove_java_model.R
++remove_java_model.Rd
++ +Removing a model entry in preferences file (model exe name, model tag name)
+remove_java_model(javastics_path, java_model_tag)+ +Arguments
++
+ ++ + +javastics_path ++ JavaStics installation root folder
+ +java_model_tag ++ Model name (not executable file name)
Details
+ +The executable file in the current JavaStics bin folder will not be deleted
+It will not be possible to run it through JavaStics command line interface
+ +Examples
++if (FALSE) { +remove_java_model("/home/plecharpent/Work/JavaSTICS-v131-stics-v841","model_name") +}Running one or several usms from a javastics workspace
-This function uses basically Stics through his JavasStics command line interface
+This function uses basically Stics through his +JavaStics command line interface
run_javastics( javastics_path, - javastics_workspace_path = NULL, - usms_list = c(), + workspace_path = NULL, + usms_list = NULL, keep_history = TRUE, - optim = FALSE + optim = FALSE, + display = TRUE )Arguments
@@ -138,37 +141,42 @@Arg
Path of JavaStics installation directory
- javastics_workspace_path +workspace_path Path of a JavaStics workspace (Optional)
usms_list -+ Vector of usms to run (Optional)
Vector of usms to run (optional)
keep_history -Logical value (Optional) to keep a copy of history file +
Logical value (optional) to keep a copy of history file use TRUE (default), FALSE otherwise
+ optim -Logical value (Optional) to force code_optim value to 1, use TRUE, +
+ Logical value (optional), TRUE to force code_optim value to 1, +FALSE otherwise (default)
+ display +Logical value (optional), TRUE to display usms names, FALSE otherwise (default)
Value
-A list with usms names and execution error status or NULL ikf any problem about +
A list with usms names and execution error status or NULL if any problem about the JavaStics workspace or JavaStics installation directory
Examples
@@ -141,7 +141,8 @@if (FALSE) { -run_java("/home/plecharpent/Work/JavaSTICS-v131-stics-v841","example") -run_java("/home/plecharpent/Work/JavaSTICS-v131-stics-v841","/home/plecharpent/data/example") -run_java("/home/plecharpent/Work/JavaSTICS-v131-stics-v841","example",c("ble","pois")) -run_java("/home/plecharpent/Work/JavaSTICS-v131-stics-v841",usms_list=c("ble","pois")) -run_java("/home/plecharpent/Work/JavaSTICS-v131-stics-v841",usms_list=c("ble","pois"), optim=TRUE) +run_javastics("/path/to/JavaSTICS-1.41-stics-9.1","example") +run_javastics("/path/to/JavaSTICS-1.41-stics-9.1","/path/to/workspace") +run_javastics("/path/to/JavaSTICS-1.41-stics-9.1","example",c("wheat","pea")) +run_javastics("/path/to/JavaSTICS-1.41-stics-9.1",usms_list=c("wheat","pea")) +run_javastics("/path/to/JavaSTICS-1.41-stics-9.1",usms_list=c("wheat","pea"), optim=TRUE) }Arg
usm_dir_names -+ Name(s) of sub-directory(ies) of data_dir
Name(s) vector of sub-directory(ies) of data_dir +or "all" for extracting all sub-directories path
check_exe @@ -162,9 +163,13 @@Examp "/home/username/Work/SticsInputsDir2")) # Specifying a parent directory of usms directories +# running one or several usms run_stics("/home/username/bin/Stics","/home/username/Work/SticsInputsRootDir","wheat") run_stics("/home/username/bin/Stics","/home/username/Work/SticsInputsRootDir", c("wheat","maize")) +# running all usms +run_stics("/home/username/bin/Stics","/home/username/Work/SticsInputsRootDir", +"all") } @@ -139,15 +139,18 @@
Arg
param_values -+ named vector containing the value(s) and names of the -parameters to force (optional)
a named vector containing the value(s) and names of the +parameters to force (optional). It may contains either unique value for each +parameter name or multiple values for each parameter when
prior_information
+argument is provided.sit_var_dates_mask -+ List of situations, variables and dates for which -simulated values should be returned. Typically a list containing the -observations to which simulations should be compared as provided by -SticsRFiles::read_obs_to_list
List of situations: +may be either a character vector of situation names or a named list containing +information about variables and dates for which simulated values should be returned. +Typically a list containing the observations to which simulations should be +compared as provided by SticsRFiles::read_obs
prior_information @@ -174,12 +177,36 @@Value
(flag_allsim
) indicating if all required situations, variables and dates were simulated. +Examples
+diff --git a/docs/reference/stics_wrapper_options.html b/docs/reference/stics_wrapper_options.html index 1369310..54bc5fe 100644 --- a/docs/reference/stics_wrapper_options.html +++ b/docs/reference/stics_wrapper_options.html @@ -77,7 +77,7 @@ @@ -139,7 +139,7 @@+if (FALSE) { + +# Specifying the JavaStics folder +javastics_path <- "/path/to/javastics" + +# Setting the model executable path (windows, linux) +stics_path <- file.path(javastics_path, "bin","stics_modulo") + +# Setting the input data folder path, root directory of the usms directories +data_path <- "/path/to/usms/subdirs/root" + +# Setting the mandatory simulations options +# Running all the usms +sim_options <- stics_wrapper(stics_path = stics_path, data_dir = data_path) + +# Running an usm list +usms_list <- c("wheat", "pea", "maize") +sim_options <- stics_wrapper(stics_path = stics_path, data_dir = data_path, +sit_var_dates_mask = usms_list) + +}Arg
@@ -147,12 +147,65 @@ ... -+ Add further arguments to the options
Add further arguments set the options list values
Value
A list containing Stics model stics_wrapper options
+Examples
+diff --git a/docs/sticsOnR.html b/docs/sticsOnR.html index ad407da..d4fb92c 100644 --- a/docs/sticsOnR.html +++ b/docs/sticsOnR.html @@ -76,7 +76,7 @@+if (FALSE) { +# Getting simulations options and defaults values for the stics_wrapper function + +stics_wrapper_options() + +#> $stics_path +#> "/path/to/javastics/bin/stics_modulo" +#> +#> $data_dir +#> "/path/to/usms/subdirs/root" +#> +#> $parallel +#> [1] FALSE +#> +#> $cores +#> [1] NA +#> +#> $time_display +#> [1] FALSE +#> +#> $warning_display +#> [1] TRUE + +# Setting mandatory simulations options +sim_options <- stics_wrapper_options(stics_path = stics_path, data_dir = data_path) + +# Setting other options using option name as a function argument +# Example for activating parallel simulations +sim_options <- stics_wrapper_options(stics_path = stics_path, +data_dir = data_path, parallel = TRUE) + +#> $stics_path +#> "/path/to/javastics/bin/stics_modulo" +#> +#> $data_dir +#> "/path/to/usms/subdirs/root" +#> +#> $parallel +#> [1] TRUE +#> +#> $cores +#> [1] NA +#> +#> $time_display +#> [1] FALSE +#> +#> $warning_display +#> [1] TRUE + +}