From 11df844196bc6c03e3cc79dcdffac8f745df05c4 Mon Sep 17 00:00:00 2001 From: Patrice Lecharpentier Date: Wed, 12 Jul 2023 10:42:40 +0200 Subject: [PATCH] Plecharpent/release/cran (#23) * news update, date , license file * fix: license * useless * update with latests tests results * fixes: linting, date of release * fix: no man files generation for unexported function using @noRd the the functions doc Use of library(SticsRFiles) and SticsRFiles::: in tests removed * fix: some functions doc (internal), removed SticsRFiles::: use in internal functions doc, added SticsRFiles::: in generating XML files vignette * changes: unwrapping examples for exported functions when possible, with minor correction when needed. * unwrapping examples for exported functions for testing them using examples path and tempdir() for outputs * fix: linting issues, examples * fix: examples * examples unwrapped and fixed * donttest replaced by dontrun: checks are failing with github actions ! * added an overwrite argument for forcing to rewrite files types examples folders in tempdir() * Description content and tidy lines * fix: examples for set_param_xml avoiding failing files copy in tempdir(), using directly examples files path. Doc updates. * fix release date * removed getwd() from default arg values in functions, man update * now using message funtion instead of print or cat * fix: linting issues * description and can-comments update * CRAN badge --- DESCRIPTION | 16 ++-- NAMESPACE | 1 - NEWS.md | 4 +- R/add_node_to_doc.R | 14 +-- R/add_stics_nodes.R | 9 +- R/all_out_var.R | 14 +-- R/attributes_list2matrix.R | 8 +- R/check_choice_param.R | 2 + R/check_java_path.R | 4 +- R/check_java_workspace.R | 1 + R/check_output_files.R | 1 + R/check_usms_files.R | 2 + R/col_names_to_var.R | 4 +- R/compute_doy_cumul.R | 6 +- R/convert_xml2txt.R | 3 +- R/convert_xml2txt_int.R | 4 +- R/download_data.R | 13 +-- R/download_usm_xl.R | 18 +--- R/exist_param_xml.R | 4 + R/exists_javastics_pref.R | 4 + R/exists_param.R | 8 +- R/expand_stics_names.R | 4 +- R/extract.R | 9 +- R/file_document.R | 9 +- R/find_names.R | 6 +- R/force_param_values.R | 2 +- R/gen_climate.R | 9 +- R/gen_ini_doc.R | 4 +- R/gen_ini_xml.R | 21 ++--- R/gen_new_travail.R | 44 +++++---- R/gen_obs.R | 7 +- R/gen_paramsti.R | 2 + R/gen_sols_xml.R | 15 +-- R/gen_sta_doc.R | 3 +- R/gen_sta_xml.R | 17 ++-- R/gen_tec_doc.R | 17 ++-- R/gen_tec_xml.R | 14 +-- R/gen_usms_sols_doc.R | 10 +- R/gen_usms_xml.R | 16 +--- R/gen_usms_xml2txt.R | 2 - R/gen_varmod.R | 8 +- R/get_climate_txt.R | 4 +- R/get_file.R | 10 +- R/get_file_int.R | 4 +- R/get_formalisms_xml.R | 2 + R/get_java_workspace.R | 2 + R/get_lai_forcing.R | 6 +- R/get_name_value_file_value.R | 2 + R/get_obs.R | 5 +- R/get_obs_txt.R | 8 +- R/get_option_choice_param_values.R | 2 + R/get_options_choices.R | 8 +- R/get_options_names.R | 6 +- R/get_param_bounds.R | 10 +- R/get_param_bounds_xml.R | 2 + R/get_param_desc.R | 2 + R/get_param_formalisms.R | 8 +- R/get_param_info.R | 6 +- R/get_param_names.R | 6 +- R/get_param_names_xml.R | 2 +- R/get_param_number.R | 8 +- R/get_param_txt.R | 16 ++-- R/get_param_type.R | 8 +- R/get_param_value.R | 16 ++-- R/get_param_xml.R | 4 +- R/get_params_dict.R | 6 +- R/get_params_from_doc.R | 2 + R/get_params_from_doc_attr.R | 1 + R/get_params_from_doc_node.R | 2 + R/get_params_from_table.R | 6 +- R/get_plant_name.R | 2 + R/get_plants_nb.R | 4 +- R/get_report_results.R | 3 +- R/get_sim.R | 6 +- R/get_stics_versions_compat.R | 25 +++-- R/get_values_by_param.R | 4 +- R/get_xml_base_doc.R | 10 +- R/get_xml_base_node.R | 10 +- R/get_xml_doc_example.R | 6 +- R/get_xml_files_param_df.R | 2 + R/get_xml_stics_version.R | 8 +- R/init_javastics_pref.R | 4 +- R/is_os_name.R | 2 + R/is_stics_doc.R | 26 ++--- R/is_stics_xml.R | 25 ++--- R/javastics_cmd_util.R | 6 ++ R/javastics_path.R | 8 ++ R/manage_stics_versions.R | 49 +++++++--- R/merge_nodesets.R | 2 + R/remove_node_from_doc.R | 14 +-- R/remove_parent_from_doc.R | 8 +- R/replace_string_in_file.R | 2 + R/replace_txt_param_value.R | 6 +- R/set_codeoptim.R | 7 +- R/set_file_executable.R | 2 + R/set_java_workspace.R | 4 + R/set_param_txt.R | 14 +-- R/set_param_value.R | 16 ++-- R/set_param_xml.R | 35 +++---- R/set_sols_param_xml.R | 14 +-- R/set_usms_param_xml.R | 14 +-- R/static_help.R | 4 +- R/stics_environment.R | 14 +++ R/stics_examples_utils.R | 23 +++-- R/upgrade_ini_xml.R | 12 ++- R/upgrade_param_gen_xml.R | 11 ++- R/upgrade_param_newform_xml.R | 13 ++- R/upgrade_plt_xml.R | 16 ++-- R/upgrade_sols_xml.R | 12 ++- R/upgrade_sta_xml.R | 12 ++- R/upgrade_tec_xml.R | 17 ++-- R/upgrade_usms_xml.R | 15 +-- R/upgrade_workspace_xml.R | 42 ++++----- R/var_to_col_names.R | 6 +- R/xml_document.R | 2 +- README.Rmd | 2 + README.md | 2 + cran-comments.md | 28 +++--- man/add_node_to_doc.Rd | 53 ----------- man/add_stics_nodes.Rd | 40 -------- man/add_stics_version.Rd | 57 ----------- man/all_out_var.Rd | 27 ------ man/attributes_list2matrix.Rd | 48 ---------- man/character_to_numeric_list.Rd | 26 ----- man/check_choice_param.Rd | 28 ------ man/check_java_path.Rd | 25 ----- man/check_java_workspace.Rd | 24 ----- man/check_javastics_cmd.Rd | 44 --------- man/check_output_files.Rd | 31 ------ man/check_usms_files.Rd | 47 ---------- man/check_version_compat.Rd | 25 ----- man/col_names_to_var.Rd | 23 ----- man/complete_climate_paths.Rd | 25 ----- man/compute_doy_cumul.Rd | 32 ------- man/convert_xml2txt.Rd | 3 +- man/convert_xml2txt_int.Rd | 36 ------- man/download_csv_files.Rd | 41 -------- man/download_data.Rd | 3 +- man/download_usm_csv.Rd | 4 +- man/download_usm_xl.Rd | 5 +- man/exist_param_csv.Rd | 36 ------- man/exist_param_xml.Rd | 34 ------- man/exists_javastics_path.Rd | 17 ---- man/exists_javastics_pref.Rd | 25 ----- man/exists_param.Rd | 30 ------ man/expand_stics_names.Rd | 33 ------- man/find_names.Rd | 34 ------- man/fix_missing_bounds.Rd | 23 ----- man/force_param_values.Rd | 2 +- man/gen_climate.Rd | 33 ------- man/gen_ini_doc.Rd | 50 ---------- man/gen_ini_xml.Rd | 12 +-- man/gen_new_travail.Rd | 38 -------- man/gen_obs.Rd | 5 +- man/gen_obs_.Rd | 35 ------- man/gen_paramsti.Rd | 32 ------- man/gen_sols_xml.Rd | 10 +- man/gen_sta_doc.Rd | 42 --------- man/gen_sta_xml.Rd | 9 +- man/gen_tec_doc.Rd | 49 ---------- man/gen_tec_xml.Rd | 7 +- man/gen_usms_sols_doc.Rd | 50 ---------- man/gen_usms_xml.Rd | 11 +-- man/gen_usms_xml2txt.Rd | 2 - man/gen_varmod.Rd | 8 +- man/get_climate_txt.Rd | 4 +- man/get_daily_results.Rd | 23 ----- man/get_data_dir.Rd | 27 ------ man/get_examples_path.Rd | 7 +- man/get_file.Rd | 56 ----------- man/get_file_.Rd | 54 ----------- man/get_file_int.Rd | 35 ------- man/get_file_one.Rd | 31 ------ man/get_formalisms_xml.Rd | 37 -------- man/get_java_version.Rd | 26 ----- man/get_java_workspace.Rd | 22 ----- man/get_javastics_cmd.Rd | 52 ---------- man/get_javastics_path.Rd | 16 ---- man/get_lai_forcing.Rd | 4 +- man/get_lai_forcing_xml.Rd | 24 ----- man/get_name_value_file_value.Rd | 25 ----- man/get_obs.Rd | 5 +- man/get_obs_txt.Rd | 44 --------- man/get_option_choice_param_values.Rd | 39 -------- man/get_options_choices.Rd | 34 ------- man/get_options_names.Rd | 32 ------- man/get_param_bounds.Rd | 49 ---------- man/get_param_bounds_xml.Rd | 46 --------- man/get_param_data_df.Rd | 67 ------------- man/get_param_desc.Rd | 30 ------ man/get_param_formalisms.Rd | 38 -------- man/get_param_info.Rd | 3 +- man/get_param_names.Rd | 43 --------- man/get_param_names_xml.Rd | 55 ----------- man/get_param_number.Rd | 37 -------- man/get_param_txt.Rd | 12 +-- man/get_param_type.Rd | 43 --------- man/get_param_value.Rd | 54 ----------- man/get_param_xml.Rd | 4 +- man/get_params_dict.Rd | 36 ------- man/get_params_from_doc.Rd | 22 ----- man/get_params_from_doc_attr.Rd | 24 ----- man/get_params_from_doc_node.Rd | 24 ----- man/get_params_from_table.Rd | 57 ----------- man/get_plant_name.Rd | 55 ----------- man/get_plants_nb.Rd | 3 - man/get_plants_nb_xml.Rd | 41 -------- man/get_referenced_dirs.Rd | 39 -------- man/get_report_results.Rd | 3 +- man/get_sim.Rd | 4 +- man/get_stics_versions_compat.Rd | 5 - man/get_svn_identifiers.Rd | 20 ---- man/get_txt_generic.Rd | 28 ------ man/get_values_by_param.Rd | 45 --------- man/get_var_info.Rd | 7 +- man/get_version_info_tmpl.Rd | 26 ----- man/get_version_num.Rd | 27 ------ man/get_version_string.Rd | 23 ----- man/get_versions_file_name.Rd | 20 ---- man/get_versions_file_path.Rd | 27 ------ man/get_versions_info.Rd | 35 ------- man/get_xml_base_doc.Rd | 38 -------- man/get_xml_base_node.Rd | 37 -------- man/get_xml_doc_example.Rd | 31 ------ man/get_xml_files_param_df.Rd | 94 ------------------- man/get_xml_stics_version.Rd | 36 ------- man/init_javastics_pref.Rd | 26 ----- man/is_os_name.Rd | 26 ----- man/is_stics_doc.Rd | 55 ----------- man/is_stics_var.Rd | 7 +- man/is_stics_xml.Rd | 52 ---------- man/merge_nodesets.Rd | 20 ---- man/parse_mixed_file.Rd | 46 --------- man/remove_node_from_doc.Rd | 54 ----------- man/remove_parent_from_doc.Rd | 37 -------- man/remove_stics_version.Rd | 45 --------- man/replace_string_in_file.Rd | 27 ------ man/replace_txt_param_value.Rd | 28 ------ man/set_codeoptim.Rd | 28 ------ man/set_file_executable.Rd | 18 ---- man/set_file_txt.Rd | 56 ----------- man/set_java_workspace.Rd | 32 ------- man/set_javastics_path.Rd | 18 ---- man/set_param_txt.Rd | 12 +-- man/set_param_value.Rd | 58 ------------ man/set_param_xml.Rd | 35 +++---- man/set_sols_param_xml.Rd | 49 ---------- man/set_usms_param_xml.Rd | 49 ---------- man/set_versions_info.Rd | 33 ------- man/static_help.Rd | 41 -------- man/stics_class.Rd | 15 --- man/stics_clean.Rd | 20 ---- man/stics_env.Rd | 21 ----- man/stics_exists.Rd | 20 ---- man/stics_get.Rd | 20 ---- man/stics_remove.Rd | 20 ---- man/stics_set.Rd | 22 ----- man/stics_split_list.Rd | 15 --- man/sticsenv_create.Rd | 20 ---- man/sticsenv_get_name.Rd | 20 ---- man/sticsenv_ls.Rd | 22 ----- man/sticsenv_name.Rd | 15 --- man/sticsenv_set_name.Rd | 23 ----- man/sub-.cropr_simulation.Rd | 9 +- man/unzip_examples.Rd | 22 ----- man/update_stics_version.Rd | 50 ---------- man/upgrade_ini_xml.Rd | 12 ++- man/upgrade_param_gen_xml.Rd | 10 +- man/upgrade_param_newform_xml.Rd | 12 ++- man/upgrade_plt_xml.Rd | 16 ++-- man/upgrade_sols_xml.Rd | 12 ++- man/upgrade_sta_xml.Rd | 12 ++- man/upgrade_tec_xml.Rd | 17 ++-- man/upgrade_usms_xml.Rd | 15 +-- man/var_to_col_names.Rd | 25 ----- man/var_to_stics_name.Rd | 31 ------ man/write_javastics_path.Rd | 17 ---- tests/testthat/test-check_java_path.R | 2 +- tests/testthat/test-convert_xml2txt.R | 6 +- tests/testthat/test-exist_param_xml.R | 3 +- tests/testthat/test-expand_stics_names.R | 4 +- tests/testthat/test-gen_ini_xml.R | 2 +- tests/testthat/test-gen_paramsti.R | 2 +- tests/testthat/test-gen_sols_xml.R | 2 +- tests/testthat/test-gen_sta_xml.R | 2 +- tests/testthat/test-gen_usms_xml.R | 2 +- tests/testthat/test-get_climate_txt.R | 2 +- tests/testthat/test-get_obs_txt.R | 2 +- .../test-get_option_choice_param_values.R | 4 +- tests/testthat/test-get_options_names.R | 2 +- tests/testthat/test-get_param_info.R | 2 +- tests/testthat/test-get_param_ini.R | 2 +- tests/testthat/test-get_param_names_xml.R | 2 +- tests/testthat/test-get_param_newform.R | 2 +- tests/testthat/test-get_param_plt.R | 5 +- tests/testthat/test-get_param_sols.R | 2 +- tests/testthat/test-get_param_sta.R | 4 +- tests/testthat/test-get_param_tec.R | 2 +- tests/testthat/test-get_param_usms.R | 4 +- tests/testthat/test-get_sim.R | 2 +- tests/testthat/test-get_sols_list.R | 2 +- tests/testthat/test-get_var_info.R | 2 +- tests/testthat/test-get_xml_doc_example.R | 9 +- tests/testthat/test-keepattr.R | 2 +- vignettes/Generating_Stics_XML_files.Rmd | 2 +- 305 files changed, 821 insertions(+), 4874 deletions(-) delete mode 100644 man/add_node_to_doc.Rd delete mode 100644 man/add_stics_nodes.Rd delete mode 100644 man/add_stics_version.Rd delete mode 100644 man/all_out_var.Rd delete mode 100644 man/attributes_list2matrix.Rd delete mode 100644 man/character_to_numeric_list.Rd delete mode 100644 man/check_choice_param.Rd delete mode 100644 man/check_java_path.Rd delete mode 100644 man/check_java_workspace.Rd delete mode 100644 man/check_javastics_cmd.Rd delete mode 100644 man/check_output_files.Rd delete mode 100644 man/check_usms_files.Rd delete mode 100644 man/check_version_compat.Rd delete mode 100644 man/col_names_to_var.Rd delete mode 100644 man/complete_climate_paths.Rd delete mode 100644 man/compute_doy_cumul.Rd delete mode 100644 man/convert_xml2txt_int.Rd delete mode 100644 man/download_csv_files.Rd delete mode 100644 man/exist_param_csv.Rd delete mode 100644 man/exist_param_xml.Rd delete mode 100644 man/exists_javastics_path.Rd delete mode 100644 man/exists_javastics_pref.Rd delete mode 100644 man/exists_param.Rd delete mode 100644 man/expand_stics_names.Rd delete mode 100644 man/find_names.Rd delete mode 100644 man/fix_missing_bounds.Rd delete mode 100644 man/gen_climate.Rd delete mode 100644 man/gen_ini_doc.Rd delete mode 100644 man/gen_new_travail.Rd delete mode 100644 man/gen_obs_.Rd delete mode 100644 man/gen_paramsti.Rd delete mode 100644 man/gen_sta_doc.Rd delete mode 100644 man/gen_tec_doc.Rd delete mode 100644 man/gen_usms_sols_doc.Rd delete mode 100644 man/get_daily_results.Rd delete mode 100644 man/get_data_dir.Rd delete mode 100644 man/get_file.Rd delete mode 100644 man/get_file_.Rd delete mode 100644 man/get_file_int.Rd delete mode 100644 man/get_file_one.Rd delete mode 100644 man/get_formalisms_xml.Rd delete mode 100644 man/get_java_version.Rd delete mode 100644 man/get_java_workspace.Rd delete mode 100644 man/get_javastics_cmd.Rd delete mode 100644 man/get_javastics_path.Rd delete mode 100644 man/get_lai_forcing_xml.Rd delete mode 100644 man/get_name_value_file_value.Rd delete mode 100644 man/get_obs_txt.Rd delete mode 100644 man/get_option_choice_param_values.Rd delete mode 100644 man/get_options_choices.Rd delete mode 100644 man/get_options_names.Rd delete mode 100644 man/get_param_bounds.Rd delete mode 100644 man/get_param_bounds_xml.Rd delete mode 100644 man/get_param_data_df.Rd delete mode 100644 man/get_param_desc.Rd delete mode 100644 man/get_param_formalisms.Rd delete mode 100644 man/get_param_names.Rd delete mode 100644 man/get_param_names_xml.Rd delete mode 100644 man/get_param_number.Rd delete mode 100644 man/get_param_type.Rd delete mode 100644 man/get_param_value.Rd delete mode 100644 man/get_params_dict.Rd delete mode 100644 man/get_params_from_doc.Rd delete mode 100644 man/get_params_from_doc_attr.Rd delete mode 100644 man/get_params_from_doc_node.Rd delete mode 100644 man/get_params_from_table.Rd delete mode 100644 man/get_plant_name.Rd delete mode 100644 man/get_plants_nb_xml.Rd delete mode 100644 man/get_referenced_dirs.Rd delete mode 100644 man/get_svn_identifiers.Rd delete mode 100644 man/get_txt_generic.Rd delete mode 100644 man/get_values_by_param.Rd delete mode 100644 man/get_version_info_tmpl.Rd delete mode 100644 man/get_version_num.Rd delete mode 100644 man/get_version_string.Rd delete mode 100644 man/get_versions_file_name.Rd delete mode 100644 man/get_versions_file_path.Rd delete mode 100644 man/get_versions_info.Rd delete mode 100644 man/get_xml_base_doc.Rd delete mode 100644 man/get_xml_base_node.Rd delete mode 100644 man/get_xml_doc_example.Rd delete mode 100644 man/get_xml_files_param_df.Rd delete mode 100644 man/get_xml_stics_version.Rd delete mode 100644 man/init_javastics_pref.Rd delete mode 100644 man/is_os_name.Rd delete mode 100644 man/is_stics_doc.Rd delete mode 100644 man/is_stics_xml.Rd delete mode 100644 man/merge_nodesets.Rd delete mode 100644 man/parse_mixed_file.Rd delete mode 100644 man/remove_node_from_doc.Rd delete mode 100644 man/remove_parent_from_doc.Rd delete mode 100644 man/remove_stics_version.Rd delete mode 100644 man/replace_string_in_file.Rd delete mode 100644 man/replace_txt_param_value.Rd delete mode 100644 man/set_codeoptim.Rd delete mode 100644 man/set_file_executable.Rd delete mode 100644 man/set_file_txt.Rd delete mode 100644 man/set_java_workspace.Rd delete mode 100644 man/set_javastics_path.Rd delete mode 100644 man/set_param_value.Rd delete mode 100644 man/set_sols_param_xml.Rd delete mode 100644 man/set_usms_param_xml.Rd delete mode 100644 man/set_versions_info.Rd delete mode 100644 man/static_help.Rd delete mode 100644 man/stics_class.Rd delete mode 100644 man/stics_clean.Rd delete mode 100644 man/stics_env.Rd delete mode 100644 man/stics_exists.Rd delete mode 100644 man/stics_get.Rd delete mode 100644 man/stics_remove.Rd delete mode 100644 man/stics_set.Rd delete mode 100644 man/stics_split_list.Rd delete mode 100644 man/sticsenv_create.Rd delete mode 100644 man/sticsenv_get_name.Rd delete mode 100644 man/sticsenv_ls.Rd delete mode 100644 man/sticsenv_name.Rd delete mode 100644 man/sticsenv_set_name.Rd delete mode 100644 man/unzip_examples.Rd delete mode 100644 man/update_stics_version.Rd delete mode 100644 man/var_to_col_names.Rd delete mode 100644 man/var_to_stics_name.Rd delete mode 100644 man/write_javastics_path.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 7223d50f..7313b85f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: SticsRFiles Title: Read and Modify 'STICS' Input/Output Files Version: 1.1.3 -Date: 2023-06-29 +Date: 2023-07-10 Authors@R: c( person("Patrice", "Lecharpentier", , "patrice.lecharpentier@inrae.fr", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4044-4322")), @@ -22,14 +22,12 @@ Authors@R: c( person("Joel", "Leonard", role = "rev") ) Description: Manipulating input and output files of the 'STICS' crop - model. These files are either standard 'JavaSTICS' XML files or more - directly the text files used by the model 'fortran' executable. The - most basic functionality is to read and write parameter names and - values through XML queries, or text files ones. More advanced - functionalities include the generation of input XML from XML templates - and spreadsheets with as many simulations contexts as needed, or the - generation of the input text files from the XML input files for - distributed computing. + model. Files are either 'JavaSTICS' XML files or text files used by + the model 'fortran' executable. Most basic functionalities are reading + or writing parameter names and values in both XML or text input files, + and getting data from output files. Advanced functionalities include + XML files generation from XML templates and/or spreadsheets, or text + files generation from XML files by using 'xslt' transformation. License: LGPL (>= 3) URL: https://github.com/SticsRPacks/SticsRFiles, https://doi.org/10.5281/zenodo.4443206 diff --git a/NAMESPACE b/NAMESPACE index 4a066c82..6e3b6f5f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,7 +23,6 @@ export(get_obs) export(get_param_info) export(get_param_txt) export(get_param_xml) -export(get_params_dict) export(get_plant_txt) export(get_plants_nb) export(get_report_results) diff --git a/NEWS.md b/NEWS.md index 66f8dcf1..1a8a9a67 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,8 @@ -# SticsRFiles 1.1.3 _2023-06-29_ +# SticsRFiles 1.1.3 _2023-07-10_ * FUNCTIONS * New function for generating the new_travail.usm STICS file - * New function for generating wheather data file (climat.txt) + * New function for generating weather data files (climat.txt) * New unit tests added * FIXES: diff --git a/R/add_node_to_doc.R b/R/add_node_to_doc.R index 4b888307..26a5c7ef 100644 --- a/R/add_node_to_doc.R +++ b/R/add_node_to_doc.R @@ -10,28 +10,28 @@ #' \dontrun{ #' #' tec_xml <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -#' tec_doc <- SticsRFiles:::xmldocument(tec_xml) +#' tec_doc <- xmldocument(tec_xml) #' #' # Getting a new irrigation operation node -#' irrigation_node <- SticsRFiles:::get_xml_base_node("tec", "irrigation") -#' parent_path <- SticsRFiles:::get_param_type( +#' irrigation_node <- get_xml_base_node("tec", "irrigation") +#' parent_path <- get_param_type( #' tec_doc, "ta", "formalisme", #' "irrigation" #' )$xpath #' #' # Adding one irrigation operation -#' SticsRFiles:::add_node_to_doc( +#' add_node_to_doc( #' xml_doc = tec_doc, new_node = irrigation_node, #' nodes_nb = 1, parent_path = parent_path #' ) #' #' # Checking irrigations operations number -#' irrigations_nb <- length(SticsRFiles:::get_param_value( +#' irrigations_nb <- length(get_param_value( #' tec_doc, #' "julapI_or_sum_upvt" #' )) #' # Fixing it in nb_interventions attribute -#' SticsRFiles:::set_param_value( +#' set_param_value( #' tec_doc, "nb_interventions", irrigations_nb, #' "irrigation" #' ) @@ -39,6 +39,8 @@ #' #' @keywords internal #' +#' @noRd +#' add_node_to_doc <- function(xml_doc, new_node, nodes_nb = 1, parent_path) { # Checking that parent_path is valid xpath for xml_doc diff --git a/R/add_stics_nodes.R b/R/add_stics_nodes.R index 559e5726..74c89963 100644 --- a/R/add_stics_nodes.R +++ b/R/add_stics_nodes.R @@ -9,16 +9,19 @@ #' \dontrun{ #' #' tec_xml <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -#' tec_doc <- SticsRFiles:::xmldocument(tec_xml) +#' tec_doc <- xmldocument(tec_xml) #' #' # Adding one irrigation operation -#' SticsRFiles:::add_stics_nodes(tec_doc, "irrigation") +#' add_stics_nodes(tec_doc, "irrigation") #' #' # Adding three irrigation operations -#' SticsRFiles:::add_stics_nodes(tec_doc, "irrigation", nodes_nb = 3) +#' add_stics_nodes(tec_doc, "irrigation", nodes_nb = 3) #' } #' #' @keywords internal +#' +#' @noRd +#' add_stics_nodes <- function(xml_doc, formalism_name = NULL, nodes_nb = 1, stics_version = "latest") { diff --git a/R/all_out_var.R b/R/all_out_var.R index 539ee251..08ffa6e3 100644 --- a/R/all_out_var.R +++ b/R/all_out_var.R @@ -17,6 +17,8 @@ #' } #' @keywords internal #' +#' @noRd +#' all_out_var <- function(stics_version = "latest") { # Checking and getting the right version @@ -68,10 +70,9 @@ all_out_var <- function(stics_version = "latest") { #' @return A data.frame with information about variable(s) with columns #' `name`, `definition`, `unit`, `type` #' -#' @seealso \code{\link{all_out_var}} #' #' @examples -#' \dontrun{ +#' #' # Find by variable name (fuzzy search): #' SticsRFiles::get_var_info("lai") #' @@ -80,7 +81,7 @@ all_out_var <- function(stics_version = "latest") { #' #' # Find for a particular version: #' SticsRFiles::get_var_info("lai", stics_version = "V9.0") -#' } +#' #' #' @export #' @@ -137,16 +138,15 @@ get_var_info <- function(var = NULL, #' @param version `r lifecycle::badge("deprecated")` `version` is no #' longer supported, use `stics_version` instead. #' -#' @return A boolean vector: `TRUE` if the variable exist, `FALSE` if it doesn't +#' @return A boolean vector: `TRUE` if the variable exist, `FALSE` otherwise #' #' @seealso `get_var_info()` for interactive use. #' #' @export #' #' @examples -#' \dontrun{ -#' is_stics_var(c("lai(n)", "masec(n)", "truc")) -#' } +#' is_stics_var(c("lai(n)", "masec(n)", "unknown")) +#' is_stics_var <- function(var, stics_version = "latest", version = lifecycle::deprecated()) { diff --git a/R/attributes_list2matrix.R b/R/attributes_list2matrix.R index b8f8b0e6..28e810cd 100644 --- a/R/attributes_list2matrix.R +++ b/R/attributes_list2matrix.R @@ -10,8 +10,8 @@ #' \dontrun{ #' #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' node_set <- SticsRFiles:::get_nodes(sols_doc, +#' sols_doc <- xmldocument(xml_path) +#' node_set <- get_nodes(sols_doc, #' "//*[@nom=\"solcanne\" or @nom=\"mulchbat\"]") #' attr_list <- sapply(node_set, function(x) XML::xmlAttrs(x)) #' @@ -27,7 +27,7 @@ #' #> format max min nom #' #> "real" "2.0" "0.0" "mulchbat" #' -#' SticsRFiles:::attributes_list2matrix(attr_list) +#' attributes_list2matrix(attr_list) #' #' #> nom format max min #' #> [1,] "solcanne" NA NA NA @@ -37,6 +37,8 @@ #' #' @keywords internal #' +#' @noRd +#' attributes_list2matrix <- function(attr_list) { # Getting unique attributes names list diff --git a/R/check_choice_param.R b/R/check_choice_param.R index 451fa722..889e5b51 100644 --- a/R/check_choice_param.R +++ b/R/check_choice_param.R @@ -7,6 +7,8 @@ #' @return invisible NULL #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' check_choice_param(xml_doc = xml_doc, param_name = param_name) diff --git a/R/check_java_path.R b/R/check_java_path.R index 893b3947..2b2780bd 100644 --- a/R/check_java_path.R +++ b/R/check_java_path.R @@ -11,7 +11,9 @@ #' } #' #' @keywords internal - +#' +#' @noRd +#' check_java_path <- function(javastics) { if (!file.exists(javastics)) { stop("The JavaStics folder doesn't exist : ", javastics) diff --git a/R/check_java_workspace.R b/R/check_java_workspace.R index 853a87bb..c38281bd 100644 --- a/R/check_java_workspace.R +++ b/R/check_java_workspace.R @@ -12,6 +12,7 @@ #' @return An absolute JavaSTICS workspace path #' #' @keywords internal +#' @noRd check_java_workspace <- function(javastics, workspace = NULL) { diff --git a/R/check_output_files.R b/R/check_output_files.R index 2078af23..866d1f86 100644 --- a/R/check_output_files.R +++ b/R/check_output_files.R @@ -18,6 +18,7 @@ #' } #' #' @keywords internal +#' @noRd check_output_files <- function(run_dir, usm_name = NULL) { if (base::is.null(usm_name)) { diff --git a/R/check_usms_files.R b/R/check_usms_files.R index 363007b4..f7a34292 100644 --- a/R/check_usms_files.R +++ b/R/check_usms_files.R @@ -12,6 +12,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' diff --git a/R/col_names_to_var.R b/R/col_names_to_var.R index a57321b3..8bb6d6a1 100644 --- a/R/col_names_to_var.R +++ b/R/col_names_to_var.R @@ -7,9 +7,11 @@ #' #' @examples #' col_names <- c("var1", "var2_n", "var3.1.") -#' valid_names <- SticsRFiles:::col_names_to_var(col_names) +#' valid_names <- col_names_to_var(col_names) #' @keywords internal #' +#' @noRd +#' col_names_to_var <- function(var_list = c()) { . <- NULL diff --git a/R/compute_doy_cumul.R b/R/compute_doy_cumul.R index 0aab0c13..6c67c177 100644 --- a/R/compute_doy_cumul.R +++ b/R/compute_doy_cumul.R @@ -9,15 +9,17 @@ #' #' @examples #' \dontrun{ -#' SticsRFiles:::compute_doy_cumul(c(350, 360, 10, 20, 30), c( +#' compute_doy_cumul(c(350, 360, 10, 20, 30), c( #' 1990, 1990, 1991, #' 1991, 1991 #' )) #' } #' -#' # +#' #' @keywords internal #' +#' @noRd +#' compute_doy_cumul <- function(doys_vec, years_vec) { if (!all(c(class(doys_vec), class(years_vec)) %in% c("numeric", "integer"))) { stop("Vectors are not all numeric/integer ones, aborting !") diff --git a/R/convert_xml2txt.R b/R/convert_xml2txt.R index ad21325d..78643331 100644 --- a/R/convert_xml2txt.R +++ b/R/convert_xml2txt.R @@ -22,10 +22,11 @@ #' @return None #' #' @examples +#' #' \dontrun{ #' xml_path <- "/path/to/corn_plt.xml" #' javastics_path <- "/path/to/JavaSTICS/folder" -#' convert_xml2txt(xml_file = xml_path, java_dir = javastics_path) +#' convert_xml2txt(file = xml_path, javastics = javastics_path) #' } #' #' @export diff --git a/R/convert_xml2txt_int.R b/R/convert_xml2txt_int.R index 0c993b76..406123da 100644 --- a/R/convert_xml2txt_int.R +++ b/R/convert_xml2txt_int.R @@ -16,11 +16,13 @@ #' xsl_file <- #' "/path/to/JavaSTICS/folder/bin/resources/xml/stylesheet/xml2txt.xsl" #' -#' SticsRFiles:::convert_xml2txt_int(xml_file = xml_plt, style_file = xsl_file) +#' convert_xml2txt_int(xml_file = xml_plt, style_file = xsl_file) #' } #' #' @keywords internal #' +#' @noRd +#' convert_xml2txt_int <- function(xml_file, style_file, out_file = NULL) { f_names <- c(xml_file, style_file) diff --git a/R/download_data.R b/R/download_data.R index 04895b7f..cdfc6ed5 100644 --- a/R/download_data.R +++ b/R/download_data.R @@ -18,7 +18,6 @@ #' @export #' #' @examples -#' \dontrun{ #' #' # Getting all data #' download_data() @@ -28,7 +27,7 @@ #' #' # Getting data for a given example : study_case_1 and a given version #' download_data(example_dirs = "study_case_1", stics_version = "V9.0") -#' } +#' download_data <- function(out_dir = tempdir(), example_dirs = NULL, stics_version = "latest", dir = lifecycle::deprecated(), @@ -108,18 +107,20 @@ download_data <- function(out_dir = tempdir(), example_dirs = NULL, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' # Getting all available dirs from the data repos -#' SticsRFiles:::get_referenced_dirs() +#' get_referenced_dirs() #' #' # Getting dirs for a use case -#' SticsRFiles:::get_referenced_dirs("study_case_1") +#' get_referenced_dirs("study_case_1") #' #' # Getting dirs for a use case and a version -#' SticsRFiles:::get_referenced_dirs("study_case_1", "V9.0") +#' get_referenced_dirs("study_case_1", "V9.0") #' -#' SticsRFiles:::get_referenced_dirs(c("study_case_1", "study_case_2"), "V9.0") +#' get_referenced_dirs(c("study_case_1", "study_case_2"), "V9.0") #' } #' get_referenced_dirs <- function(dirs = NULL, stics_version = NULL) { diff --git a/R/download_usm_xl.R b/R/download_usm_xl.R index 27bbaad7..ba652d94 100644 --- a/R/download_usm_xl.R +++ b/R/download_usm_xl.R @@ -27,10 +27,9 @@ #' @return A vector of copied files path. #' #' @examples -#' \dontrun{ +#' #' download_usm_xl() -#' download_usm_xl(out_dir = "/path/to/destination/dir") -#' } +#' #' #' @export #' @@ -66,12 +65,6 @@ download_usm_xl <- function(file = NULL, dest_dir <- out_dir # to remove when we update inside the function } - oldw <- getOption("warn") - if (!verbose) { - options(warn = -1) - } else { - options(warn = 0) - } args <- list(...) @@ -115,7 +108,7 @@ download_usm_xl <- function(file = NULL, if (any(success)) { if (verbose) - print(paste(files_list[success], + message(paste(files_list[success], " has been copied in directory ", dest_dir)) dest_list <- dest_list[success] @@ -125,7 +118,6 @@ download_usm_xl <- function(file = NULL, warning("Error copying files:\n", paste(src_list[!success], collapse = "\n")) - options(warn = oldw) return(invisible(dest_list)) } @@ -155,9 +147,7 @@ download_usm_xl <- function(file = NULL, #' @return A vector of copied files path. #' #' @examples -#' \dontrun{ -#' download_usm_csv(out_dir = "/path/to/destination/dir") -#' } +#' download_usm_csv(out_dir = tempdir()) #' #' @export #' diff --git a/R/exist_param_xml.R b/R/exist_param_xml.R index 0bebcb73..a81aa868 100644 --- a/R/exist_param_xml.R +++ b/R/exist_param_xml.R @@ -8,6 +8,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' @@ -52,6 +54,8 @@ exist_param_xml <- function(param, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' diff --git a/R/exists_javastics_pref.R b/R/exists_javastics_pref.R index e7c60f32..29bcfbe3 100644 --- a/R/exists_javastics_pref.R +++ b/R/exists_javastics_pref.R @@ -13,6 +13,10 @@ #' @return logical value, TRUE if file exists, FALSE otherwise #' #' @keywords internal +#' +#' @noRd +#' +#' exists_javastics_pref <- function(javastics) { # checking javastics path check_java_path(javastics) diff --git a/R/exists_param.R b/R/exists_param.R index 140e9ba2..91425fa3 100644 --- a/R/exists_param.R +++ b/R/exists_param.R @@ -12,12 +12,14 @@ #' @examples #' xml_sols <- file.path(get_examples_path(file_type = "xml"), "sols.xml") #' -#' xml_doc <- SticsRFiles:::xmldocument(xml_sols) +#' xml_doc <- xmldocument(xml_sols) #' -#' SticsRFiles:::exists_param(xml_doc, "cfes") -#' SticsRFiles:::exists_param(xml_doc, c("cfes", "mulchbat")) +#' exists_param(xml_doc, "cfes") +#' exists_param(xml_doc, c("cfes", "mulchbat")) #' @keywords internal #' +#' @noRd +#' exists_param <- function(xml_doc_object, param_name, ...) { nb <- get_param_number(xml_doc_object, param_name, ...) diff --git a/R/expand_stics_names.R b/R/expand_stics_names.R index c3ad8273..ce846652 100644 --- a/R/expand_stics_names.R +++ b/R/expand_stics_names.R @@ -13,11 +13,13 @@ #' csv_file <- "/path/to/JavaSTICS/folder/config/inputs.csv" #' out_csv_file <- "/path/to/out/dir/config/inputs_xpanded.csv" #' -#' SticsRFiles:::expand_stics_names(csv_file, out_csv_file) +#' expand_stics_names(csv_file, out_csv_file) #' } #' #' @keywords internal #' +#' @noRd +#' expand_stics_names <- function(in_csv_file, out_csv_file, header_vec = NULL) { in_data <- utils::read.table(in_csv_file, sep = ";", stringsAsFactors = FALSE, diff --git a/R/extract.R b/R/extract.R index a1af1b5f..9e26ed42 100644 --- a/R/extract.R +++ b/R/extract.R @@ -10,11 +10,10 @@ #' @export #' #' @examples -#' \dontrun{ -#' library(SticsRFiles) -#' sim <- SticsRFiles::get_sim(workspace = "inst/extdata/stics_example_1") -#' sim[[1]] # returns a `cropr_simulation` list -#' } +#' path <- file.path(get_examples_path("sti"), "workspace1") +#' sim <- SticsRFiles::get_sim(workspace = path) +#' # sim returns a `cropr_simulation` list +#' `[.cropr_simulation` <- function(x, ...) { l <- unclass(x)[...] attr_names <- names(attributes(x)) diff --git a/R/file_document.R b/R/file_document.R index 5f0db24e..a29eeded 100644 --- a/R/file_document.R +++ b/R/file_document.R @@ -1,6 +1,4 @@ #' @include global.R -#' @keywords internal - #' An S4 class to represent a file or dir. #' #' @slot type A file type ('file','dir') @@ -11,6 +9,9 @@ #' @slot content A file content #' @slot warn Logical, to display (TRUE) or not (FALSE) warnings (default) #' +#' @keywords internal +#' @noRd +#' setClass( "file_document", representation( @@ -156,7 +157,7 @@ setMethod("exist", signature(object = "file_document"), } } if (!ret & message) { - print(paste0(" File doesn't exist: ", p)) + message(paste0(" File doesn't exist: ", p)) } return(ret) } @@ -183,7 +184,7 @@ setMethod("create", signature(object = "file_document"), dir.create(p) } } else { - print(paste0(" File already exists : ", p)) + warning(paste0(" File already exists : ", p)) } } ) diff --git a/R/find_names.R b/R/find_names.R index 7db298c1..aa7f265b 100644 --- a/R/find_names.R +++ b/R/find_names.R @@ -7,15 +7,17 @@ #' @return Character vector of founds strings #' @keywords internal #' +#' @noRd +#' #' @examples #' #' names <- c("abscission", "alphaphot", "codelaitr", "dlaimax", "lai") #' -#' SticsRFiles:::find_names(names, "lai") +#' find_names(names, "lai") #' #' #> [1] "codelaitr" "dlaimax" #' -#' SticsRFiles:::find_names(names, "lai", exact = TRUE) +#' find_names(names, "lai", exact = TRUE) #' #' #> [1] "lai" find_names <- function(names, name, exact = FALSE) { diff --git a/R/force_param_values.R b/R/force_param_values.R index a8fa3544..7a0f6e96 100644 --- a/R/force_param_values.R +++ b/R/force_param_values.R @@ -30,7 +30,7 @@ #' example_txt_dir <- get_examples_path(file_type = "txt") #' force_param_values(example_txt_dir, #' setNames(object = c(220, 330), c("stlevamf", "stamflax")), -#' javastics = "/path/to/JavaSTICS/folder" +#' javastics = "/path/to/javastics" #' ) #' } #' diff --git a/R/gen_climate.R b/R/gen_climate.R index ec235af1..265aa5cf 100644 --- a/R/gen_climate.R +++ b/R/gen_climate.R @@ -10,13 +10,15 @@ #' #' @examples #' \dontrun{ -#' SticsRFiles:::gen_climate( +#' gen_climate( #' c("path/to/weather.year1", "path/to/weather.year2"), #' "/path/to/out/dir" ) #' } #' #' @keywords internal #' +#' @noRd +#' gen_climate <- function(files_path, out_dir) { # generate intermediate paths for a multi-years simulation @@ -55,12 +57,15 @@ gen_climate <- function(files_path, out_dir) { #' #' @examples #' \dontrun{ -#' SticsRFiles:::complete_climate_paths( +#' complete_climate_paths( #' c("path/to/weather.year1", "path/to/weather.year2")) #' } #' #' @keywords internal #' +#' @noRd +#' +#' complete_climate_paths <- function(files_path) { files_nb <- length(files_path) diff --git a/R/gen_ini_doc.R b/R/gen_ini_doc.R index 024d16b0..f642cd27 100644 --- a/R/gen_ini_doc.R +++ b/R/gen_ini_doc.R @@ -20,11 +20,13 @@ #' xl_path <- "inputs_stics_example.xlsx" #' download_usm_xl(file = xl_path) #' ini_param_df <- read_excel(xl_path, sheet = "Ini") -#' ini_doc <- SticsRFiles:::gen_ini_doc(param_table = ini_param_df) +#' ini_doc <- gen_ini_doc(param_table = ini_param_df) #' } #' #' @keywords internal #' +#' @noRd +#' gen_ini_doc <- function(xml_doc = NULL, param_table = NULL, crop_tag = "Crop", diff --git a/R/gen_ini_xml.R b/R/gen_ini_xml.R index 99f05ac6..76b6b7d2 100644 --- a/R/gen_ini_xml.R +++ b/R/gen_ini_xml.R @@ -51,24 +51,21 @@ #' @return an invisible xml_document object or a list of #' #' @examples -#' \dontrun{ #' library(readxl) #' -#' xl_path <- "inputs_stics_example.xlsx" -#' download_usm_xl(file = xl_path) +#' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") +#' #' ini_param_df <- read_excel(xl_path, sheet = "Ini") #' gen_ini_xml( -#' out_dir = "/path/to/dest/dir", +#' out_dir = tempdir(), #' param_table = ini_param_df #' ) -#' } #' #' @export #' -# TODO: refactor with gen_sta_file, gen_tec_file : same code -gen_ini_xml <- function(param_df = NULL, +gen_ini_xml <- function(param_df, file = NULL, - out_dir = getwd(), + out_dir, crop_tag = "Crop", stics_version = "latest", ini_in_file = lifecycle::deprecated(), @@ -128,10 +125,10 @@ gen_ini_xml <- function(param_df = NULL, out_idx <- unlist(lapply(xml_docs, base::is.null)) if (any(out_idx)) { - cat("\n") - cat(paste0("Errors have been detected while trying to replace", - " parameters values in xml documents\n")) - cat(paste(sum(!out_idx), "files have been generated !\n")) + message("\nErrors have been detected while trying to replace", + "parameters values in xml documents", + paste(sum(!out_idx), "files have been generated !"), + appendLF = TRUE) # selecting available documents to produce xml_docs <- xml_docs[out_idx] } diff --git a/R/gen_new_travail.R b/R/gen_new_travail.R index 7d5ddf7d..8a15a652 100644 --- a/R/gen_new_travail.R +++ b/R/gen_new_travail.R @@ -12,23 +12,24 @@ #' (containing parameters values to be forced), 0 otherwise #' @param out_dir Directory path where to store the `new_travail.usm` file. #' -# @return -# @export +#' #' @keywords internal #' -# @examples +#' @noRd +#' + gen_new_travail <- function(workspace, usm, - lai_forcing = 0, - codesuite = 0, - codoptim = 0, - out_dir = getwd()) { + lai_forcing = NULL, + codesuite = NULL, + codoptim = NULL, + out_dir = NULL) { usm_data <- get_usm_data(workspace, usm, - lai_forcing = 0, - codesuite = 0, - codoptim = 0) + lai_forcing = lai_forcing, + codesuite = codesuite, + codoptim = codoptim) data_order <- c("codesimul", "codoptim", "codesuite", "nbplantes", "nom", "datedebut", "datefin", "finit", "numsol", "nomsol", @@ -36,6 +37,8 @@ gen_new_travail <- function(workspace, "fclim1", "fclim2", "nbans", "culturean", "fplt1", "ftec1", "flai1", "fplt2", "ftec2", "flai2") + if (is.null(out_dir)) out_dir <- workspace + out_file <- file.path(out_dir, "new_travail.usm") p_table <- vector(mode = "character", length = 2 * length(data_order)) @@ -53,9 +56,9 @@ gen_new_travail <- function(workspace, get_usm_data <- function(workspace, usm, - lai_forcing = 0, - codesuite = 0, - codoptim = 0) { + lai_forcing = NULL, + codesuite = NULL, + codoptim = NULL) { data <- list() @@ -64,13 +67,18 @@ get_usm_data <- function(workspace, usm, select = "usm", select_value = usm)$usms.xml - # codesimul + # forcing codesimul # 0: culture, 1: feuille, lai forcing - data$codesimul <- get_codesimul(lai_forcing) + if (!is.null(lai_forcing) && lai_forcing %in% c(0, 1)) + data$codesimul <- get_codesimul(lai_forcing) - data$codoptim <- codoptim + # forcing codoptim + if (!is.null(codoptim) && codoptim %in% c(0, 1)) + data$codoptim <- codoptim - data$codesuite <- codesuite + # forcing codesuite + if (!is.null(codesuite) && codesuite %in% c(0, 1)) + data$codesuite <- codesuite # nbplantes #data$nbplantes @@ -109,7 +117,7 @@ get_usm_data <- function(workspace, data$nbans <- as.numeric(strsplit(x = data$fclim2, split = ".", fixed = TRUE)[[1]][2]) - as.numeric(strsplit(x = data$fclim1, split = ".", fixed = TRUE)[[1]][2]) + - data$culturean + 1 # culturean # data$culturean diff --git a/R/gen_obs.R b/R/gen_obs.R index 50afcccb..20913e3f 100644 --- a/R/gen_obs.R +++ b/R/gen_obs.R @@ -34,17 +34,14 @@ #' files (FALSE), TRUE when no errors. #' #' @examples -#' \dontrun{ -#' #' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") #' obs_df <- read_params_table(file = xl_path, sheet_name = "Obs") #' gen_obs(df = obs_df, out_dir = "/path/to/dest/dir") -#' } #' #' @export #' gen_obs <- function(df, - out_dir = getwd(), + out_dir, usms_list = NULL, obs_table = lifecycle::deprecated(), out_path = lifecycle::deprecated()) { @@ -136,6 +133,8 @@ gen_obs <- function(df, #' #' @keywords internal #' +#' @noRd +#' gen_obs_ <- function(obs_table, file_path) { diff --git a/R/gen_paramsti.R b/R/gen_paramsti.R index 6a6356e8..8b694df1 100644 --- a/R/gen_paramsti.R +++ b/R/gen_paramsti.R @@ -16,6 +16,8 @@ #' #' @keywords internal #' +#' @noRd +#' gen_paramsti <- function(workspace, par_names, par_values, diff --git a/R/gen_sols_xml.R b/R/gen_sols_xml.R index 7605a2de..5029b137 100644 --- a/R/gen_sols_xml.R +++ b/R/gen_sols_xml.R @@ -52,19 +52,19 @@ #' @return an invisible xml_document object #' #' @examples -#' \dontrun{ #' #' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") +#' #' sols_param_df <- read_params_table(file = xl_path, sheet_name = "Soils") -#' gen_sols_xml(file = "sols.xml", param_df = sols_param_df) -#' } +#' gen_sols_xml(file = file.path(tempdir(), "sols.xml"), +#' param_df = sols_param_df) #' #' @export #' #' #' -gen_sols_xml <- function(file = file.path(getwd(), "sols.xml"), - param_df = NULL, +gen_sols_xml <- function(file, + param_df, template = NULL, stics_version = "latest", sols_in_file = lifecycle::deprecated(), @@ -111,11 +111,6 @@ gen_sols_xml <- function(file = file.path(getwd(), "sols.xml"), xml_doc <- NULL - # Fix : default output file path if not provided - if (base::is.null(sols_out_file)) { - sols_out_file <- file.path(getwd(), "sols.xml") - } - if (!base::is.null(sols_in_file)) { xml_doc <- xmldocument(sols_in_file) } diff --git a/R/gen_sta_doc.R b/R/gen_sta_doc.R index f5255275..996abf10 100644 --- a/R/gen_sta_doc.R +++ b/R/gen_sta_doc.R @@ -16,11 +16,12 @@ #' xl_path <- "inputs_stics_example.xlsx" #' download_usm_xl(file = xl_path) #' sta_param_df <- readxl::read_excel(xl_path, sheet = "Station") -#' sta_doc <- SticsRFiles:::gen_sta_doc(param_table = sta_param_df) +#' sta_doc <- gen_sta_doc(param_table = sta_param_df) #' } #' #' @keywords internal #' +#' @noRd gen_sta_doc <- function(xml_doc = NULL, param_table = NULL, stics_version = "latest", diff --git a/R/gen_sta_xml.R b/R/gen_sta_xml.R index 085f83c5..e70cbe57 100644 --- a/R/gen_sta_xml.R +++ b/R/gen_sta_xml.R @@ -39,19 +39,16 @@ #' @return an invisible xml_document object or a list of #' #' @examples -#' \dontrun{ -#' #' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") #' sta_param_df <- read_params_table(file = xl_path, sheet_name = "Station") -#' gen_sta_xml(out_dir = "/path/to/dest/dir", param_df = sta_param_df) -#' } +#' gen_sta_xml(out_dir = tempdir(), param_df = sta_param_df) #' #' @export #' # TODO: refactor with gen_tec_file, gen_ini_file : same code -gen_sta_xml <- function(param_df = NULL, +gen_sta_xml <- function(param_df, file = NULL, - out_dir = getwd(), + out_dir, stics_version = "latest", param_table = lifecycle::deprecated(), sta_in_file = lifecycle::deprecated(), @@ -111,10 +108,10 @@ gen_sta_xml <- function(param_df = NULL, out_idx <- unlist(lapply(xml_docs, base::is.null)) if (any(out_idx)) { - cat("\n") - cat(paste0("Errors have been detected while trying to replace", - " parameters values in xml documents\n")) - cat(paste(sum(!out_idx), "files have been generated !\n")) + message(paste0("\nErrors have been detected while trying to replace", + "parameters values in xml documents\n"), + paste(sum(!out_idx), "files have been generated !\n")) + # selecting available documents to produce xml_docs <- xml_docs[out_idx] } diff --git a/R/gen_tec_doc.R b/R/gen_tec_doc.R index 0894930b..7d7dd8ed 100644 --- a/R/gen_tec_doc.R +++ b/R/gen_tec_doc.R @@ -22,11 +22,13 @@ #' ) #' xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") #' tec_param_df <- read_excel(xl_path, sheet = "Tec") -#' tec_doc <- SticsRFiles:::gen_tec_doc(param_table = tec_param_df) +#' tec_doc <- gen_tec_doc(param_table = tec_param_df) #' } #' #' @keywords internal #' +#' @noRd +#' gen_tec_doc <- function(xml_doc = NULL, param_table = NULL, stics_version = "latest", @@ -186,22 +188,17 @@ gen_tec_doc <- function(xml_doc = NULL, xpath_node )[[1]])) == "formalisme") { gen_error <- TRUE - cat(paste( + message(paste( "The parameter", par_name, "is unique in the original xml file,", "and not attached to \"intervention\"\n" )) - cat(paste0("Multiple values are present in input table,", + message(paste0("Multiple values are present in input table,", " check consistency with formalism definition !\n")) - cat("The treatment for this parameter is aborted.") - cat("\n") + message("The treatment for this parameter has aborted.\n") next } - if (par_name == "engrais") { - print("ok for multiple engrais !") - } - # Removing existing nodes, for creating new set of # after that remove_parent_from_doc( @@ -227,7 +224,7 @@ gen_tec_doc <- function(xml_doc = NULL, par_form <- get_param_formalisms(xml_doc = xml_doc, par_name) if (base::is.null(par_form)) { - print(paste("Error: formalism for:", par_name)) + message(paste("Error: formalism for:", par_name)) } # General case, linked to formalisms diff --git a/R/gen_tec_xml.R b/R/gen_tec_xml.R index 965a44e2..54e8d757 100644 --- a/R/gen_tec_xml.R +++ b/R/gen_tec_xml.R @@ -50,19 +50,16 @@ #' @return an invisible xml_document object or a list of #' #' @examples -#' \dontrun{ -#' #' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") #' tec_param_df <- read_params_table(file = xl_path, sheet_name = "Tec") -#' gen_tec_xml(out_dir = "/path/to/dest/dir", param_df = tec_param_df) -#' } +#' gen_tec_xml(out_dir = tempdir(), param_df = tec_param_df) #' #' @export #' gen_tec_xml <- function(param_df = NULL, file = NULL, - out_dir = getwd(), + out_dir, stics_version = "latest", na_values = NA, param_table = lifecycle::deprecated(), @@ -130,10 +127,9 @@ gen_tec_xml <- function(param_df = NULL, out_idx <- unlist(lapply(xml_docs, base::is.null)) if (any(out_idx)) { - cat("\n") - cat(paste0("Errors have been detected while trying to replace", - "parameters values in xml documents\n")) - cat(paste(sum(!out_idx), "files have been generated !\n")) + message(paste0("\nErrors have been detected while trying to replace", + "parameters values in xml documents\n"), + paste(sum(!out_idx), "files have been generated !\n")) # selecting available documents to produce xml_docs <- xml_docs[out_idx] } diff --git a/R/gen_usms_sols_doc.R b/R/gen_usms_sols_doc.R index cd182b59..5fb3c506 100644 --- a/R/gen_usms_sols_doc.R +++ b/R/gen_usms_sols_doc.R @@ -12,14 +12,14 @@ #' \dontrun{ #' # A newly created one, with one or more usms and #' # fake parameters values -#' xml_doc <- SticsRFiles:::gen_xml_doc(doc_type = "usms") -#' xml_doc <- SticsRFiles:::gen_xml_doc(doc_type = "usms", node_nb = 3) +#' xml_doc <- gen_xml_doc(doc_type = "usms") +#' xml_doc <- gen_xml_doc(doc_type = "usms", node_nb = 3) #' #' # With changing parameters values, from an existing document #' # and a data.frame contaning usms parameters values -#' existing_doc <- SticsRFiles:::xmldocument("/path/to/usms.xml") +#' existing_doc <- xmldocument("/path/to/usms.xml") #' -#' out_xml_doc <- SticsRFiles:::gen_xml_doc( +#' out_xml_doc <- gen_xml_doc( #' doc_type = "usms", #' xml_doc = existing_doc, nodes_param = param_data_frame #' ) @@ -27,6 +27,8 @@ #' #' @keywords internal #' +#' @noRd +#' gen_usms_sols_doc <- function(doc_type, xml_doc = NULL, nodes_nb = NULL, diff --git a/R/gen_usms_xml.R b/R/gen_usms_xml.R index b9a26fb3..ef41f856 100644 --- a/R/gen_usms_xml.R +++ b/R/gen_usms_xml.R @@ -1,7 +1,6 @@ #' @title Generate STICS usms xml file from a template or an input file #' -#' @param file Path (including name) of the usms file to generate. Optional, -#' set to `file.path(getwd(), "usms.xml")`by default. +#' @param file Path (including name) of the usms file to generate. #' @param param_df A table (df, tibble) containing the values of the parameters #' to use (see details) #' @param template Path of an USM xml file to be used as a template. @@ -51,17 +50,15 @@ #' @return an invisible xml_document object #' #' @examples -#' \dontrun{ -#' #' xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") #' usms_param_df <- read_params_table(file = xl_path, sheet_name = "USMs") -#' gen_usms_xml(usms_out_file = "usms.xml", usms_param = usms_param_df) -#' } +#' gen_usms_xml(file = file.path(tempdir(), "usms.xml"), +#' param_df = usms_param_df) #' #' @export #' -gen_usms_xml <- function(file = file.path(getwd(), "usms.xml"), +gen_usms_xml <- function(file, param_df = NULL, template = NULL, stics_version = "latest", @@ -101,11 +98,6 @@ gen_usms_xml <- function(file = file.path(getwd(), "usms.xml"), xml_doc <- NULL - # Fix : default output file path if not provided - if (base::is.null(usms_out_file)) { - usms_out_file <- file.path(getwd(), "usms.xml") - } - # If a template file is provided if (!base::is.null(usms_in_file)) { xml_doc <- xmldocument(usms_in_file) diff --git a/R/gen_usms_xml2txt.R b/R/gen_usms_xml2txt.R index d8e7c302..2ef08cab 100644 --- a/R/gen_usms_xml2txt.R +++ b/R/gen_usms_xml2txt.R @@ -56,8 +56,6 @@ #' usm <- c("usm1", "usm2") #' gen_usms_xml2txt(javastics, workspace, usm) #' -#' # For one usm -#' gen_usms_xml2txt(javastics, workspace, dir_per_usm_flag = FALSE, "usm1") #' } #' #' @export diff --git a/R/gen_varmod.R b/R/gen_varmod.R index d52e4e18..d49f04da 100644 --- a/R/gen_varmod.R +++ b/R/gen_varmod.R @@ -25,13 +25,11 @@ #' @return None #' #' @examples -#' \dontrun{ -#' gen_varmod(".", c("lai(n)", "hauteur")) -#' gen_varmod("/path/to/stics/workspace", c("lai(n)", "hauteur")) +#' gen_varmod(tempdir(), c("lai(n)", "hauteur")) #' # Add a variable to the others: -#' gen_varmod(".", "masec(n)", append = TRUE) +#' gen_varmod(tempdir(), "masec(n)", append = TRUE) #' # NB: var.mod will have "lai(n)","hauteur" and "masec(n)" -#' } +#' #' #' @export #' diff --git a/R/get_climate_txt.R b/R/get_climate_txt.R index 3a52949d..896237af 100644 --- a/R/get_climate_txt.R +++ b/R/get_climate_txt.R @@ -23,12 +23,12 @@ #' #' #' @examples -#' library(SticsRFiles) #' path <- get_examples_path(file_type = "txt") #' Meteo <- get_climate_txt(path) +#' #' @export #' -get_climate_txt <- function(workspace = getwd(), +get_climate_txt <- function(workspace, file_name = "climat.txt", preserve = TRUE, dirpath = lifecycle::deprecated(), diff --git a/R/get_file.R b/R/get_file.R index c437226b..6863861e 100644 --- a/R/get_file.R +++ b/R/get_file.R @@ -29,6 +29,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_file <- function(workspace, usm_name = NULL, var_list = NULL, @@ -113,7 +115,9 @@ get_file <- function(workspace, #' #' @keywords internal #' -get_file_ <- function(workspace = getwd(), +#' @noRd +#' +get_file_ <- function(workspace, usm_name = NULL, usms_filepath = NULL, var_list = NULL, @@ -267,6 +271,8 @@ get_file_ <- function(workspace = getwd(), #' @return the obs or simulation output #' @keywords internal #' +#' @noRd +#' get_file_one <- function(dirpath, filename, p_name, verbose, dates_list, var_list) { out <- @@ -380,6 +386,8 @@ get_file_from_usms <- function(workspace, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' parse_mixed_file(list("banana.obs", "IC_banana_sorghuma.obs", diff --git a/R/get_file_int.R b/R/get_file_int.R index 971119b8..6a10bab0 100644 --- a/R/get_file_int.R +++ b/R/get_file_int.R @@ -16,6 +16,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' @importFrom rlang .data #' #' @examples @@ -28,7 +30,7 @@ get_file_int <- function(workspace, plant_name = NULL, verbose = TRUE) { - if (verbose) print(filename) + if (verbose) message(filename) if (is.list(filename)) filename <- unlist(filename) if (is.list(plant_name)) plant_name <- unlist(plant_name) diff --git a/R/get_formalisms_xml.R b/R/get_formalisms_xml.R index f9dd8d12..00571d54 100644 --- a/R/get_formalisms_xml.R +++ b/R/get_formalisms_xml.R @@ -22,6 +22,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' get_formalisms_xml <- function(xml_file, par_name = NULL, diff --git a/R/get_java_workspace.R b/R/get_java_workspace.R index 9c9e65f8..f7413d76 100644 --- a/R/get_java_workspace.R +++ b/R/get_java_workspace.R @@ -12,6 +12,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_java_workspace <- function(javastics) { diff --git a/R/get_lai_forcing.R b/R/get_lai_forcing.R index ba7473cd..c2073762 100644 --- a/R/get_lai_forcing.R +++ b/R/get_lai_forcing.R @@ -12,14 +12,12 @@ #' for each usm #' #' @examples -#' \dontrun{ -#' #' # Xml case #' xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") #' get_lai_forcing(xml_usms) #' get_lai_forcing(xml_usms, "wheat") #' get_lai_forcing(xml_usms, c("wheat", "intercrop_pea_barley")) -#' } +#' #' #' @export #' @@ -64,6 +62,8 @@ get_lai_forcing <- function(usm_file_path, usms_list = c()) { #' #' @keywords internal #' +#' @noRd +#' get_lai_forcing_xml <- function(usm_xml_path, usms_list = c()) { # Loading xml file as xml_document object diff --git a/R/get_name_value_file_value.R b/R/get_name_value_file_value.R index fd6a177b..7bea4e81 100644 --- a/R/get_name_value_file_value.R +++ b/R/get_name_value_file_value.R @@ -12,6 +12,8 @@ # @examples #' @keywords internal #' +#' @noRd +#' get_name_value_file_value <- function(file_path, param_names, names_dict = NULL) { diff --git a/R/get_obs.R b/R/get_obs.R index 75159a7c..7ff76c26 100644 --- a/R/get_obs.R +++ b/R/get_obs.R @@ -58,15 +58,16 @@ #' #' #' @examples -#' \dontrun{ +#' #' path <- file.path(get_examples_path(file_type = "obs"), "mixed") #' #' # Get observations for all usms, but only banana has observations: #' Meas <- get_obs(path) +#' #' # Get observations only for banana: #' Meas_banana <- get_obs(path, "banana") #' -#' +#' \dontrun{ #' # Get observations with real plant names when plant #' # folder is not in the workspace: #' get_obs(path, "banana", javastics = "/path/to/JavaSTICS/folder") diff --git a/R/get_obs_txt.R b/R/get_obs_txt.R index 00b88f4a..048e16f5 100644 --- a/R/get_obs_txt.R +++ b/R/get_obs_txt.R @@ -29,12 +29,16 @@ #' @examples #' \dontrun{ #' -#' obs_table <- SticsRFiles:::get_obs_txt() +#' obs_table <- get_obs_txt() #' } #' #' @keywords internal #' -get_obs_txt <- function(dirpath = getwd(), filename = NULL, mixed = NULL) { +#' @noRd +#' +get_obs_txt <- function(dirpath, + filename = NULL, + mixed = NULL) { . <- NULL # to avoid CRAN note for pipe if (is.null(mixed)) { if (file.exists(file.path(dirpath, "new_travail.usm"))) { diff --git a/R/get_option_choice_param_values.R b/R/get_option_choice_param_values.R index 637000b0..4fe31a6a 100644 --- a/R/get_option_choice_param_values.R +++ b/R/get_option_choice_param_values.R @@ -22,6 +22,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_option_choice_param_values <- function(xml_file_path, option_param_name, choice_name_or_code) { diff --git a/R/get_options_choices.R b/R/get_options_choices.R index f9c152fb..41315270 100644 --- a/R/get_options_choices.R +++ b/R/get_options_choices.R @@ -13,15 +13,17 @@ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") #' #' # For getting all options choices -#' SticsRFiles:::get_options_choices(xml_path) +#' get_options_choices(xml_path) #' #' # For getting one option choices or more -#' SticsRFiles:::get_options_choices(xml_path, "codetemp") -#' SticsRFiles:::get_options_choices(xml_path, c("codegdh", "codetemp")) +#' get_options_choices(xml_path, "codetemp") +#' get_options_choices(xml_path, c("codegdh", "codetemp")) #' } #' #' @keywords internal #' +#' @noRd +#' get_options_choices <- function(xml_file_path, options_names = NULL) { diff --git a/R/get_options_names.R b/R/get_options_names.R index 7ab557e1..726a65da 100644 --- a/R/get_options_names.R +++ b/R/get_options_names.R @@ -13,13 +13,15 @@ #' #' xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") #' -#' SticsRFiles:::get_options_names(xml_path) +#' get_options_names(xml_path) #' -#' SticsRFiles:::get_options_names(xml_path, c("codemonocot", "codlainet")) +#' get_options_names(xml_path, c("codemonocot", "codlainet")) #' } #' #' @keywords internal #' +#' @noRd +#' get_options_names <- function(xml_file_path, option_names = NULL) { # Loading xml file diff --git a/R/get_param_bounds.R b/R/get_param_bounds.R index eb45c746..937ab80e 100644 --- a/R/get_param_bounds.R +++ b/R/get_param_bounds.R @@ -17,19 +17,20 @@ #' \dontrun{ #' xml_sta <- file.path(get_examples_path(file_type = "xml"), "file_sta.xml") #' -#' sta_doc <- SticsRFiles:::xmldocument(xml_sta) +#' sta_doc <- xmldocument(xml_sta) #' -#' par_bounds <- SticsRFiles:::get_param_bounds(sta_doc, "zr") +#' par_bounds <- get_param_bounds(sta_doc, "zr") #' -#' par_bounds_list <- SticsRFiles:::get_param_bounds(sta_doc, +#' par_bounds_list <- get_param_bounds(sta_doc, #' c("zr", "altistation")) #' #' -#' SticsRFiles:::get_param_bounds(sta_doc, c("zr", "altistation"), "min") +#' get_param_bounds(sta_doc, c("zr", "altistation"), "min") #' } #' #' @keywords internal #' +#' @noRd #' get_param_bounds <- function(xml_doc, param_name, @@ -139,6 +140,7 @@ fix_bounds <- function(values, bounds_name, param_name) { #' @return A named vector for bound(s) #' #' @keywords internal +#' @noRd #' #' #' diff --git a/R/get_param_bounds_xml.R b/R/get_param_bounds_xml.R index c689a075..d23af4f9 100644 --- a/R/get_param_bounds_xml.R +++ b/R/get_param_bounds_xml.R @@ -27,6 +27,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_param_bounds_xml <- function(xml_file, param_name, bounds_name = NULL, diff --git a/R/get_param_desc.R b/R/get_param_desc.R index 7904cd27..7c53b8d4 100644 --- a/R/get_param_desc.R +++ b/R/get_param_desc.R @@ -11,6 +11,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_param_desc <- function(file_path = NULL, stics_version = "latest", name = NULL, diff --git a/R/get_param_formalisms.R b/R/get_param_formalisms.R index a4333209..3d05130d 100644 --- a/R/get_param_formalisms.R +++ b/R/get_param_formalisms.R @@ -13,16 +13,18 @@ #' #' xml_sta <- file.path(get_examples_path(file_type = "xml"), "file_sta.xml") #' -#' sta_doc <- SticsRFiles:::xmldocument(xml_sta) +#' sta_doc <- xmldocument(xml_sta) #' -#' par_form <- SticsRFiles:::get_param_formalisms(sta_doc, "zr") +#' par_form <- get_param_formalisms(sta_doc, "zr") #' -#' par_form_list <- SticsRFiles:::get_param_formalisms(sta_doc, +#' par_form_list <- get_param_formalisms(sta_doc, #' c("zr", "altistation")) #' } #' #' @keywords internal #' +#' @noRd +#' #' get_param_formalisms <- function(xml_doc, name = NULL, form_only = FALSE) { diff --git a/R/get_param_info.R b/R/get_param_info.R index 66319c30..0fa70d7c 100644 --- a/R/get_param_info.R +++ b/R/get_param_info.R @@ -35,9 +35,9 @@ #' @export #' #' @examples -#' -#' get_param_info(param = "albedo") #' \dontrun{ +#' get_param_info(param = "albedo") + #' get_param_info(param = "albedo", file = "/path/to/file.xml") #' #' get_param_info(param = "albedo", formalism = "special") @@ -181,6 +181,8 @@ get_param_info <- function(param = NULL, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' diff --git a/R/get_param_names.R b/R/get_param_names.R index fe4f925d..65d0f4bc 100644 --- a/R/get_param_names.R +++ b/R/get_param_names.R @@ -13,12 +13,14 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' SticsRFiles:::get_param_names(sols_doc) +#' sols_doc <- xmldocument(xml_path) +#' get_param_names(sols_doc) #' } #' #' @keywords internal #' +#' @noRd +#' get_param_names <- function(xml_object, param_list = c(), parent_name = NULL, diff --git a/R/get_param_names_xml.R b/R/get_param_names_xml.R index 2457fd3f..24d22d1b 100644 --- a/R/get_param_names_xml.R +++ b/R/get_param_names_xml.R @@ -37,7 +37,7 @@ #' #' @keywords internal #' -#' +#' @noRd #' get_param_names_xml <- function(xml_file, name = NULL, diff --git a/R/get_param_number.R b/R/get_param_number.R index b3020c3b..a51ede0c 100644 --- a/R/get_param_number.R +++ b/R/get_param_number.R @@ -13,15 +13,17 @@ #' \dontrun{ #' xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") #' -#' usms_doc <- SticsRFiles:::xmldocument(xml_usms) +#' usms_doc <- xmldocument(xml_usms) #' -#' par_nb <- SticsRFiles:::get_param_number(usms_doc, "usm") +#' par_nb <- get_param_number(usms_doc, "usm") #' -#' par_nb_vec <- SticsRFiles:::get_param_number(usms_doc, c("usm", "fplt")) +#' par_nb_vec <- get_param_number(usms_doc, c("usm", "fplt")) #' } #' #' @keywords internal #' +#' @noRd +#' # TODO: may use get_param_types returning values nb in $length field get_param_number <- function(xml_doc_object, param_name, ...) { values <- get_param_value(xml_doc_object, param_name, ...) diff --git a/R/get_param_txt.R b/R/get_param_txt.R index 353da777..9e58ecb3 100644 --- a/R/get_param_txt.R +++ b/R/get_param_txt.R @@ -40,14 +40,12 @@ #' #' #' @examples -#' # Read the interrow distance parameter: -#' \dontrun{ -#' library(SticsRFiles) #' path <- get_examples_path(file_type = "txt") -#' get_param_txt(path, param = "interrang") #' -#' # Getting varietal values: +#' # Getting the interrow distance parameter value +#' get_param_txt(path, param = "interrang") #' +#' # Getting varietal parameters values #' # Get the leaf lifespan of the variety used in the usm: #' get_param_txt(workspace = path, param = "durvieF") #' # Get the leaf lifespan of another variety available in the plant file: @@ -57,10 +55,10 @@ #' get_param_txt(workspace = path, param = "durvieF", variety = varieties) #' # Or get it from the output of the function returning all parameters: #' get_param_txt(workspace = path)$plant$plant1$durvieF -#' } +#' #' #' @export -get_param_txt <- function(workspace = getwd(), +get_param_txt <- function(workspace, param = NULL, variety = NULL, exact = FALSE, @@ -959,6 +957,8 @@ get_usm_txt <- function(file = "new_travail.usm", #' @return A named (if names=TRUE) list of parameter values #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' path <- file.path(get_examples_path(file_type = "txt", @@ -1001,6 +1001,8 @@ get_txt_generic <- function(file, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' test <- list(a = "2", b = "toto") diff --git a/R/get_param_type.R b/R/get_param_type.R index 10169634..bfa80bcf 100644 --- a/R/get_param_type.R +++ b/R/get_param_type.R @@ -11,13 +11,15 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' SticsRFiles:::get_param_type(sols_doc, "argi") -#' SticsRFiles:::get_param_type(sols_doc, c("argi", "norg")) +#' sols_doc <- xmldocument(xml_path) +#' get_param_type(sols_doc, "argi") +#' get_param_type(sols_doc, c("argi", "norg")) #' } #' #' @keywords internal #' +#' @noRd +#' # TODO : may be merged with get_params_types ! get_param_type <- function(xml_doc, param_name, diff --git a/R/get_param_value.R b/R/get_param_value.R index 3f6b7c15..57991cea 100644 --- a/R/get_param_value.R +++ b/R/get_param_value.R @@ -16,25 +16,27 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' SticsRFiles:::get_param_value(sols_doc, "argi") -#' SticsRFiles:::get_param_value(sols_doc, c("argi", "norg")) +#' sols_doc <- xmldocument(xml_path) +#' get_param_value(sols_doc, "argi") +#' get_param_value(sols_doc, c("argi", "norg")) #' -#' SticsRFiles:::get_param_value(sols_doc, "argi", +#' get_param_value(sols_doc, "argi", #' parent_name = "sol", parent_sel_attr = "solcanne" #' ) #' -#' SticsRFiles:::get_param_value(sols_doc, c("argi", "norg"), +#' get_param_value(sols_doc, c("argi", "norg"), #' parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") #' ) #' -#' SticsRFiles:::get_param_value(list(sols_doc, sols_doc), c("argi", "norg"), +#' get_param_value(list(sols_doc, sols_doc), c("argi", "norg"), #' parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") #' ) #' } #' #' @keywords internal #' +#' @noRd +#' get_param_value <- function(xml_doc, param_name = NULL, @@ -124,7 +126,7 @@ get_param_value <- function(xml_doc, value <- NULL if (show_xpath) { - print(xpath) + message(xpath) } if (base::is.null(xpath)) { diff --git a/R/get_param_xml.R b/R/get_param_xml.R index 1050faa3..48bc2f51 100644 --- a/R/get_param_xml.R +++ b/R/get_param_xml.R @@ -22,7 +22,7 @@ #' @return A list of parameter values for each xml_file (a list of list) #' #' @examples -#' \dontrun{ +#' #' # Soil file #' file <- file.path(get_examples_path(file_type = "xml"), "sols.xml") #' @@ -55,7 +55,7 @@ #' #' # Getting all parameters for a given formalism: "irrigation" #' get_param_xml(file, select = "formalisme", select_value = "irrigation") -#' } +#' #' @export get_param_xml <- function(file, param = NULL, diff --git a/R/get_params_dict.R b/R/get_params_dict.R index f1b1a1f9..0dba47d2 100644 --- a/R/get_params_dict.R +++ b/R/get_params_dict.R @@ -2,13 +2,13 @@ #' given as argument #' #' @param in_dict a named list with parameters names as values -# @param javastics_dir a JavaSTICS path #' #' @return A named list with XML parameters names #' -#' @export -#' #' @keywords internal +#' +#' @noRd +#' #' @examples #' \dontrun{ #' # Getting internal dictionary default content diff --git a/R/get_params_from_doc.R b/R/get_params_from_doc.R index 17bfdba3..b9ac6294 100644 --- a/R/get_params_from_doc.R +++ b/R/get_params_from_doc.R @@ -8,6 +8,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_params_from_doc <- function(xml_doc_object, type_name = NULL, unique_val = TRUE) { diff --git a/R/get_params_from_doc_attr.R b/R/get_params_from_doc_attr.R index 19b5d48d..70525afe 100644 --- a/R/get_params_from_doc_attr.R +++ b/R/get_params_from_doc_attr.R @@ -8,6 +8,7 @@ #' @return a named list of parameter names #' #' @keywords internal +#' @noRd #' get_params_from_doc_attr <- function(xml_doc, type_name = NULL, diff --git a/R/get_params_from_doc_node.R b/R/get_params_from_doc_node.R index 8765efda..ba123dcf 100644 --- a/R/get_params_from_doc_node.R +++ b/R/get_params_from_doc_node.R @@ -9,6 +9,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_params_from_doc_node <- function(xml_node, param_list = c(), unique_val = TRUE) { diff --git a/R/get_params_from_table.R b/R/get_params_from_table.R index 6bc2b4dd..cae294f4 100644 --- a/R/get_params_from_table.R +++ b/R/get_params_from_table.R @@ -23,12 +23,14 @@ #' xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") #' ini_param_df <- read_excel(xl_path, sheet = "Ini") #' xml_path <- "path/to/ini/xml" -#' ini_doc <- SticsRFiles:::xmldocument(xml_path) +#' ini_doc <- xmldocument(xml_path) #' get_params_from_table(ini_param_df, ini_doc) #' } #' #' @keywords internal #' +#' @noRd +#' get_params_from_table <- function(params_table, param_names = NULL, xml_doc, @@ -86,7 +88,7 @@ get_params_from_table <- function(params_table, if (stopping) { stop(message_str) } else { - cat(message_str) + message(message_str) } # removing unknown param columns diff --git a/R/get_plant_name.R b/R/get_plant_name.R index e52890d6..2a80b3f1 100644 --- a/R/get_plant_name.R +++ b/R/get_plant_name.R @@ -18,6 +18,8 @@ #' and two values for intercrop (principal, associated). #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' path <- get_examples_path(file_type = "xml") diff --git a/R/get_plants_nb.R b/R/get_plants_nb.R index 2dcaa95a..269ae392 100644 --- a/R/get_plants_nb.R +++ b/R/get_plants_nb.R @@ -16,8 +16,6 @@ #' @return A named numeric vector of plants number per usm #' #' @examples -#' \dontrun{ -#' #' # Xml case #' xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") #' get_plants_nb(xml_usms) @@ -27,7 +25,6 @@ #' # Txt case #' txt_usm <- file.path(get_examples_path(file_type = "txt"), "new_travail.usm") #' get_plants_nb(txt_usm) -#' } #' #' @export #' @@ -86,6 +83,7 @@ get_plants_nb <- function(usms_file, #' } #' #' @keywords internal +#' @noRd #' get_plants_nb_xml <- function(usms_file, usms_list = c(), diff --git a/R/get_report_results.R b/R/get_report_results.R index 00837b95..07f05abe 100644 --- a/R/get_report_results.R +++ b/R/get_report_results.R @@ -21,7 +21,6 @@ #' @export #' #' @examples -#' \dontrun{ #' path <- get_examples_path(file_type = "sti") #' get_report_results(workspace = path) #' @@ -34,7 +33,7 @@ #' get_report_results(workspace = path) #' #' get_report_results(workspace = path, file_name = "mod_rapportA.sti") -#' } +#' #' get_report_results <- function(workspace, file_name = "mod_rapport.sti", diff --git a/R/get_sim.R b/R/get_sim.R index f66f2647..2a30a2e9 100644 --- a/R/get_sim.R +++ b/R/get_sim.R @@ -15,6 +15,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_daily_results <- function(...) { @@ -83,10 +85,8 @@ get_daily_results <- function(...) { #' See Details section for more information about the "Plant" column. #' #' @examples -#' \dontrun{ #' path <- get_examples_path(file_type = "sti") -#' get_sim(path, "banana") -#' } +#' sim_data <- get_sim(path, "banana") #' #' @export #' diff --git a/R/get_stics_versions_compat.R b/R/get_stics_versions_compat.R index fa70bfd4..8f0f512f 100644 --- a/R/get_stics_versions_compat.R +++ b/R/get_stics_versions_compat.R @@ -11,9 +11,6 @@ #' an existing version selected using version_index. #' #' @examples -#' # -#' \dontrun{ -#' #' # Getting the complete versions list #' get_stics_versions_compat() #' @@ -23,8 +20,6 @@ #' # Getting the previous version of the latest one #' get_stics_versions_compat(-1) #' -#' # -#' } #' #' @export #' @@ -79,10 +74,12 @@ get_stics_versions_compat <- function(version_index = NULL) { #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' -#' SticsRFiles:::check_version_compat() +#' check_version_compat() #' } check_version_compat <- function(stics_version = "latest") { versions <- get_stics_versions_compat() @@ -110,10 +107,12 @@ check_version_compat <- function(stics_version = "latest") { #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' -#' SticsRFiles:::get_versions_info() +#' get_versions_info() #' #' get_versions_info(stics_version = "V8.5") #' @@ -163,9 +162,11 @@ get_versions_info <- function(stics_version = NULL, location = "install") { #' @return version number (numeric or character) #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_version_num() +#' get_version_num() #' } get_version_num <- function(stics_version = "latest", numeric = TRUE) { if (is.numeric(stics_version) && numeric) { @@ -192,9 +193,11 @@ get_version_num <- function(stics_version = "latest", numeric = TRUE) { #' @return version string #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_version_string() +#' get_version_string() #' } get_version_string <- function(stics_version) { pattern <- "^[V | v]" @@ -213,9 +216,11 @@ get_version_string <- function(stics_version) { #' @return file name #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_versions_file_name() +#' get_versions_file_name() #' } get_versions_file_name <- function() { return("stics_versions_info.csv") diff --git a/R/get_values_by_param.R b/R/get_values_by_param.R index 1d05d328..61526fd9 100644 --- a/R/get_values_by_param.R +++ b/R/get_values_by_param.R @@ -17,11 +17,13 @@ #' dest_dir = "/path/to/dest/dir") #' xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") #' tec_param_df <- read_excel(xl_path, sheet = "Tec") -#' SticsRFiles:::get_values_by_param(params_table = tec_param_df) +#' get_values_by_param(params_table = tec_param_df) #' } #' #' @keywords internal #' +#' @noRd +#' get_values_by_param <- function(params_table, param_name = NULL, lines_id = NULL, diff --git a/R/get_xml_base_doc.R b/R/get_xml_base_doc.R index e46d2ebe..f30b1a78 100644 --- a/R/get_xml_base_doc.R +++ b/R/get_xml_base_doc.R @@ -9,21 +9,23 @@ #' @examples #' \dontrun{ #' # Getting xml STICS files types list (i.e. keywords) -#' SticsRFiles:::get_xml_base_doc() +#' get_xml_base_doc() #' #' # Getting a soil document with one soil definition -#' SticsRFiles:::get_xml_base_doc("sols") +#' get_xml_base_doc("sols") #' #' # STICS version can be provided, V9.1 #' # corresponds to stics_version = "latest" #' # View available STICS files version -#' SticsRFiles:::get_xml_stics_version() +#' get_xml_stics_version() #' # Giving STICS version -#' SticsRFiles:::get_xml_base_doc("sols", stics_version = "V9.1") +#' get_xml_base_doc("sols", stics_version = "V9.1") #' } #' #' @keywords internal #' +#' @noRd +#' get_xml_base_doc <- function(xml_type = NULL, stics_version = "latest") { diff --git a/R/get_xml_base_node.R b/R/get_xml_base_node.R index fd153810..76e510f0 100644 --- a/R/get_xml_base_node.R +++ b/R/get_xml_base_node.R @@ -9,18 +9,20 @@ #' #' @examples #' \dontrun{ -#' SticsRFiles:::get_xml_base_node("usms") +#' get_xml_base_node("usms") #' -#' SticsRFiles:::get_xml_base_node("sols") +#' get_xml_base_node("sols") #' #' # Formalism labels can be retrieved using -#' SticsRFiles:::get_xml_base_node()$form_names$tec +#' get_xml_base_node()$form_names$tec #' -#' SticsRFiles:::get_xml_base_node("tec", "irrigation") +#' get_xml_base_node("tec", "irrigation") #' } #' #' @keywords internal #' +#' @noRd +#' # TODO: under construction !!!!!!!!!!!!!!!!! get_xml_base_node <- function(file_tag, form_name = NULL, stics_version = "latest") { diff --git a/R/get_xml_doc_example.R b/R/get_xml_doc_example.R index e224a38f..57bd6669 100644 --- a/R/get_xml_doc_example.R +++ b/R/get_xml_doc_example.R @@ -9,14 +9,16 @@ #' @examples #' \dontrun{ #' # Retrieving xml examples files to get xml_document from -#' SticsRFiles:::get_xml_doc_example() +#' get_xml_doc_example() #' #' # Loading an usms.xml file -#' usm_doc <- SticsRFiles:::get_xml_doc_example("usms.xml") +#' usm_doc <- get_xml_doc_example("usms.xml") #' } #' #' @keywords internal #' +#' @noRd +#' get_xml_doc_example <- function(xml_name = NULL, stics_version = "latest") { diff --git a/R/get_xml_files_param_df.R b/R/get_xml_files_param_df.R index c6179c77..83f14394 100644 --- a/R/get_xml_files_param_df.R +++ b/R/get_xml_files_param_df.R @@ -54,6 +54,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' dir_path <- get_examples_path("xml") diff --git a/R/get_xml_stics_version.R b/R/get_xml_stics_version.R index c4f14936..fdf0f27f 100644 --- a/R/get_xml_stics_version.R +++ b/R/get_xml_stics_version.R @@ -10,17 +10,19 @@ #' @examples #' \dontrun{ #' # View available STICS files version -#' SticsRFiles:::get_xml_stics_version() +#' get_xml_stics_version() #' #' # View the latest version -#' SticsRFiles:::get_xml_stics_version("latest") +#' get_xml_stics_version("latest") #' #' # Checking if a version exists -#' SticsRFiles:::get_xml_stics_version("V9.2") +#' get_xml_stics_version("V9.2") #' } #' #' @keywords internal #' +#' @noRd +#' get_xml_stics_version <- function(stics_version = "latest", xml_doc = NULL) { # TODO: A renommer pour clarifier version des fichiers diff --git a/R/init_javastics_pref.R b/R/init_javastics_pref.R index aa8c1bcd..fdedd069 100644 --- a/R/init_javastics_pref.R +++ b/R/init_javastics_pref.R @@ -13,7 +13,9 @@ #' } #' #' @keywords internal -# @export +#' +#' @noRd +#' init_javastics_pref <- function(javastics, overwrite = FALSE) { check_java_path(javastics) diff --git a/R/is_os_name.R b/R/is_os_name.R index f8b0ca78..48a94cc0 100644 --- a/R/is_os_name.R +++ b/R/is_os_name.R @@ -15,6 +15,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' #' is_os_name <- function(os_tag_name = character()) { diff --git a/R/is_stics_doc.R b/R/is_stics_doc.R index 883dde61..c0df6434 100644 --- a/R/is_stics_doc.R +++ b/R/is_stics_doc.R @@ -1,6 +1,4 @@ -#' Is it a STICS xml document -#' -#' @description Test if an XML document is a STICS document. +#' Evaluate if an object is an xml_document object #' #' @param xml_doc An xml document #' @param doc_type The type of xml document @@ -13,12 +11,14 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' SticsRFiles:::is_stics_doc(sols_doc) +#' sols_doc <- xmldocument(xml_path) +#' is_stics_doc(sols_doc) #' } #' #' @keywords internal #' +#' @noRd +#' is_stics_doc <- function(xml_doc, doc_type = NULL, doc_types = NULL) { # TODO : doc_types have been added as input arg, but not used yet, @@ -71,42 +71,42 @@ is_stics_doc <- function(xml_doc, doc_type = NULL, doc_types = NULL) { -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_ini <- function(xml_doc) { return(is_stics_doc(xml_doc, "initialisations")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_usms <- function(xml_doc) { return(is_stics_doc(xml_doc, "usms")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_sols <- function(xml_doc) { return(is_stics_doc(xml_doc, "sols")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_tec <- function(xml_doc) { return(is_stics_doc(xml_doc, "fichiertec")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_sta <- function(xml_doc) { return(is_stics_doc(xml_doc, "fichiersta")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_plt <- function(xml_doc) { return(is_stics_doc(xml_doc, "fichierplt")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_par <- function(xml_doc) { return(is_stics_doc(xml_doc, "fichierpar")) } -#' @rdname is_stics_doc +# @rdname is_stics_doc is_stics_newpar <- function(xml_doc) { return(is_stics_doc(xml_doc, "fichierparamgen")) } diff --git a/R/is_stics_xml.R b/R/is_stics_xml.R index fb8229fa..a5ca955e 100644 --- a/R/is_stics_xml.R +++ b/R/is_stics_xml.R @@ -1,6 +1,5 @@ -#' Is it a STICS xml file -#' -#' @description Test if an XML file is a STICS one. +#' Evaluate if the content of an XML file +#' corresponds to a STICS file #' #' @param xml_path An xml file path #' @param file_type The type of the xml file @@ -12,11 +11,13 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' SticsRFiles:::is_stics_xml(xml_path) +#' is_stics_xml(xml_path) #' } #' #' @keywords internal #' +#' @noRd +#' is_stics_xml <- function(xml_path, file_type = NULL) { if (dir.exists(xml_path) || !file.exists(xml_path)) { return(FALSE) @@ -27,42 +28,42 @@ is_stics_xml <- function(xml_path, file_type = NULL) { return(is_stics_doc(xml_doc, doc_type = file_type)) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_ini_xml <- function(xml_path) { return(is_stics_xml(xml_path, "initialisations")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_usms_xml <- function(xml_path) { return(is_stics_xml(xml_path, "usms")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_sols_xml <- function(xml_path) { return(is_stics_xml(xml_path, "sols")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_tec_xml <- function(xml_path) { return(is_stics_xml(xml_path, "fichiertec")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_sta_xml <- function(xml_path) { return(is_stics_xml(xml_path, "fichiersta")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_plt_xml <- function(xml_path) { return(is_stics_xml(xml_path, "fichierplt")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_par_xml <- function(xml_path) { return(is_stics_xml(xml_path, "fichierpar")) } -#' @rdname is_stics_xml +# @rdname is_stics_xml is_newpar_xml <- function(xml_path) { return(is_stics_xml(xml_path, "fichierparamgen")) } diff --git a/R/javastics_cmd_util.R b/R/javastics_cmd_util.R index 2441ff02..4eff55c3 100644 --- a/R/javastics_cmd_util.R +++ b/R/javastics_cmd_util.R @@ -30,6 +30,8 @@ #' #' @keywords internal #' +#' @noRd +#' get_javastics_cmd <- function(javastics, java_cmd = "java", type = c("generate", "run"), @@ -102,6 +104,8 @@ get_javastics_cmd <- function(javastics, #' #' @keywords internal #' +#' @noRd +#' check_javastics_cmd <- function(javastics_cmd = "JavaSticsCmd.exe", java_cmd = "java", verbose = TRUE) { @@ -173,6 +177,8 @@ check_javastics_cmd <- function(javastics_cmd = "JavaSticsCmd.exe", #' #' @keywords internal #' +#' @noRd +#' get_java_version <- function(java_cmd = "java") { # java_cmd must contain a java executable path, if not known in the system diff --git a/R/javastics_path.R b/R/javastics_path.R index f03cfc4a..210bb2fd 100644 --- a/R/javastics_path.R +++ b/R/javastics_path.R @@ -5,6 +5,8 @@ #' #' @keywords internal #' +#' @noRd +#' # @examples get_javastics_path <- function() { @@ -22,6 +24,8 @@ get_javastics_path <- function() { # @return #' @keywords internal #' +#' @noRd +#' # @examples set_javastics_path <- function(javastics_path, write = FALSE) { @@ -44,6 +48,8 @@ set_javastics_path <- function(javastics_path, write = FALSE) { #' #' @keywords internal #' +#' @noRd +#' # @examples exists_javastics_path <- function() { @@ -68,6 +74,8 @@ exists_javastics_path <- function() { # @return #' @keywords internal #' +#' @noRd +#' # @examples write_javastics_path <- function(javastics_path) { diff --git a/R/manage_stics_versions.R b/R/manage_stics_versions.R index 7841600b..cf0043b6 100644 --- a/R/manage_stics_versions.R +++ b/R/manage_stics_versions.R @@ -5,8 +5,13 @@ #' #' @examples #' \dontrun{ -#' SticsRFiles:::get_svn_identifiers() +#' get_svn_identifiers() #' } +#' +#' @keywords internal +#' +#' @noRd +#' get_svn_identifiers <- function() { # logged user identifiers ! @@ -32,9 +37,11 @@ get_svn_identifiers <- function() { # @return #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::download_csv_files( +#' download_csv_files( #' branch_url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", #' dest_dir = system.file("extdata", package = "SticsRFiles") #' ) @@ -119,14 +126,16 @@ download_csv_files <- function(branch_url, #' @return An invisible data.frame containing versions data #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::add_stics_version( +#' add_stics_version( #' version_name = "V10.0", #' url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10" #' ) #' -#' SticsRFiles:::add_stics_version( +#' add_stics_version( #' version_name = "V10.0", #' url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", #' location = "package" @@ -182,7 +191,7 @@ add_stics_version <- function(version_name, ) if (verbose) - cat(paste0(version_name, + message(paste0(version_name, " successfully set in SticsRFiles ", location, ".\n")) @@ -208,11 +217,13 @@ add_stics_version <- function(version_name, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::remove_stics_version(version_name = "V10.0") +#' remove_stics_version(version_name = "V10.0") #' -#' SticsRFiles:::remove_stics_version( +#' remove_stics_version( #' version_name = "V10.0", #' location = "package" #' ) @@ -271,11 +282,13 @@ remove_stics_version <- function(version_name, #' @return A directory path #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_data_dir() +#' get_data_dir() #' -#' SticsRFiles:::get_data_dir(location = "package") +#' get_data_dir(location = "package") #' } get_data_dir <- function(location = "install") { if (location == "install") @@ -306,11 +319,13 @@ get_data_dir <- function(location = "install") { #' @return A file path #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_versions_file_path() +#' get_versions_file_path() #' -#' SticsRFiles:::get_versions_file_path(location = "package") +#' get_versions_file_path(location = "package") #' } get_versions_file_path <- function(location = "install") { file.path(get_data_dir(location = location), @@ -335,14 +350,16 @@ get_versions_file_path <- function(location = "install") { #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::update_stics_version( +#' update_stics_version( #' version_name = "V10.0", #' url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10" #' ) #' -#' SticsRFiles:::update_stics_version( +#' update_stics_version( #' version_name = "V10.0", #' url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", #' location = "package" @@ -381,6 +398,8 @@ update_stics_version <- function(version_name, # @return #' @keywords internal #' +#' @noRd +#' # @examples set_versions_info <- function(version_name, location = "install", @@ -464,9 +483,11 @@ set_versions_info <- function(version_name, #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ -#' SticsRFiles:::get_versions_info(version_name = "V10.0") +#' get_versions_info(version_name = "V10.0") #' } get_version_info_tmpl <- function(version_name) { data.frame( diff --git a/R/merge_nodesets.R b/R/merge_nodesets.R index 9b914544..73a8dcc9 100644 --- a/R/merge_nodesets.R +++ b/R/merge_nodesets.R @@ -8,6 +8,8 @@ #' #' @keywords internal #' +#' @noRd +#' # @examples merge_nodesets <- function(ns1, ns2) { new_ns <- ns1 diff --git a/R/remove_node_from_doc.R b/R/remove_node_from_doc.R index a17d31dd..0863667a 100644 --- a/R/remove_node_from_doc.R +++ b/R/remove_node_from_doc.R @@ -14,19 +14,19 @@ #' \dontrun{ #' #' xml_path <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -#' tec_doc <- SticsRFiles:::xmldocument(xml_path) +#' tec_doc <- xmldocument(xml_path) #' #' # removing a single parameter -#' SticsRFiles:::remove_node_from_doc(tec_doc, param_name = "jultrav") +#' remove_node_from_doc(tec_doc, param_name = "jultrav") #' #' # removing all the parent nodes the parameter belongs to -#' SticsRFiles:::remove_node_from_doc(tec_doc, +#' remove_node_from_doc(tec_doc, #' param_name = "julapI_or_sum_upvt", #' remove_parent = TRUE #' ) #' #' # removing some of the parent nodes the parameter belongs to -#' SticsRFiles:::remove_node_from_doc(tec_doc, +#' remove_node_from_doc(tec_doc, #' param_name = "julapI_or_sum_upvt", #' remove_parent = TRUE, nodes_ids = c(1, 3) #' ) @@ -34,6 +34,8 @@ #' #' @keywords internal #' +#' @noRd +#' remove_node_from_doc <- function(xml_doc, param_name, parent_name = NULL, remove_parent = FALSE, @@ -48,7 +50,7 @@ remove_node_from_doc <- function(xml_doc, param_name, # if the type does not exist if (base::is.null(xpath_node)) { - print(paste("Unknown parameter in xml doc: ", param_name)) + message(paste("Unknown parameter in xml doc: ", param_name)) return(invisible()) } @@ -63,7 +65,7 @@ remove_node_from_doc <- function(xml_doc, param_name, } if (base::is.null(xml_nodes)) { - print("No nodes to remove from xml doc !") + message("No nodes to remove from xml doc !") return(invisible()) } diff --git a/R/remove_parent_from_doc.R b/R/remove_parent_from_doc.R index a725c41e..1e4c2798 100644 --- a/R/remove_parent_from_doc.R +++ b/R/remove_parent_from_doc.R @@ -11,14 +11,14 @@ #' \dontrun{ #' #' xml_path <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -#' tec_doc <- SticsRFiles:::xmldocument(xml_path) +#' tec_doc <- xmldocument(xml_path) #' #' # removing all the parent nodes the parameter belongs to -#' SticsRFiles:::remove_parent_from_doc(tec_doc, +#' remove_parent_from_doc(tec_doc, #' param_name = "julapI_or_sum_upvt") #' #' # removing some of the parent nodes the parameter belongs to -#' SticsRFiles:::remove_parent_from_doc(tec_doc, +#' remove_parent_from_doc(tec_doc, #' param_name = "julapI_or_sum_upvt", #' nodes_ids = c(1, 3) #' ) @@ -26,6 +26,8 @@ #' #' @keywords internal #' +#' @noRd +#' remove_parent_from_doc <- function(xml_doc, param_name, nodes_ids = NULL) { diff --git a/R/replace_string_in_file.R b/R/replace_string_in_file.R index efbe471d..a020d323 100644 --- a/R/replace_string_in_file.R +++ b/R/replace_string_in_file.R @@ -11,6 +11,8 @@ #' #' @keywords internal #' +#' @noRd +#' replace_string_in_file <- function(file_path, target_string, replace_string, diff --git a/R/replace_txt_param_value.R b/R/replace_txt_param_value.R index 7b75d403..49a81611 100644 --- a/R/replace_txt_param_value.R +++ b/R/replace_txt_param_value.R @@ -11,6 +11,8 @@ #' #' @keywords internal #' +#' @noRd +#' replace_txt_param_value <- function(file_path, param_tag, param_value, @@ -72,8 +74,8 @@ replace_txt_param_value <- function(file_path, diff_files <- as.numeric(diff_files) not_replaced_files <- diff_files == 0 if (any(not_replaced_files)) { - print("No replacement for file(s):") - print(out_file_path[not_replaced_files]) + message("No replacement for file(s):") + message(out_file_path[not_replaced_files]) } # removing the temporary file if (in_place) { diff --git a/R/set_codeoptim.R b/R/set_codeoptim.R index 18351c5c..71549915 100644 --- a/R/set_codeoptim.R +++ b/R/set_codeoptim.R @@ -5,14 +5,17 @@ #' parameters values forcing) #' @param file_name Name of the file #' -#' @keywords internal #' @examples #' \dontrun{ #' #' ws <- "path/to/stics/workspace" -#' SticsRFiles:::set_codoptim(workspace = ws, value = 0) +#' set_codoptim(workspace = ws, value = 0) #' } #' +#' @keywords internal +#' +#' @noRd +#' set_codeoptim <- function(workspace, value = 1, file_name = "new_travail.usm") { if (!dir.exists(workspace)) { stop(paste(workspace, "directory does not exist !")) diff --git a/R/set_file_executable.R b/R/set_file_executable.R index 10c1381a..023cf484 100644 --- a/R/set_file_executable.R +++ b/R/set_file_executable.R @@ -8,6 +8,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' set_file_executable <- function(file_path) { if (is_windows()) { diff --git a/R/set_java_workspace.R b/R/set_java_workspace.R index 9328ed9a..bdc62899 100644 --- a/R/set_java_workspace.R +++ b/R/set_java_workspace.R @@ -17,6 +17,10 @@ #' } #' #' @keywords internal +#' +#' @noRd +#' + set_java_workspace <- function(javastics, workspace) { diff --git a/R/set_param_txt.R b/R/set_param_txt.R index ee2ef2a8..952f63bb 100644 --- a/R/set_param_txt.R +++ b/R/set_param_txt.R @@ -48,8 +48,6 @@ #' @export #' #' @examples -#' \dontrun{ -#' #' # Getting example data path #' path <- get_examples_path(file_type = "txt") #' @@ -67,14 +65,14 @@ #' set_param_txt(workspace = path, param = "infil", layer = 2, value = 60) #' #' # If the parameter is found in several files, use the set_* -#' functions directly, e.g. cailloux is found in the general file -#' ("codetycailloux") and the soil file. If we want to change its value -#' in the soil file, we use set_soil_txt(): +#' # functions directly, e.g. cailloux is found in the general file +#' # ("codecailloux") and the soil file. If we want to change its value +#' # in the soil file, we use set_soil_txt(): #' set_soil_txt(file = file.path(path, "param.sol"), #' param = "cailloux", layer = 2, value = 1) -#' } #' -set_param_txt <- function(workspace = getwd(), +#' +set_param_txt <- function(workspace, param, value, append = FALSE, @@ -591,6 +589,8 @@ set_soil_txt <- function(file = "param.sol", #' #' @keywords internal #' +#' @noRd +#' set_file_txt <- function(file, param, value, diff --git a/R/set_param_value.R b/R/set_param_value.R index 80636fe5..7fcd05c8 100644 --- a/R/set_param_value.R +++ b/R/set_param_value.R @@ -15,25 +15,25 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) -#' SticsRFiles:::get_param_value(sols_doc, "argi") +#' sols_doc <- xmldocument(xml_path) +#' get_param_value(sols_doc, "argi") #' # [1] 30.2 21.0 27.0 39.0 1.0 12.2 70.0 22.0 9.9 10.2 10.2 17.0 23.1 22.0 # [15] 27.0 30.7 0.1 27.3 25.0 10.2 25.0 28.6 36.0 29.0 10.2 21.2 22.2 13.0 # [29] 17.0 15.0 26.0 28.2 20.0 #' #' # setting all argi parameters with the same value -#' SticsRFiles:::set_param_value(sols_doc, "argi", 15) -#' SticsRFiles:::get_param_value(sols_doc, "argi") +#' set_param_value(sols_doc, "argi", 15) +#' get_param_value(sols_doc, "argi") #' # [1] 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 # [25] 15 15 15 15 15 15 15 15 15 #' #' # setting specific values for some soils -#' SticsRFiles:::set_param_value(sols_doc, "argi", c(30, 35), +#' set_param_value(sols_doc, "argi", c(30, 35), #' parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") #' ) -#' SticsRFiles:::get_param_value(sols_doc, "argi") +#' get_param_value(sols_doc, "argi") #' # [1] 30 15 15 15 15 15 35 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 # [25] 15 15 15 15 15 15 15 15 15 @@ -41,6 +41,8 @@ #' #' @keywords internal #' +#' @noRd +#' set_param_value <- function(xml_doc, param_name, param_value, @@ -113,7 +115,7 @@ set_param_value <- function(xml_doc, xpath <- param_type$xpath if (show_xpath) { - print(xpath) + message(xpath) } diff --git a/R/set_param_xml.R b/R/set_param_xml.R index 440785c5..2d7d4902 100644 --- a/R/set_param_xml.R +++ b/R/set_param_xml.R @@ -33,65 +33,66 @@ #' value= list(c(1,2), c(2.3,4.5)) #' #' @examples -#' \dontrun{ +#' +#' ex_path <- get_examples_path(file_type = "xml") #' #' # Soil file #' -#' file.copy(file.path(get_examples_path(file_type = "xml"), -#' "sols.xml"), getwd()) +#' sol_path <- file.path(ex_path, "sols.xml") #' #' # For scalar parameters per soil #' #' # Setting all soils "argi" values to 50 -#' set_param_xml("sols.xml", "argi", 50, overwrite = TRUE) +#' set_param_xml(sol_path, "argi", 50, overwrite = TRUE) #' -#' get_param_xml("sols.xml", "argi") +#' get_param_xml(sol_path, "argi") #' #' # Setting a specific value to "argi" for "solcanne" soil -#' set_param_xml("sols.xml", "argi", 56, -#' select = "sol", select_value = "solcanne", overwrite = TRUE +#' set_param_xml(file = sol_path, param = "argi", values = 56, +#' select = "sol", select_value = "solcanne", overwrite = TRUE #' ) #' -#' get_param_xml("sols.xml", "argi", +#' get_param_xml(sol_path, "argi", #' select = "sol", select_value = "solcanne" #' ) #' #' #' # Setting a specific values to 2 parameters "argi" and #' # "norg" for "solcanne" soil -#' set_param_xml("sols.xml", c("argi", "norg"), list(100, 150), +#' set_param_xml(sol_path, c("argi", "norg"), list(100, 150), #' select = "sol", select_value = "solcanne", overwrite = TRUE #' ) #' -#' get_param_xml("sols.xml", c("argi", "norg"), +#' get_param_xml(sol_path, c("argi", "norg"), #' select = "sol", select_value = "solcanne" #' ) #' #' #' # For vector parameters per soil (5 values, one per soil layer) -#' set_param_xml("sols.xml", c("epc", "HCCF"), +#' set_param_xml(sol_path, c("epc", "HCCF"), #' select = "sol", #' select_value = c("solcanne", "solbanane"), #' param_value = list(c(20:24, 10:14), c(50:54, 40:44)), overwrite = TRUE #' ) #' -#' get_param_xml("sols.xml", c("epc", "HCCF"), +#' get_param_xml(sol_path, c("epc", "HCCF"), #' select = "sol", #' select_value = c("solcanne", "solbanane") #' ) #' #' #' # Crop management file -#' file.copy(file.path(get_examples_path(file_type = "xml"), -#' "file_tec.xml"), getwd()) +#' +#' +#' tec_path <- file.path(ex_path, "file_tec.xml") #' #' # Modifying irrigations parameters -#' set_param_xml("file_tec.xml", c("julapI_or_sum_upvt", "amount"), +#' set_param_xml(tec_path, c("julapI_or_sum_upvt", "amount"), #' param_value = list(200:215, 20:35), overwrite = TRUE #' ) #' -#' get_param_xml("file_tec.xml", c("julapI_or_sum_upvt", "amount")) -#' } +#' get_param_xml(tec_path, c("julapI_or_sum_upvt", "amount")) +#' #' #' @export set_param_xml <- function(file, diff --git a/R/set_sols_param_xml.R b/R/set_sols_param_xml.R index 6005c27c..c3868add 100644 --- a/R/set_sols_param_xml.R +++ b/R/set_sols_param_xml.R @@ -9,7 +9,7 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -#' sols_doc <- SticsRFiles:::xmldocument(xml_path) +#' sols_doc <- xmldocument(xml_path) #' #' xl_path <- file.path(get_examples_path(file_type = "xl"), #' "inputs_stics_example.xlsx") @@ -17,25 +17,27 @@ #' #' # For updating an existing xml doc (using existing soils names) #' # Creating a fake existing_doc -#' existing_doc <- SticsRFiles:::gen_usms_sols_doc("sols", nodes_nb = 3) -#' SticsRFiles:::set_param_value(existing_doc, +#' existing_doc <- gen_usms_sols_doc("sols", nodes_nb = 3) +#' set_param_value(existing_doc, #' param_name = "sol", #' param_value = sols_df$Soil_name[c(3, 1, 5)] #' ) #' -#' SticsRFiles:::set_sols_param_xml(existing_doc, sols_df) +#' set_sols_param_xml(existing_doc, sols_df) #' #' #' # For a new xml doc #' # In that case: sols_df must contain all the soils parameters !) #' soils_nb <- dim(sols_df)[1] -#' new_doc <- SticsRFiles:::gen_usms_sols_doc("sols", nodes_nb = soils_nb) +#' new_doc <- gen_usms_sols_doc("sols", nodes_nb = soils_nb) #' -#' SticsRFiles:::set_sols_param_xml(new_doc, sols_df, overwrite = TRUE) +#' set_sols_param_xml(new_doc, sols_df, overwrite = TRUE) #' } #' #' @keywords internal #' +#' @noRd +#' set_sols_param_xml <- function(xml_doc_object, sols_param, overwrite = FALSE) { if (!"data.frame" %in% class(sols_param)) { diff --git a/R/set_usms_param_xml.R b/R/set_usms_param_xml.R index 3a47daa6..9fdd6257 100644 --- a/R/set_usms_param_xml.R +++ b/R/set_usms_param_xml.R @@ -8,7 +8,7 @@ #' @examples #' \dontrun{ #' xml_path <- file.path(get_examples_path(file_type = "xml"), "usms.xml") -#' usms_doc <- SticsRFiles:::xmldocument(xml_path) +#' usms_doc <- xmldocument(xml_path) #' #' xl_path <- file.path(get_examples_path(file_type = "xl"), #' "inputs_stics_example.xlsx") @@ -16,25 +16,27 @@ #' #' # For updating an existing xml doc (using existing usms names) #' # Creating a fake existing_doc -#' existing_doc <- SticsRFiles:::gen_usms_sols_doc("usms", nodes_nb = 3) -#' SticsRFiles:::set_param_value(existing_doc, +#' existing_doc <- gen_usms_sols_doc("usms", nodes_nb = 3) +#' set_param_value(existing_doc, #' param_name = "usm", #' param_value = usms_df$usm_nom[c(3, 1, 5)] #' ) #' -#' SticsRFiles:::set_usms_param_xml(existing_doc, usms_df) +#' set_usms_param_xml(existing_doc, usms_df) #' #' #' # For a new xml doc #' # In that case: usms_df must contain all the usms parameters ! #' usms_nb <- dim(usms_df)[1] -#' new_doc <- SticsRFiles:::gen_usms_sols_doc("usms", nodes_nb = usms_nb) +#' new_doc <- gen_usms_sols_doc("usms", nodes_nb = usms_nb) #' -#' SticsRFiles:::set_usms_param_xml(new_doc, usms_df, overwrite = TRUE) +#' set_usms_param_xml(new_doc, usms_df, overwrite = TRUE) #' } #' #' @keywords internal #' +#' @noRd +#' set_usms_param_xml <- function(xml_doc_object, diff --git a/R/static_help.R b/R/static_help.R index e7aea678..c9d5c377 100644 --- a/R/static_help.R +++ b/R/static_help.R @@ -13,6 +13,8 @@ #' #' @keywords internal #' +#' @noRd +#' #' @examples #' \dontrun{ #' static_help("SticsRFiles") @@ -21,7 +23,7 @@ static_help <- function(pkg, links_level = 0, topic = NULL, - out_dir = getwd(), + out_dir, overwrite = TRUE) { if (!dir.exists(out_dir)) dir.create(out_dir) diff --git a/R/stics_environment.R b/R/stics_environment.R index 811354df..8dda630e 100644 --- a/R/stics_environment.R +++ b/R/stics_environment.R @@ -6,6 +6,7 @@ #' #' @return The default STICS env name #' @keywords internal +#' @noRd #' sticsenv_name <- function() { return(".stics") @@ -22,6 +23,7 @@ sticsenv_name <- function() { #' @param create Create the environment name #' #' @keywords internal +#' @noRd #' stics_env <- function(name = NULL, env_name = globalenv(), create = TRUE) { exists_env <- stics_exists() @@ -77,6 +79,7 @@ stics_env <- function(name = NULL, env_name = globalenv(), create = TRUE) { #' #' @return The new environment #' @keywords internal +#' @noRd #' sticsenv_create <- function(name, env_name = ".GlobalEnv") { parent <- eval(parse(text = env_name)) @@ -105,6 +108,8 @@ sticsenv_create <- function(name, env_name = ".GlobalEnv") { #' #' @return The new environment #' @keywords internal +#' @noRd +#' sticsenv_set_name <- function(name, env_name = sticsenv_name(), fix_name = NULL) { @@ -135,6 +140,7 @@ sticsenv_set_name <- function(name, #' #' @return A vector of environment names #' @keywords internal +#' @noRd sticsenv_get_name <- function(name = NULL, env_name = sticsenv_name()) { if (!stics_exists(name = name, env_name = env_name)) { return(invisible()) @@ -154,6 +160,7 @@ sticsenv_get_name <- function(name = NULL, env_name = sticsenv_name()) { #' #' @return A vector of all object names in the environment #' @keywords internal +#' @noRd sticsenv_ls <- function(name = NULL, env_name = sticsenv_name(), detail = FALSE) { @@ -179,6 +186,7 @@ sticsenv_ls <- function(name = NULL, #' #' @return A boolean, `TRUE` if the object is in the env, `FALSE` otherwise. #' @keywords internal +#' @noRd stics_exists <- function(name = NULL, env_name = sticsenv_name()) { exists_env <- exists( x = sticsenv_name(), @@ -226,6 +234,7 @@ stics_exists <- function(name = NULL, env_name = sticsenv_name()) { #' #' @return The object value. #' @keywords internal +#' @noRd stics_get <- function(name = NULL, env_name = sticsenv_name()) { if (base::is.null(name) || name == sticsenv_name()) { return(stics_env(create = FALSE)) @@ -278,6 +287,7 @@ stics_get <- function(name = NULL, env_name = sticsenv_name()) { #' #' @return Nothing. Just adds an object to the given environment. #' @keywords internal +#' @noRd #' stics_set <- function(name, value, env_name = sticsenv_name()) { envir <- stics_env(name = env_name) @@ -325,6 +335,7 @@ stics_set <- function(name, value, env_name = sticsenv_name()) { #' #' @return A vector of classes #' @keywords internal +#' @noRd #' stics_class <- function(name, env_name = sticsenv_name()) { return(class(stics_get(name = name, env_name = env_name))) @@ -337,6 +348,7 @@ stics_class <- function(name, env_name = sticsenv_name()) { #' #' @return A vector of names #' @keywords internal +#' @noRd #' stics_split_list <- function(name) { return(unlist(strsplit(x = name, split = "\\$"))) @@ -348,6 +360,7 @@ stics_split_list <- function(name) { #' #' @return Nothing. Just removes an object from the STICS environment. #' @keywords internal +#' @noRd #' #' @examples #' \dontrun{ @@ -416,6 +429,7 @@ stics_remove <- function(name = NULL, env_name = sticsenv_name()) { #' #' @return Nothing. Just cleans the STICS environment. #' @keywords internal +#' @noRd #' #' @examples #' \dontrun{ diff --git a/R/stics_examples_utils.R b/R/stics_examples_utils.R index cf8a15ea..91fae0ca 100644 --- a/R/stics_examples_utils.R +++ b/R/stics_examples_utils.R @@ -4,6 +4,7 @@ #' ("csv", "obs", "sti", "txt", "xml") #' @param stics_version Name of the STICS version. Optional, by default #' the latest version returned by `get_stics_versions_compat()` is used. +#' @param overwrite TRUE for overwriting directory; FALSE otherwise #' @param version_name `r lifecycle::badge("deprecated")` `version_name` is no #' longer supported, use `stics_version` instead. #' @@ -13,15 +14,14 @@ #' @export #' #' @examples -#' \dontrun{ -#' #' get_examples_path(file_type = "csv") #' #' get_examples_path(file_type = c("csv", "sti")) #' #' get_examples_path(file_type = "csv", stics_version = "V8.5") -#' } +#' get_examples_path <- function(file_type, stics_version = "latest", + overwrite = FALSE, version_name = lifecycle::deprecated()) { if (lifecycle::is_present(version_name)) { lifecycle::deprecate_warn( @@ -38,7 +38,8 @@ get_examples_path <- function(file_type, stics_version = "latest", # If not any arguments : displaying files types list if (missing(file_type)) { - cat("Available files types: ", paste(get_examples_types(), collapse = ",")) + message("Available files types: ", + paste(get_examples_types(), collapse = ",")) return(invisible()) } @@ -73,7 +74,7 @@ get_examples_path <- function(file_type, stics_version = "latest", # Getting and storing path for each kind of file examples_path <- vector(mode = "character", length = length(files_str)) for (i in seq_along(files_str)) { - base_path <- unzip_examples(files_str[i]) + base_path <- unzip_examples(files_str[i], overwrite = overwrite) if (base_path == "") { examples_path[i] <- "" } else { @@ -121,15 +122,18 @@ get_examples_types <- function() { #' Unzip files archive if needed and return examples files path #' in extdata directory #' -#' @param examples_type_path library path for examples files set +#' @param files_types type of file of examples files set #' @param version_dir version directory names of the example files +#' @param overwrite TRUE for overwriting directory; FALSE otherwise #' #' @return library examples files path #' #' @keywords internal #' +#' @noRd +#' # @examples -unzip_examples <- function(files_type, version_dir) { +unzip_examples <- function(files_type, version_dir, overwrite = FALSE) { ex_path <- system.file("extdata", package = "SticsRFiles") @@ -138,7 +142,10 @@ unzip_examples <- function(files_type, version_dir) { winslash = "/", mustWork = FALSE) - if (dir.exists(dir_path)) return(dir_path) + if (dir.exists(dir_path) && !overwrite) return(dir_path) + + if (overwrite) + unlink(x = dir_path, recursive = TRUE) zip_path <- file.path(ex_path, paste0(files_type, ".zip")) diff --git a/R/upgrade_ini_xml.R b/R/upgrade_ini_xml.R index 5f0bff80..59e750ac 100644 --- a/R/upgrade_ini_xml.R +++ b/R/upgrade_ini_xml.R @@ -21,13 +21,15 @@ #' @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( -#' file = "/path/to/_ini.xml", -#' out_dir = "/path/to/directory", -#' param_gen_file = "/path/to/param_gen.xml" +#' file = file.path(dir_path,"file_ini.xml"), +#' out_dir = tempdir(), +#' param_gen_file = file.path(dir_path, "param_gen.xml") #' ) -#' } +#' upgrade_ini_xml <- function(file, out_dir, param_gen_file, diff --git a/R/upgrade_param_gen_xml.R b/R/upgrade_param_gen_xml.R index 3a149563..f9d49b90 100644 --- a/R/upgrade_param_gen_xml.R +++ b/R/upgrade_param_gen_xml.R @@ -15,15 +15,16 @@ #' #' @export #' -#' @details See SticsRFiles::get_stics_versions_compat() for listing versions +#' @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( -#' file = "/path/to/param_gen.xml", -#' out_dir = "/path/to/directory" +#' file = file.path(dir_path, "param_gen.xml"), +#' out_dir = tempdir() #' ) -#' } + upgrade_param_gen_xml <- function(file, out_dir, stics_version = "V9.2", diff --git a/R/upgrade_param_newform_xml.R b/R/upgrade_param_newform_xml.R index 5ae8fcbd..e8560c9e 100644 --- a/R/upgrade_param_newform_xml.R +++ b/R/upgrade_param_newform_xml.R @@ -21,13 +21,16 @@ #' @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( -#' file = "/path/to/param_newform.xml", -#' out_dir = "/path/to/directory", -#' param_gen_file = "/path/to/param_gen.xml" +#' file = file.path(dir_path,"param_newform.xml"), +#' out_dir = tempdir(), +#' param_gen_file = file.path(dir_path, "param_gen.xml") #' ) -#' } +#' +#' upgrade_param_newform_xml <- function(file, out_dir, param_gen_file, diff --git a/R/upgrade_plt_xml.R b/R/upgrade_plt_xml.R index a8abaac0..f58a9b54 100644 --- a/R/upgrade_plt_xml.R +++ b/R/upgrade_plt_xml.R @@ -20,17 +20,19 @@ #' #' @export #' -#' @details See SticsRFiles::get_stics_versions_compat() for listing versions +#' @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( -#' file = "/path/to/_plt.xml", -#' param_gen_file = "/path/to/param_gen.xml", -#' param_newform_file = "/path/to/param_newform.xml", -#' out_dir = "/path/to/directory" +#' 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") #' ) -#' } +#' upgrade_plt_xml <- function(file, out_dir, param_newform_file, diff --git a/R/upgrade_sols_xml.R b/R/upgrade_sols_xml.R index 76ad9d13..d068357b 100644 --- a/R/upgrade_sols_xml.R +++ b/R/upgrade_sols_xml.R @@ -20,13 +20,15 @@ #' @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( -#' file = "/path/to/sols.xml", -#' param_gen_file = "/path/to/param_gen.xml", -#' out_dir = "/path/to/an/output/directory" +#' file = file.path(dir_path,"sols.xml" ), +#' out_dir = tempdir(), +#' param_gen_file = file.path(dir_path, "param_gen.xml") #' ) -#' } +#' upgrade_sols_xml <- function(file, out_dir, param_gen_file, diff --git a/R/upgrade_sta_xml.R b/R/upgrade_sta_xml.R index dce558df..b8c17334 100644 --- a/R/upgrade_sta_xml.R +++ b/R/upgrade_sta_xml.R @@ -21,13 +21,15 @@ #' @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( -#' file = "/path/to/_sta.xml", -#' out_dir = "/path/to/directory", -#' param_gen_file = "/path/to/param_gen.xml" +#' file = file.path(dir_path,"file_sta.xml" ), +#' out_dir = tempdir(), +#' param_gen_file = file.path(dir_path, "param_gen.xml") #' ) -#' } +#' upgrade_sta_xml <- function(file, out_dir, param_gen_file, diff --git a/R/upgrade_tec_xml.R b/R/upgrade_tec_xml.R index 23a025b1..37f222fb 100644 --- a/R/upgrade_tec_xml.R +++ b/R/upgrade_tec_xml.R @@ -20,17 +20,20 @@ #' #' @export #' -#' @details See SticsRFiles::get_stics_versions_compat() for listing versions +#' @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( -#' file = "/path/to/_tec.xml", -#' out_dir = "/path/to/directory", -#' param_newform_file = "/path/to/param_newform.xml", -#' param_gen_file = "/path/to/param_gen.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") #' ) -#' } +#' +#' upgrade_tec_xml <- function(file, out_dir, param_newform_file, diff --git a/R/upgrade_usms_xml.R b/R/upgrade_usms_xml.R index 798c9cfb..d17eefd9 100644 --- a/R/upgrade_usms_xml.R +++ b/R/upgrade_usms_xml.R @@ -18,17 +18,18 @@ #' #' @export #' -#' @details See SticsRFiles::get_stics_versions_compat() for listing versions +#' @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( -#' file = "/path/to/usms.xml", -#' out_dir = "/path/to/directory", -#' param_gen_file = "/path/to/param_gen.xml", -#' obs_dir = "/path/to/obs/directory" +#' file = file.path(dir_path,"usms.xml"), +#' out_dir = tempdir(), +#' param_gen_file = file.path(dir_path, "param_gen.xml") #' ) -#' } +#' upgrade_usms_xml <- function(file, out_dir, param_gen_file, diff --git a/R/upgrade_workspace_xml.R b/R/upgrade_workspace_xml.R index bb87c9ba..4baeb61a 100644 --- a/R/upgrade_workspace_xml.R +++ b/R/upgrade_workspace_xml.R @@ -93,7 +93,7 @@ upgrade_workspace_xml <- function(workspace, # Testing the workspace dir to be converted if (!dir.exists(workspace) || - !file.exists(file.path(workspace, "usms.xml"))) { + !file.exists(file.path(workspace, "usms.xml"))) { stop( workspace, ": the directory does not exist or is not a JavaSTICS workspace !" @@ -105,7 +105,7 @@ upgrade_workspace_xml <- function(workspace, # Testing the JavaSTICS dir if (!dir.exists(javastics) || - !file.exists(file.path(javastics, "JavaStics.exe"))) { + !file.exists(file.path(javastics, "JavaStics.exe"))) { stop( javastics, " : the directory does nor exist or is not a JavaSTICS one !" @@ -114,13 +114,12 @@ upgrade_workspace_xml <- function(workspace, if (verbose) { - cat(paste( + message(paste( "Upgrading files from version", stics_version, "to", - target_version, "\n" - )) - cat(paste("From: ", workspace, "\n")) - cat(paste("To: ", out_dir, "\n")) - cat("-----------------------------------\n") + target_version, "\n"), + paste("From: ", workspace, "\n"), + paste("To: ", out_dir, "\n"), + "-----------------------------------\n") } # Converting param_gen.xml @@ -135,7 +134,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("param_gen.xml\n") + message("param_gen.xml\n") } } @@ -166,7 +165,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("param_new_form.xml\n") + message("param_new_form.xml\n") } } @@ -186,7 +185,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("usms.xml\n") + message("usms.xml\n") } # Converting sols.xml file @@ -203,7 +202,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("sols.xml\n") + message("sols.xml\n") } # Converting station files (*_sta.xml) @@ -221,7 +220,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("*_sta.xml\n") + message("*_sta.xml\n") } # Converting initialisation files (*_ini.xml) @@ -239,7 +238,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("*_ini.xml\n") + message("*_ini.xml\n") } # Converting crop management files (*_tec.xml) @@ -258,7 +257,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("*_tec.xml\n") + message("*_tec.xml\n") } # Copying *.mod files (for model outputs) @@ -268,7 +267,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("Copying *.mod files.\n") + message("Copying *.mod files.\n") } # TODO: see how to manage variables names checks in *.mod files @@ -287,7 +286,7 @@ upgrade_workspace_xml <- function(workspace, ) if (verbose) { - cat("Copying *.obs files.\n") + message("Copying *.obs files.\n") } # Copying weather data files @@ -310,7 +309,7 @@ upgrade_workspace_xml <- function(workspace, } if (verbose) { - cat("Copying weather files.\n") + message("Copying weather files.\n") } @@ -324,7 +323,7 @@ upgrade_workspace_xml <- function(workspace, if (length(plant_files) > 0) { if (verbose) { - cat("*_plt.xml\n") + message("*_plt.xml\n") } # For creating a sub-directory in workspace for upgraded plant files @@ -345,7 +344,8 @@ upgrade_workspace_xml <- function(workspace, } if (verbose) { - cat("-----------------------------------\n") + message(paste0("-----------------------------------\n", + "Files upgrade and copy is complete.\n") + ) } - cat("Files upgrade and copy is complete.\n") } diff --git a/R/var_to_col_names.R b/R/var_to_col_names.R index 556f511f..71d797f9 100644 --- a/R/var_to_col_names.R +++ b/R/var_to_col_names.R @@ -10,9 +10,11 @@ #' #' @examples #' var_names <- c("var1", "var2(n)", "var2.n.") -#' valid_names <- SticsRFiles:::var_to_col_names(var_names) +#' valid_names <- var_to_col_names(var_names) #' @keywords internal #' +#' @noRd +#' var_to_col_names <- function(var_vec) { . <- NULL # (n) @@ -42,6 +44,8 @@ var_to_col_names <- function(var_vec) { #' (usually used for `gen_varmod()`) #' @keywords internal #' +#' @noRd +#' #' @seealso `gen_varmod()` #' #' @examples diff --git a/R/xml_document.R b/R/xml_document.R index 1cb69e12..54fe970b 100644 --- a/R/xml_document.R +++ b/R/xml_document.R @@ -159,7 +159,7 @@ setMethod( # testing if all nodes have the same attributes !! if (!is.matrix(attr_list) && !is.matrix(attr_list[, ])) { if (object@warn) { - print(class(attr_list)) + message(class(attr_list)) warning(paste( "Existing nodes with different attributes comparing to others,", "missing attributes ?", diff --git a/README.Rmd b/README.Rmd index 3b9e9aa8..f9958da8 100644 --- a/README.Rmd +++ b/README.Rmd @@ -22,6 +22,8 @@ knitr::opts_chunk$set( [![R build status](https://github.com/SticsRPacks/SticsRFiles/workflows/R-CMD-check/badge.svg)](https://github.com/SticsRPacks/SticsRFiles/actions) [![Codecov test coverage](https://codecov.io/gh/SticsRPacks/SticsRFiles/branch/master/graph/badge.svg)](https://app.codecov.io/gh/SticsRPacks/SticsRFiles?branch=master) [![DOI](https://zenodo.org/badge/187986787.svg)](https://zenodo.org/badge/latestdoi/187986787) +![](https://www.r-pkg.org/badges/version-ago/SticsRFiles) + The goal of SticsRFiles is to perform manipulations of the [STICS](https://www6.paca.inrae.fr/stics_eng/) model files either on XML files (used by the JavaSTICS GUI) or on text files used by the model fortran executable. diff --git a/README.md b/README.md index 3c4c4bbd..50b244a3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ status](https://github.com/SticsRPacks/SticsRFiles/workflows/R-CMD-check/badge.s [![Codecov test coverage](https://codecov.io/gh/SticsRPacks/SticsRFiles/branch/master/graph/badge.svg)](https://app.codecov.io/gh/SticsRPacks/SticsRFiles?branch=master) [![DOI](https://zenodo.org/badge/187986787.svg)](https://zenodo.org/badge/latestdoi/187986787) +![](https://www.r-pkg.org/badges/version-ago/SticsRFiles) + The goal of SticsRFiles is to perform manipulations of the diff --git a/cran-comments.md b/cran-comments.md index 544944f2..3922f14c 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,9 +1,9 @@ ── SticsRFiles 1.1.3: NOTE - Build ID: SticsRFiles_1.1.3.tar.gz-c4b9e5e1c0f0486ab292c73748a6ed2a + Build ID: SticsRFiles_1.1.3.tar.gz-8809a5555e8d4b178533dac67a09f302 Platform: Windows Server 2022, R-devel, 64 bit - Submitted: 1h 9m 54.9s ago - Build time: 7m 41.8s + Submitted: 1h 16m 25.9s ago + Build time: 6m 38.2s ❯ checking CRAN incoming feasibility ... [17s] NOTE Maintainer: 'Patrice Lecharpentier ' @@ -22,12 +22,12 @@ ── SticsRFiles 1.1.3: NOTE - Build ID: SticsRFiles_1.1.3.tar.gz-200502a17eab4563a2972360a9407d88 + Build ID: SticsRFiles_1.1.3.tar.gz-6201bbb5979c4d188c1d90a8a39e118f Platform: Ubuntu Linux 20.04.1 LTS, R-release, GCC - Submitted: 1h 9m 54.9s ago - Build time: 57m 29.5s + Submitted: 1h 16m 25.9s ago + Build time: 41m 44s -❯ checking CRAN incoming feasibility ... [7s/26s] NOTE +❯ checking CRAN incoming feasibility ... [7s/25s] NOTE Maintainer: ‘Patrice Lecharpentier ’ New submission @@ -39,12 +39,12 @@ ── SticsRFiles 1.1.3: NOTE - Build ID: SticsRFiles_1.1.3.tar.gz-16096564b3744da893ed5ebd16c3c81f + Build ID: SticsRFiles_1.1.3.tar.gz-71d2ad6496864b32919f3bfd9c60744b Platform: Fedora Linux, R-devel, clang, gfortran - Submitted: 1h 9m 54.9s ago - Build time: 54m 54.4s + Submitted: 1h 16m 25.9s ago + Build time: 39m 18.8s -❯ checking CRAN incoming feasibility ... [9s/33s] NOTE +❯ checking CRAN incoming feasibility ... [8s/33s] NOTE Maintainer: ‘Patrice Lecharpentier ’ New submission @@ -53,9 +53,3 @@ Skipping checking HTML validation: no command 'tidy' found 0 errors ✔ | 0 warnings ✔ | 2 notes ✖ - - - - - - diff --git a/man/add_node_to_doc.Rd b/man/add_node_to_doc.Rd deleted file mode 100644 index 5d8e7121..00000000 --- a/man/add_node_to_doc.Rd +++ /dev/null @@ -1,53 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/add_node_to_doc.R -\name{add_node_to_doc} -\alias{add_node_to_doc} -\title{Add node to an xml_document object} -\usage{ -add_node_to_doc(xml_doc, new_node, nodes_nb = 1, parent_path) -} -\arguments{ -\item{xml_doc}{an xml_document} - -\item{new_node}{a new node to add} - -\item{nodes_nb}{nodes number to add to parent node} - -\item{parent_path}{path of the parent node} -} -\description{ -Add node to an xml_document object -} -\examples{ -\dontrun{ - -tec_xml <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -tec_doc <- SticsRFiles:::xmldocument(tec_xml) - -# Getting a new irrigation operation node -irrigation_node <- SticsRFiles:::get_xml_base_node("tec", "irrigation") -parent_path <- SticsRFiles:::get_param_type( - tec_doc, "ta", "formalisme", - "irrigation" -)$xpath - -# Adding one irrigation operation -SticsRFiles:::add_node_to_doc( - xml_doc = tec_doc, new_node = irrigation_node, - nodes_nb = 1, parent_path = parent_path -) - -# Checking irrigations operations number -irrigations_nb <- length(SticsRFiles:::get_param_value( - tec_doc, - "julapI_or_sum_upvt" -)) -# Fixing it in nb_interventions attribute -SticsRFiles:::set_param_value( - tec_doc, "nb_interventions", irrigations_nb, - "irrigation" -) -} - -} -\keyword{internal} diff --git a/man/add_stics_nodes.Rd b/man/add_stics_nodes.Rd deleted file mode 100644 index c45c5361..00000000 --- a/man/add_stics_nodes.Rd +++ /dev/null @@ -1,40 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/add_stics_nodes.R -\name{add_stics_nodes} -\alias{add_stics_nodes} -\title{Add node to a STICS XML document} -\usage{ -add_stics_nodes( - xml_doc, - formalism_name = NULL, - nodes_nb = 1, - stics_version = "latest" -) -} -\arguments{ -\item{xml_doc}{XML document} - -\item{formalism_name}{Name of the formalism (optional)} - -\item{nodes_nb}{number of operations to add} - -\item{stics_version}{The version of STICS (eg "V9.1")} -} -\description{ -Add node to a STICS XML document -} -\examples{ -\dontrun{ - -tec_xml <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -tec_doc <- SticsRFiles:::xmldocument(tec_xml) - -# Adding one irrigation operation -SticsRFiles:::add_stics_nodes(tec_doc, "irrigation") - -# Adding three irrigation operations -SticsRFiles:::add_stics_nodes(tec_doc, "irrigation", nodes_nb = 3) -} - -} -\keyword{internal} diff --git a/man/add_stics_version.Rd b/man/add_stics_version.Rd deleted file mode 100644 index a45c2c49..00000000 --- a/man/add_stics_version.Rd +++ /dev/null @@ -1,57 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{add_stics_version} -\alias{add_stics_version} -\title{Adding a new version in the SticsRFiles library or package} -\usage{ -add_stics_version( - version_name, - url, - file_name = "all", - location = "install", - overwrite = FALSE, - verbose = TRUE -) -} -\arguments{ -\item{version_name}{name (i.e. "VX.Y") of the version to set -in the csv file containing informations about versions} - -\item{url}{Subversion repository address of the branch, tag to get -information from} - -\item{file_name}{File name(s) -or keyword "all" for both files (default)} - -\item{location}{The destination where to write information -"install" for writing -things in the installed SticsRFiles library (default), "package" for writing -them in the package project (in RStudio)} - -\item{overwrite}{A logical, TRUE to overwrite csv files, -FALSE otherwise (default)} - -\item{verbose}{Logical, TRUE for displaying warnings (default), -FALSE otherwise} -} -\value{ -An invisible data.frame containing versions data -} -\description{ -Adding a new version in the SticsRFiles library or package -} -\examples{ -\dontrun{ -SticsRFiles:::add_stics_version( - version_name = "V10.0", - url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10" -) - -SticsRFiles:::add_stics_version( - version_name = "V10.0", - url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", - location = "package" -) -} -} -\keyword{internal} diff --git a/man/all_out_var.Rd b/man/all_out_var.Rd deleted file mode 100644 index da4d59e5..00000000 --- a/man/all_out_var.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/all_out_var.R -\name{all_out_var} -\alias{all_out_var} -\title{Return all possible STICS outputs for var.mod} -\usage{ -all_out_var(stics_version = "latest") -} -\arguments{ -\item{stics_version}{Name of the STICS version. Optional, can be used to -search parameters information relative to a specific STICS version. -By default the latest version returned by \code{get_stics_versions_compat()} -is used.} -} -\description{ -Helper function to print the list of all possible variables -to set as output from the STICS model. -} -\examples{ -\dontrun{ -all_out_var() -} -} -\seealso{ -\code{get_var_info()}, \code{gen_varmod()}, and \code{get_stics_versions_compat()} -} -\keyword{internal} diff --git a/man/attributes_list2matrix.Rd b/man/attributes_list2matrix.Rd deleted file mode 100644 index d8759e0b..00000000 --- a/man/attributes_list2matrix.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/attributes_list2matrix.R -\name{attributes_list2matrix} -\alias{attributes_list2matrix} -\title{Converting an attributes list to a matrix} -\usage{ -attributes_list2matrix(attr_list) -} -\arguments{ -\item{attr_list}{XML attributes list} -} -\value{ -A matrix with attributes names as column names -} -\description{ -Converting an attributes list to a matrix -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -node_set <- SticsRFiles:::get_nodes(sols_doc, - "//*[@nom=\"solcanne\" or @nom=\"mulchbat\"]") -attr_list <- sapply(node_set, function(x) XML::xmlAttrs(x)) - -#> [[1]] -#> nom -#> "solcanne" - -#> [[2]] -#> format max min nom -#> "real" "2.0" "0.0" "mulchbat" - -#> [[3]] -#> format max min nom -#> "real" "2.0" "0.0" "mulchbat" - -SticsRFiles:::attributes_list2matrix(attr_list) - -#> nom format max min -#> [1,] "solcanne" NA NA NA -#> [2,] "mulchbat" "real" "2.0" "0.0" -#> [3,] "mulchbat" "real" "2.0" "0.0" -} - -} -\keyword{internal} diff --git a/man/character_to_numeric_list.Rd b/man/character_to_numeric_list.Rd deleted file mode 100644 index 9fa0a3fd..00000000 --- a/man/character_to_numeric_list.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_txt.R -\name{character_to_numeric_list} -\alias{character_to_numeric_list} -\title{Character list to numeric list} -\usage{ -character_to_numeric_list(x) -} -\arguments{ -\item{x}{A list with potential numeric values written a characters} -} -\value{ -A list with numeric values when possible -} -\description{ -Tries to convert the values in a list into numeric values, -and if it fails, return as character. -} -\examples{ -\dontrun{ -test <- list(a = "2", b = "toto") -character_to_numeric_list(test) -} - -} -\keyword{internal} diff --git a/man/check_choice_param.Rd b/man/check_choice_param.Rd deleted file mode 100644 index 49a2a89f..00000000 --- a/man/check_choice_param.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_choice_param.R -\name{check_choice_param} -\alias{check_choice_param} -\title{Checking if any parameter appear in 2 option choices} -\usage{ -check_choice_param(xml_doc, param_name, stop = FALSE) -} -\arguments{ -\item{xml_doc}{an xml_document object} - -\item{param_name}{parameter names vector, i.e.: parameter name or option code} - -\item{stop}{TRUE for rising an error, FALSE for just warning} -} -\value{ -invisible NULL -} -\description{ -Checking if any parameter appear in 2 option choices -} -\examples{ -\dontrun{ -check_choice_param(xml_doc = xml_doc, param_name = param_name) -} - -} -\keyword{internal} diff --git a/man/check_java_path.Rd b/man/check_java_path.Rd deleted file mode 100644 index b2e90a60..00000000 --- a/man/check_java_path.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_java_path.R -\name{check_java_path} -\alias{check_java_path} -\title{Checking JavaSTICS directory content} -\usage{ -check_java_path(javastics) -} -\arguments{ -\item{javastics}{JavaSTICS installation root folder} -} -\description{ -Checking if directory exists and if it contains JavaSTICS jar -files -} -\details{ -Rising an exception for each checking step ! -} -\examples{ -\dontrun{ -check_java_path("/path/to/JavaSTICS/folder") -} - -} -\keyword{internal} diff --git a/man/check_java_workspace.Rd b/man/check_java_workspace.Rd deleted file mode 100644 index 6ad7e47a..00000000 --- a/man/check_java_workspace.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_java_workspace.R -\name{check_java_workspace} -\alias{check_java_workspace} -\title{Checking and getting JavaSTICS workspace path} -\usage{ -check_java_workspace(javastics, workspace = NULL) -} -\arguments{ -\item{javastics}{Path of JavaSTICS installation directory} - -\item{workspace}{An absolute or relative path (to JavaSTICS path) -of a workspace (Optional)} -} -\value{ -An absolute JavaSTICS workspace path -} -\description{ -Looking in JavaSTICS for a workspace path in JavaSTICS -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 -} -\keyword{internal} diff --git a/man/check_javastics_cmd.Rd b/man/check_javastics_cmd.Rd deleted file mode 100644 index 834737d6..00000000 --- a/man/check_javastics_cmd.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_cmd_util.R -\name{check_javastics_cmd} -\alias{check_javastics_cmd} -\title{Checking if the java virtual machine is compatible with the given -JavaSTICS command executable, and command line options} -\usage{ -check_javastics_cmd( - javastics_cmd = "JavaSticsCmd.exe", - java_cmd = "java", - verbose = TRUE -) -} -\arguments{ -\item{javastics_cmd}{path to JavaSTICS command line executable} - -\item{java_cmd}{Name or path of the java virtual machine executable} -} -\value{ -A named list with the JavaSTICS command line path, -the java path and the verbose string option (according to JavaSTICS command -line version, and the "verbose" argument value) -} -\description{ -For Unix like systems, the system java virtual machine is -detected and consistency for JavaSTICS executable used is checked. -Command line verbosity option is detected for JavaSTICS command line for all -systems. -} -\details{ -Errors are raised if the JavaSTICS executable cannot be run with the -given java virtual machine for unix like systems. -} -\examples{ -\dontrun{ -check_javastics_cmd(javastics_cmd = "/path/to/JavaSticsCmd.exe") -check_javastics_cmd( - javastics_cmd = "/path/to/JavaSticsCmd.exe", - java_cmd = "/path/to/java" -) -} - -} -\keyword{internal} diff --git a/man/check_output_files.Rd b/man/check_output_files.Rd deleted file mode 100644 index 93b20192..00000000 --- a/man/check_output_files.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_output_files.R -\name{check_output_files} -\alias{check_output_files} -\title{Checking model outputs files} -\usage{ -check_output_files(run_dir, usm_name = NULL) -} -\arguments{ -\item{run_dir}{Directory name or path (absolute) of a working directory, -or root directory of working directories} - -\item{usm_name}{Usm name, to be set if it is the name of a sub-directory of -the given argument run_dir} -} -\value{ -A list with fields $error (logical, TRUE if any missing file, FALSE -otherwise), $missing (missing files vector) -} -\description{ -This function checks if the model outputs files are correctly -produced -} -\examples{ -\dontrun{ -check_output_files("/home/username/Work/SticsInputsDir") -check_output_files("/home/username/Work/SticsInputsRootDir", "usmDir") -} - -} -\keyword{internal} diff --git a/man/check_usms_files.Rd b/man/check_usms_files.Rd deleted file mode 100644 index f81eb1f2..00000000 --- a/man/check_usms_files.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_usms_files.R -\name{check_usms_files} -\alias{check_usms_files} -\title{Checking xml files existence got from usms.xml} -\usage{ -check_usms_files( - workspace_path, - javastics_path, - usms_list = NULL, - file_name = "usms.xml" -) -} -\arguments{ -\item{workspace_path}{The path to a JavaSTICS-compatible workspace} - -\item{javastics_path}{JavaSTICS installation path (Optional, needed if the -plant files are not in the \code{workspace_path} -but rather in the JavaSTICS default plant folder)} - -\item{usms_list}{Vector of usms names (Optional)} - -\item{file_name}{Usms XML file name (Optional)} -} -\value{ -A data.frame with files names usm row and a status (all_exist) -indicating weither or not all listed files exist in the \code{workspace_path} -} -\description{ -Checking xml files existence got from usms.xml -} -\examples{ -\dontrun{ - -check_usms_files( - workspace_path = "/path/to/workspace", - javastics_path = "/path/to/JavaSTICS/folder" -) - -check_usms_files( - workspace_path = "/path/to/workspace", - javastics_path = "/path/to/JavaSTICS/folder", usm_list = c("usm1", "usm3") -) -} - -} -\keyword{internal} diff --git a/man/check_version_compat.Rd b/man/check_version_compat.Rd deleted file mode 100644 index ca1bc857..00000000 --- a/man/check_version_compat.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_stics_versions_compat.R -\name{check_version_compat} -\alias{check_version_compat} -\title{Checking the validity of a given version code} -\usage{ -check_version_compat(stics_version = "latest") -} -\arguments{ -\item{stics_version}{An optional version name as listed in -get_stics_versions_compat() return} -} -\value{ -A valid version string -} -\description{ -Checking the validity of a given version code -} -\examples{ -\dontrun{ - -SticsRFiles:::check_version_compat() -} -} -\keyword{internal} diff --git a/man/col_names_to_var.Rd b/man/col_names_to_var.Rd deleted file mode 100644 index bc4dcc7a..00000000 --- a/man/col_names_to_var.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/col_names_to_var.R -\name{col_names_to_var} -\alias{col_names_to_var} -\title{Convert columns names list to STICS variables names} -\usage{ -col_names_to_var(var_list = c()) -} -\arguments{ -\item{var_list}{Columns names list} -} -\value{ -List of STICS variables names -} -\description{ -Change the \code{varname.n.} or \code{varname_n} by \code{varname(n)} -other names are unchanged (i.e.: varname, varname(n), ...) -} -\examples{ -col_names <- c("var1", "var2_n", "var3.1.") -valid_names <- SticsRFiles:::col_names_to_var(col_names) -} -\keyword{internal} diff --git a/man/complete_climate_paths.Rd b/man/complete_climate_paths.Rd deleted file mode 100644 index 258720ff..00000000 --- a/man/complete_climate_paths.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_climate.R -\name{complete_climate_paths} -\alias{complete_climate_paths} -\title{Generating the complete wheather files paths list} -\usage{ -complete_climate_paths(files_path) -} -\arguments{ -\item{files_path}{Vector of 1 or 2 weather data files} -} -\value{ -a character vector of files paths -} -\description{ -Generating the complete wheather files paths list -} -\examples{ -\dontrun{ -SticsRFiles:::complete_climate_paths( - c("path/to/weather.year1", "path/to/weather.year2")) -} - -} -\keyword{internal} diff --git a/man/compute_doy_cumul.Rd b/man/compute_doy_cumul.Rd deleted file mode 100644 index 1a67295c..00000000 --- a/man/compute_doy_cumul.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/compute_doy_cumul.R -\name{compute_doy_cumul} -\alias{compute_doy_cumul} -\title{Calculating cumulative day of year from days of year over 2 years} -\usage{ -compute_doy_cumul(doys_vec, years_vec) -} -\arguments{ -\item{doys_vec}{vector of days of year} - -\item{years_vec}{vector of years corresponding to each day of year from -doys_vec} -} -\value{ -A vector of cumulative days of year over a 2 years period -} -\description{ -For a vector of days of year and a vector of corresponding year -for each one, calculation of cumulative days of years -} -\examples{ -\dontrun{ -SticsRFiles:::compute_doy_cumul(c(350, 360, 10, 20, 30), c( - 1990, 1990, 1991, - 1991, 1991 -)) -} - -# -} -\keyword{internal} diff --git a/man/convert_xml2txt.Rd b/man/convert_xml2txt.Rd index d70c05bf..7fedf8eb 100644 --- a/man/convert_xml2txt.Rd +++ b/man/convert_xml2txt.Rd @@ -51,10 +51,11 @@ is converted to a text file readable by the STICS model (ficini.txt, ficplt1.txt,...) } \examples{ + \dontrun{ xml_path <- "/path/to/corn_plt.xml" javastics_path <- "/path/to/JavaSTICS/folder" -convert_xml2txt(xml_file = xml_path, java_dir = javastics_path) +convert_xml2txt(file = xml_path, javastics = javastics_path) } } diff --git a/man/convert_xml2txt_int.Rd b/man/convert_xml2txt_int.Rd deleted file mode 100644 index ed9f0d11..00000000 --- a/man/convert_xml2txt_int.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/convert_xml2txt_int.R -\name{convert_xml2txt_int} -\alias{convert_xml2txt_int} -\title{Transforming an xml file with the help of an xsl style file} -\usage{ -convert_xml2txt_int(xml_file, style_file, out_file = NULL) -} -\arguments{ -\item{xml_file}{File path of the input xml file} - -\item{style_file}{File path of the xsl file} - -\item{out_file}{File path of the generated file} -} -\value{ -Path of the generated file -} -\description{ -Using an xslt transformation, an xml input file is converted to -an other file format (text, xml). The output file name may be given or -calculated. -In the latest case, the extension is defined after getting xsl method from -the xsl file (xml, txt). -} -\examples{ -\dontrun{ -xml_plt <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") -xsl_file <- - "/path/to/JavaSTICS/folder/bin/resources/xml/stylesheet/xml2txt.xsl" - -SticsRFiles:::convert_xml2txt_int(xml_file = xml_plt, style_file = xsl_file) -} - -} -\keyword{internal} diff --git a/man/download_csv_files.Rd b/man/download_csv_files.Rd deleted file mode 100644 index 63f7e5f0..00000000 --- a/man/download_csv_files.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{download_csv_files} -\alias{download_csv_files} -\title{Downloading inputs and/or outputs csv files from a repository branch/tag} -\usage{ -download_csv_files( - branch_url, - dest_dir, - file_name = "all", - ids = get_svn_identifiers(), - overwrite = FALSE, - verbose = TRUE -) -} -\arguments{ -\item{branch_url}{Address of the branch or tag} - -\item{dest_dir}{Directory path where to store files} - -\item{file_name}{File name(s) -or keyword "all" for both files (default)} - -\item{ids}{Connection identifiers to the subversion server} - -\item{overwrite}{Logical, TRUE for overwriting files, FALSE otherwise} - -\item{verbose}{TRUE to display warnings (default), FALSE otherwise} -} -\description{ -Downloading inputs and/or outputs csv files from a repository branch/tag -} -\examples{ -\dontrun{ -SticsRFiles:::download_csv_files( - branch_url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", - dest_dir = system.file("extdata", package = "SticsRFiles") -) -} -} -\keyword{internal} diff --git a/man/download_data.Rd b/man/download_data.Rd index 89ed15d5..5fc5845f 100644 --- a/man/download_data.Rd +++ b/man/download_data.Rd @@ -35,7 +35,6 @@ Download locally the example data from the organisation. } \examples{ -\dontrun{ # Getting all data download_data() @@ -44,5 +43,5 @@ download_data(example_dirs = "study_case_1") # Getting data for a given example : study_case_1 and a given version download_data(example_dirs = "study_case_1", stics_version = "V9.0") -} + } diff --git a/man/download_usm_csv.Rd b/man/download_usm_csv.Rd index 202858e5..48fc903a 100644 --- a/man/download_usm_csv.Rd +++ b/man/download_usm_csv.Rd @@ -47,8 +47,6 @@ usms.xml input file from parameters values stored in a CSV file using the function \code{\link{gen_usms_xml}} } \examples{ -\dontrun{ -download_usm_csv(out_dir = "/path/to/destination/dir") -} +download_usm_csv(out_dir = tempdir()) } diff --git a/man/download_usm_xl.Rd b/man/download_usm_xl.Rd index 7b736fdb..22624cae 100644 --- a/man/download_usm_xl.Rd +++ b/man/download_usm_xl.Rd @@ -54,9 +54,8 @@ values to insert into XML files, with the help of these functions: \code{\link{gen_usms_xml}}, \code{\link{gen_ini_xml}} } \examples{ -\dontrun{ + download_usm_xl() -download_usm_xl(out_dir = "/path/to/destination/dir") -} + } diff --git a/man/exist_param_csv.Rd b/man/exist_param_csv.Rd deleted file mode 100644 index f14efa7e..00000000 --- a/man/exist_param_csv.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/exist_param_xml.R -\name{exist_param_csv} -\alias{exist_param_csv} -\title{Checking existing parameters names in csv input files} -\usage{ -exist_param_csv(param, javastics) -} -\arguments{ -\item{param}{Parameter name or a vector of} - -\item{javastics}{Path of JavaSTICS} -} -\value{ -A named logical vector of existing parameters, with -real parameters names -} -\description{ -Checking existing parameters names in csv input files -} -\examples{ -\dontrun{ - -exist_param_csv( - param = "albedo", - javastics = "/path/to/JavaSTICS/folder" -) - -exist_param_csv( - param = c("albedo", "latitude"), - javastics = "/path/to/JavaSTICS/folder" -) -} - -} -\keyword{internal} diff --git a/man/exist_param_xml.Rd b/man/exist_param_xml.Rd deleted file mode 100644 index b0a6125b..00000000 --- a/man/exist_param_xml.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/exist_param_xml.R -\name{exist_param_xml} -\alias{exist_param_xml} -\title{Checking existing parameters names in XML files} -\usage{ -exist_param_xml(param, stics_version = "latest") -} -\arguments{ -\item{param}{Parameter name or a vector of} - -\item{stics_version}{An optional version name as listed in -get_stics_versions_compat() return} -} -\value{ -A logical vector of existing parameters -} -\description{ -Checking existing parameters names in XML files -} -\examples{ -\dontrun{ - -exist_param_xml(param = "albedo") - -exist_param_xml(param = "albedo", stics_version = "V9.0") - -exist_param_xml(param = c("albedo", "latitude", "humcapil")) - -exist_param_xml(param = c("albedo", "latitude", "humcapi")) -} - -} -\keyword{internal} diff --git a/man/exists_javastics_path.Rd b/man/exists_javastics_path.Rd deleted file mode 100644 index 39bbea1a..00000000 --- a/man/exists_javastics_path.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_path.R -\name{exists_javastics_path} -\alias{exists_javastics_path} -\title{Evaluates if a \code{javastics_path} environment variable exists} -\usage{ -exists_javastics_path() -} -\value{ -boolean, TRUE if the variable exists, FALSE otherwise. -A \code{path} attribute is added to the object \code{path} containing -the variable content. -} -\description{ -Evaluates if a \code{javastics_path} environment variable exists -} -\keyword{internal} diff --git a/man/exists_javastics_pref.Rd b/man/exists_javastics_pref.Rd deleted file mode 100644 index d814843d..00000000 --- a/man/exists_javastics_pref.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/exists_javastics_pref.R -\name{exists_javastics_pref} -\alias{exists_javastics_pref} -\title{Evaluate if model preferences have been set} -\usage{ -exists_javastics_pref(javastics) -} -\arguments{ -\item{javastics}{JavaSTICS installation folder} -} -\value{ -logical value, TRUE if file exists, FALSE otherwise -} -\description{ -Testing if preferences.xml file exist in JavaSTICS -installation folder -} -\examples{ -\dontrun{ -exists_pref <- exists_javastics_pref("/path/to/JavaSTICS/folder") -} - -} -\keyword{internal} diff --git a/man/exists_param.Rd b/man/exists_param.Rd deleted file mode 100644 index 181f6c43..00000000 --- a/man/exists_param.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/exists_param.R -\name{exists_param} -\alias{exists_param} -\title{Test if a parameter exists} -\usage{ -exists_param(xml_doc_object, param_name, ...) -} -\arguments{ -\item{xml_doc_object}{XML document} - -\item{param_name}{The parameter name or a vector of} - -\item{...}{Other parameters to pass to \code{\link[=get_param_number]{get_param_number()}}.} -} -\value{ -A vector of logical values -} -\description{ -Test if a parameter exists in an XML file -} -\examples{ -xml_sols <- file.path(get_examples_path(file_type = "xml"), "sols.xml") - -xml_doc <- SticsRFiles:::xmldocument(xml_sols) - -SticsRFiles:::exists_param(xml_doc, "cfes") -SticsRFiles:::exists_param(xml_doc, c("cfes", "mulchbat")) -} -\keyword{internal} diff --git a/man/expand_stics_names.Rd b/man/expand_stics_names.Rd deleted file mode 100644 index 9c104d81..00000000 --- a/man/expand_stics_names.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expand_stics_names.R -\name{expand_stics_names} -\alias{expand_stics_names} -\title{Expand STICS names from parameters/variables simple names, -with indices (i.e. par(1), par(2),...regarding to parameter/variable -dimensions)} -\usage{ -expand_stics_names(in_csv_file, out_csv_file, header_vec = NULL) -} -\arguments{ -\item{in_csv_file}{Input csv file path} - -\item{out_csv_file}{Output csv file path} - -\item{header_vec}{An optional header vector} -} -\description{ -Expand STICS names from parameters/variables simple names, -with indices (i.e. par(1), par(2),...regarding to parameter/variable -dimensions) -} -\examples{ -\dontrun{ - -csv_file <- "/path/to/JavaSTICS/folder/config/inputs.csv" -out_csv_file <- "/path/to/out/dir/config/inputs_xpanded.csv" - -SticsRFiles:::expand_stics_names(csv_file, out_csv_file) -} - -} -\keyword{internal} diff --git a/man/find_names.Rd b/man/find_names.Rd deleted file mode 100644 index a9b9f72f..00000000 --- a/man/find_names.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/find_names.R -\name{find_names} -\alias{find_names} -\title{Finding strings in a character vector using exact or partial search} -\usage{ -find_names(names, name, exact = FALSE) -} -\arguments{ -\item{names}{Character vector} - -\item{name}{Character vector to use as partial or exact search in names} - -\item{exact}{logical, TRUE to find exact names, FALSE otherwise (default)} -} -\value{ -Character vector of founds strings -} -\description{ -Finding strings in a character vector using exact or partial search -} -\examples{ - -names <- c("abscission", "alphaphot", "codelaitr", "dlaimax", "lai") - -SticsRFiles:::find_names(names, "lai") - -#> [1] "codelaitr" "dlaimax" - -SticsRFiles:::find_names(names, "lai", exact = TRUE) - -#> [1] "lai" -} -\keyword{internal} diff --git a/man/fix_missing_bounds.Rd b/man/fix_missing_bounds.Rd deleted file mode 100644 index a01ac774..00000000 --- a/man/fix_missing_bounds.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_bounds.R -\name{fix_missing_bounds} -\alias{fix_missing_bounds} -\title{Setting bounds values (min, max) for missing bounds and/or -naming bounds values vector with bounds names} -\usage{ -fix_missing_bounds(values, bounds_name) -} -\arguments{ -\item{values}{Vector of bounds values (may be NULL or empty value)} - -\item{bounds_name}{Character vector of bounds names (in "min", "max" -one of them or both)} -} -\value{ -A named vector for bound(s) -} -\description{ -Setting bounds values (min, max) for missing bounds and/or -naming bounds values vector with bounds names -} -\keyword{internal} diff --git a/man/force_param_values.Rd b/man/force_param_values.Rd index 86fcf95d..e336362c 100644 --- a/man/force_param_values.Rd +++ b/man/force_param_values.Rd @@ -50,7 +50,7 @@ not any parameter will be forced (all default values used). example_txt_dir <- get_examples_path(file_type = "txt") force_param_values(example_txt_dir, setNames(object = c(220, 330), c("stlevamf", "stamflax")), - javastics = "/path/to/JavaSTICS/folder" + javastics = "/path/to/javastics" ) } diff --git a/man/gen_climate.Rd b/man/gen_climate.Rd deleted file mode 100644 index 4ae78e64..00000000 --- a/man/gen_climate.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_climate.R -\name{gen_climate} -\alias{gen_climate} -\title{Generating the STICS climat.txt file} -\usage{ -gen_climate(files_path, out_dir) -} -\arguments{ -\item{files_path}{Vector of 1 or 2 weather data files} - -\item{out_dir}{output directory path} -} -\value{ -a generation success status (TRUE/FALSE) -} -\description{ -Generating the STICS climat.txt file -} -\details{ -If 2 files are given, the file list is completed if the years -are not consecutive using the complete_climate_paths function -(for a multi-years data set) -} -\examples{ -\dontrun{ -SticsRFiles:::gen_climate( - c("path/to/weather.year1", "path/to/weather.year2"), - "/path/to/out/dir" ) -} - -} -\keyword{internal} diff --git a/man/gen_ini_doc.Rd b/man/gen_ini_doc.Rd deleted file mode 100644 index a49adc67..00000000 --- a/man/gen_ini_doc.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_ini_doc.R -\name{gen_ini_doc} -\alias{gen_ini_doc} -\title{Generates from a template a STICS ini xml_document} -\usage{ -gen_ini_doc( - xml_doc = NULL, - param_table = NULL, - crop_tag = "Crop", - params_desc = NULL, - stics_version = "latest", - check_names = TRUE -) -} -\arguments{ -\item{xml_doc}{an optional xml_document object (created from an ini file)} - -\item{param_table}{a table (df, tibble) containing parameters to use -(optional)} - -\item{crop_tag}{a crop identifier for crop parameters -(for example like "crop" used for in a parameter suffix : -param_crop1, param_crop2)} - -\item{params_desc}{a list describing crop parameters and others} - -\item{stics_version}{the STICS files version to use (optional, -default to latest). Only used if xml_doc = NULL.} - -\item{check_names}{logical for checking names of param_table columns or not} -} -\value{ -an invisible xml_document object or a list of -} -\description{ -Generates from a template a STICS ini xml_document -} -\examples{ -\dontrun{ -library(readxl) - -xl_path <- "inputs_stics_example.xlsx" -download_usm_xl(file = xl_path) -ini_param_df <- read_excel(xl_path, sheet = "Ini") -ini_doc <- SticsRFiles:::gen_ini_doc(param_table = ini_param_df) -} - -} -\keyword{internal} diff --git a/man/gen_ini_xml.Rd b/man/gen_ini_xml.Rd index 77ff0b92..672141b1 100644 --- a/man/gen_ini_xml.Rd +++ b/man/gen_ini_xml.Rd @@ -5,9 +5,9 @@ \title{Generate STICS ini xml file(s) from a template or an input file} \usage{ gen_ini_xml( - param_df = NULL, + param_df, file = NULL, - out_dir = getwd(), + out_dir, crop_tag = "Crop", stics_version = "latest", ini_in_file = lifecycle::deprecated(), @@ -77,16 +77,14 @@ to be detected (as shown in the table extract above). If not given (the default, \code{NULL}), the function returns the template as is. } \examples{ -\dontrun{ library(readxl) -xl_path <- "inputs_stics_example.xlsx" -download_usm_xl(file = xl_path) +xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") + ini_param_df <- read_excel(xl_path, sheet = "Ini") gen_ini_xml( - out_dir = "/path/to/dest/dir", + out_dir = tempdir(), param_table = ini_param_df ) -} } diff --git a/man/gen_new_travail.Rd b/man/gen_new_travail.Rd deleted file mode 100644 index 9c785fbf..00000000 --- a/man/gen_new_travail.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_new_travail.R -\name{gen_new_travail} -\alias{gen_new_travail} -\title{Generates a \code{new_travail.usm} file from usm XML files content and some -switch parameters for lai forcing, parameters forcing and usm chaining.} -\usage{ -gen_new_travail( - workspace, - usm, - lai_forcing = 0, - codesuite = 0, - codoptim = 0, - out_dir = getwd() -) -} -\arguments{ -\item{workspace}{Path of the directory containing the usm XML files} - -\item{usm}{Usm name} - -\item{lai_forcing}{1, if \code{lai} is to be read from a daily lai, 0 otherwise -input file.} - -\item{codesuite}{1, if the usm is to be chained with the previous -simulated (for getting system state variables), 0 otherwise -input file.} - -\item{codoptim}{1, if parameters are to be read from a \code{param.sti} file -(containing parameters values to be forced), 0 otherwise} - -\item{out_dir}{Directory path where to store the \code{new_travail.usm} file.} -} -\description{ -Generates a \code{new_travail.usm} file from usm XML files content and some -switch parameters for lai forcing, parameters forcing and usm chaining. -} -\keyword{internal} diff --git a/man/gen_obs.Rd b/man/gen_obs.Rd index 7ded0154..8689ee0b 100644 --- a/man/gen_obs.Rd +++ b/man/gen_obs.Rd @@ -6,7 +6,7 @@ \usage{ gen_obs( df, - out_dir = getwd(), + out_dir, usms_list = NULL, obs_table = lifecycle::deprecated(), out_path = lifecycle::deprecated() @@ -55,11 +55,8 @@ files names searching a variable name. } \examples{ -\dontrun{ - xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") obs_df <- read_params_table(file = xl_path, sheet_name = "Obs") gen_obs(df = obs_df, out_dir = "/path/to/dest/dir") -} } diff --git a/man/gen_obs_.Rd b/man/gen_obs_.Rd deleted file mode 100644 index 81bb2278..00000000 --- a/man/gen_obs_.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_obs.R -\name{gen_obs_} -\alias{gen_obs_} -\title{Write STICS obs data from data.frame} -\usage{ -gen_obs_(obs_table, file_path) -} -\arguments{ -\item{obs_table}{data.frame to write} - -\item{file_path}{Path to the file to write to} -} -\value{ -A logical value if the file generation succeeded (TRUE) -or not (FALSE) -} -\description{ -Write STICS obs data from data.frame/tibble -} -\examples{ -\dontrun{ -# Getting observations data -xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") - -# Loading and filtering data for usm "USM_2017_T1_CI" -obs_df <- read_params_table(file = xl_path, sheet_name = "Obs") \%>\% - dplyr::filter(usm_name \%in\% "USM_2017_T1_CI") - -# Generating the csv file -gen_obs_(obs_df, "USM_2017_T1_CI.obs") -} - -} -\keyword{internal} diff --git a/man/gen_paramsti.Rd b/man/gen_paramsti.Rd deleted file mode 100644 index edcc4311..00000000 --- a/man/gen_paramsti.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_paramsti.R -\name{gen_paramsti} -\alias{gen_paramsti} -\title{Generating a param.sti type file} -\usage{ -gen_paramsti(workspace, par_names, par_values, file_name = "param.sti") -} -\arguments{ -\item{workspace}{STICS or JavaSTICS workspace path} - -\item{par_names}{vector of parameters names} - -\item{par_values}{vector of parameters values} - -\item{file_name}{file name to generate (default value: param.sti)} -} -\value{ -A logical status TRUE if successful, FALSE otherwise -} -\description{ -Generating a parameters forcing file from parameters names -and parameters values vectors -} -\examples{ -\dontrun{ -gen_paramsti(".", c("par1", "par2"), c(1, 2)) -gen_paramsti("/path/to/stics/workspace", c("par1", "par2"), c(1, 2)) -} - -} -\keyword{internal} diff --git a/man/gen_sols_xml.Rd b/man/gen_sols_xml.Rd index 552cda5e..accb55b6 100644 --- a/man/gen_sols_xml.Rd +++ b/man/gen_sols_xml.Rd @@ -5,8 +5,8 @@ \title{Generate STICS sols xml file from a template or an input file} \usage{ gen_sols_xml( - file = file.path(getwd(), "sols.xml"), - param_df = NULL, + file, + param_df, template = NULL, stics_version = "latest", sols_in_file = lifecycle::deprecated(), @@ -79,11 +79,11 @@ a prefix to be detected (as shown in the table extract above). If not given (the default, \code{NULL}), the function returns the template as is. } \examples{ -\dontrun{ xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") + sols_param_df <- read_params_table(file = xl_path, sheet_name = "Soils") -gen_sols_xml(file = "sols.xml", param_df = sols_param_df) -} +gen_sols_xml(file = file.path(tempdir(), "sols.xml"), +param_df = sols_param_df) } diff --git a/man/gen_sta_doc.Rd b/man/gen_sta_doc.Rd deleted file mode 100644 index cd1a3410..00000000 --- a/man/gen_sta_doc.Rd +++ /dev/null @@ -1,42 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_sta_doc.R -\name{gen_sta_doc} -\alias{gen_sta_doc} -\title{Generates from a template a STICS sta xml_document} -\usage{ -gen_sta_doc( - xml_doc = NULL, - param_table = NULL, - stics_version = "latest", - check_names = TRUE -) -} -\arguments{ -\item{xml_doc}{an optional xml_document object (created from an sta file)} - -\item{param_table}{a table (df, tibble) containing parameters to use -(optional)} - -\item{stics_version}{the STICS files version to use -(optional, default to latest). Only used if xml_doc = NULL.} - -\item{check_names}{logical for checking names of param_table columns or not} -} -\value{ -an invisible xml_document object or a list of -} -\description{ -Generates from a template a STICS sta xml_document -} -\examples{ -\dontrun{ -library(readxl) - -xl_path <- "inputs_stics_example.xlsx" -download_usm_xl(file = xl_path) -sta_param_df <- readxl::read_excel(xl_path, sheet = "Station") -sta_doc <- SticsRFiles:::gen_sta_doc(param_table = sta_param_df) -} - -} -\keyword{internal} diff --git a/man/gen_sta_xml.Rd b/man/gen_sta_xml.Rd index 2c6701e2..01c12f04 100644 --- a/man/gen_sta_xml.Rd +++ b/man/gen_sta_xml.Rd @@ -5,9 +5,9 @@ \title{Generate STICS sta xml file(s) from a template or an input file} \usage{ gen_sta_xml( - param_df = NULL, + param_df, file = NULL, - out_dir = getwd(), + out_dir, stics_version = "latest", param_table = lifecycle::deprecated(), sta_in_file = lifecycle::deprecated(), @@ -65,11 +65,8 @@ as a prefix to be detected (as shown in the table extract above). If not given (the default, \code{NULL}), the function returns the template as is. } \examples{ -\dontrun{ - xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") sta_param_df <- read_params_table(file = xl_path, sheet_name = "Station") -gen_sta_xml(out_dir = "/path/to/dest/dir", param_df = sta_param_df) -} +gen_sta_xml(out_dir = tempdir(), param_df = sta_param_df) } diff --git a/man/gen_tec_doc.Rd b/man/gen_tec_doc.Rd deleted file mode 100644 index 5c2adbd8..00000000 --- a/man/gen_tec_doc.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_tec_doc.R -\name{gen_tec_doc} -\alias{gen_tec_doc} -\title{Generate from a template or modify a STICS tec xml_document} -\usage{ -gen_tec_doc( - xml_doc = NULL, - param_table = NULL, - stics_version = "latest", - dict = NULL, - ... -) -} -\arguments{ -\item{xml_doc}{an xml_document object (created from an ini file)} - -\item{param_table}{a table (df, tibble) containing parameters to use} - -\item{stics_version}{the STICS files version to use (optional, -default to latest). Only used if xml_doc = NULL.} - -\item{dict}{List of correspondence between given parameter names and -STICS internal names.} - -\item{...}{Additional arguments (for example, coming from a call -from gen_tec_xml using a na_values argument)} -} -\value{ -an invisible xml_document object or a list of -} -\description{ -Generate from a template or modify a STICS tec xml_document -} -\examples{ -\dontrun{ -library(readxl) - -download_usm_xl( - file = "inputs_stics_example.xlsx", - dest_dir = "/path/to/dest/dir" -) -xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") -tec_param_df <- read_excel(xl_path, sheet = "Tec") -tec_doc <- SticsRFiles:::gen_tec_doc(param_table = tec_param_df) -} - -} -\keyword{internal} diff --git a/man/gen_tec_xml.Rd b/man/gen_tec_xml.Rd index ad675b04..23d2fe91 100644 --- a/man/gen_tec_xml.Rd +++ b/man/gen_tec_xml.Rd @@ -7,7 +7,7 @@ gen_tec_xml( param_df = NULL, file = NULL, - out_dir = getwd(), + out_dir, stics_version = "latest", na_values = NA, param_table = lifecycle::deprecated(), @@ -78,11 +78,8 @@ a prefix to be detected (as shown in the table extract above). If not given (the default, \code{NULL}), the function returns the template as is. } \examples{ -\dontrun{ - xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") tec_param_df <- read_params_table(file = xl_path, sheet_name = "Tec") -gen_tec_xml(out_dir = "/path/to/dest/dir", param_df = tec_param_df) -} +gen_tec_xml(out_dir = tempdir(), param_df = tec_param_df) } diff --git a/man/gen_usms_sols_doc.Rd b/man/gen_usms_sols_doc.Rd deleted file mode 100644 index de4c62c1..00000000 --- a/man/gen_usms_sols_doc.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gen_usms_sols_doc.R -\name{gen_usms_sols_doc} -\alias{gen_usms_sols_doc} -\title{Generate from a template or modify a STICS sols or usms xml_document} -\usage{ -gen_usms_sols_doc( - doc_type, - xml_doc = NULL, - nodes_nb = NULL, - nodes_param = NULL, - stics_version = "latest" -) -} -\arguments{ -\item{doc_type}{Document type} - -\item{xml_doc}{The xml document} - -\item{nodes_nb}{The number of nodes} - -\item{nodes_param}{Node parameter} - -\item{stics_version}{Version of the STICS model} -} -\value{ -An xml_document object -} -\description{ -Generate from a template or modify a STICS sols or usms xml_document -} -\examples{ -\dontrun{ -# A newly created one, with one or more usms and -# fake parameters values -xml_doc <- SticsRFiles:::gen_xml_doc(doc_type = "usms") -xml_doc <- SticsRFiles:::gen_xml_doc(doc_type = "usms", node_nb = 3) - -# With changing parameters values, from an existing document -# and a data.frame contaning usms parameters values -existing_doc <- SticsRFiles:::xmldocument("/path/to/usms.xml") - -out_xml_doc <- SticsRFiles:::gen_xml_doc( - doc_type = "usms", - xml_doc = existing_doc, nodes_param = param_data_frame -) -} - -} -\keyword{internal} diff --git a/man/gen_usms_xml.Rd b/man/gen_usms_xml.Rd index e4dec57f..e7ab93a5 100644 --- a/man/gen_usms_xml.Rd +++ b/man/gen_usms_xml.Rd @@ -5,7 +5,7 @@ \title{Generate STICS usms xml file from a template or an input file} \usage{ gen_usms_xml( - file = file.path(getwd(), "usms.xml"), + file, param_df = NULL, template = NULL, stics_version = "latest", @@ -16,8 +16,7 @@ gen_usms_xml( ) } \arguments{ -\item{file}{Path (including name) of the usms file to generate. Optional, -set to \code{file.path(getwd(), "usms.xml")}by default.} +\item{file}{Path (including name) of the usms file to generate.} \item{param_df}{A table (df, tibble) containing the values of the parameters to use (see details)} @@ -78,11 +77,9 @@ as a prefix to be detected (as shown in the table extract above). If not given (the default, \code{NULL}), the function returns the template as is. } \examples{ -\dontrun{ - xl_path <- download_usm_xl(file = "inputs_stics_example.xlsx") usms_param_df <- read_params_table(file = xl_path, sheet_name = "USMs") -gen_usms_xml(usms_out_file = "usms.xml", usms_param = usms_param_df) -} +gen_usms_xml(file = file.path(tempdir(), "usms.xml"), + param_df = usms_param_df) } diff --git a/man/gen_usms_xml2txt.Rd b/man/gen_usms_xml2txt.Rd index b659763e..e6644c1d 100644 --- a/man/gen_usms_xml2txt.Rd +++ b/man/gen_usms_xml2txt.Rd @@ -88,8 +88,6 @@ gen_usms_xml2txt(javastics, workspace) usm <- c("usm1", "usm2") gen_usms_xml2txt(javastics, workspace, usm) -# For one usm -gen_usms_xml2txt(javastics, workspace, dir_per_usm_flag = FALSE, "usm1") } } diff --git a/man/gen_varmod.Rd b/man/gen_varmod.Rd index 1fbd7ba9..f3e8a17f 100644 --- a/man/gen_varmod.Rd +++ b/man/gen_varmod.Rd @@ -52,12 +52,10 @@ the variables that exist. \code{force= TRUE} may however be used to write variables that do not exist. } \examples{ -\dontrun{ -gen_varmod(".", c("lai(n)", "hauteur")) -gen_varmod("/path/to/stics/workspace", c("lai(n)", "hauteur")) +gen_varmod(tempdir(), c("lai(n)", "hauteur")) # Add a variable to the others: -gen_varmod(".", "masec(n)", append = TRUE) +gen_varmod(tempdir(), "masec(n)", append = TRUE) # NB: var.mod will have "lai(n)","hauteur" and "masec(n)" -} + } diff --git a/man/get_climate_txt.Rd b/man/get_climate_txt.Rd index 58a74af3..ebee0645 100644 --- a/man/get_climate_txt.Rd +++ b/man/get_climate_txt.Rd @@ -5,7 +5,7 @@ \title{Read STICS input meteorology file} \usage{ get_climate_txt( - workspace = getwd(), + workspace, file_name = "climat.txt", preserve = TRUE, dirpath = lifecycle::deprecated(), @@ -38,7 +38,7 @@ The time-related variables are summarised into one POSIXct column named \code{date}. } \examples{ -library(SticsRFiles) path <- get_examples_path(file_type = "txt") Meteo <- get_climate_txt(path) + } diff --git a/man/get_daily_results.Rd b/man/get_daily_results.Rd deleted file mode 100644 index 2665f961..00000000 --- a/man/get_daily_results.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_sim.R -\name{get_daily_results} -\alias{get_daily_results} -\title{Load and format STICS daily output file(s)} -\usage{ -get_daily_results(...) -} -\description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} - -This function was deprecated because we realised that it's -a special case of the \code{\link[=get_sim]{get_sim()}} -} -\examples{ -\dontrun{ -get_daily_results(path, "banana") -# -> -get_sim(path, "banana") -} - -} -\keyword{internal} diff --git a/man/get_data_dir.Rd b/man/get_data_dir.Rd deleted file mode 100644 index e1bc9866..00000000 --- a/man/get_data_dir.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{get_data_dir} -\alias{get_data_dir} -\title{Getting package or library data path} -\usage{ -get_data_dir(location = "install") -} -\arguments{ -\item{location}{The destination where to remove information and data -"install" for removing things from the installed SticsRFiles library -(default), "package" for removing them from the package project (in RStudio)} -} -\value{ -A directory path -} -\description{ -Getting package or library data path -} -\examples{ -\dontrun{ -SticsRFiles:::get_data_dir() - -SticsRFiles:::get_data_dir(location = "package") -} -} -\keyword{internal} diff --git a/man/get_examples_path.Rd b/man/get_examples_path.Rd index 1f3aeb0e..145c14b2 100644 --- a/man/get_examples_path.Rd +++ b/man/get_examples_path.Rd @@ -7,6 +7,7 @@ get_examples_path( file_type, stics_version = "latest", + overwrite = FALSE, version_name = lifecycle::deprecated() ) } @@ -17,6 +18,8 @@ get_examples_path( \item{stics_version}{Name of the STICS version. Optional, by default the latest version returned by \code{get_stics_versions_compat()} is used.} +\item{overwrite}{TRUE for overwriting directory; FALSE otherwise} + \item{version_name}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} \code{version_name} is no longer supported, use \code{stics_version} instead.} } @@ -28,12 +31,10 @@ version or a vector of (for unknown file types "" is returned as path) Getting examples files path attached to a STICS version for a given file type } \examples{ -\dontrun{ - get_examples_path(file_type = "csv") get_examples_path(file_type = c("csv", "sti")) get_examples_path(file_type = "csv", stics_version = "V8.5") -} + } diff --git a/man/get_file.Rd b/man/get_file.Rd deleted file mode 100644 index 4072d1c3..00000000 --- a/man/get_file.Rd +++ /dev/null @@ -1,56 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_file.R -\name{get_file} -\alias{get_file} -\title{Read STICS observation or simulation files (.obs or mod_s)} -\usage{ -get_file( - workspace, - usm_name = NULL, - var_list = NULL, - dates_list = NULL, - usms_filepath = NULL, - javastics_path = NULL, - verbose = TRUE, - type = c("sim", "obs") -) -} -\arguments{ -\item{workspace}{Path of a JavaSTICS workspace, or a vector of.} - -\item{usm_name}{Vector of usms to read (optional, used to filter usms)} - -\item{var_list}{vector of output variables names to filter -(optional, see \code{get_var_info()} to get the names of the variables)} - -\item{dates_list}{list of dates to filter (optional, should be a POSIX date)} - -\item{usms_filepath}{Path of the usms file (optional)} - -\item{javastics_path}{JavaSTICS installation path (optional, needed if -the plant files are not in the \code{workspace} but rather in the JavaSTICS -default workspace). Only used to get the plants names.} - -\item{verbose}{Logical value (optional), TRUE to display information -on error, FALSE otherwise (default)} - -\item{type}{The type of file to read, either "obs" or "sim".} -} -\value{ -A named list of \code{data.frame}s with observations or simulation data. -The list elements are named after -the usms names. -} -\description{ -Read STICS observation or simulation files from a JavaSTICS -workspace and store data into a list per usm. -Used by \code{get_obs()} and \code{get_sim()}. Operate first computation and -then call \code{get_file_()}. -} -\details{ -The \code{.obs} files names should match USMs names, e.g. -for a usm called "banana", the \code{.obs} file should be named \code{banana.obs}. -For intercrops, the name should be suffixed by "p" for the principal -and "a" for the associated plant. -} -\keyword{internal} diff --git a/man/get_file_.Rd b/man/get_file_.Rd deleted file mode 100644 index 5ab22f6d..00000000 --- a/man/get_file_.Rd +++ /dev/null @@ -1,54 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_file.R -\name{get_file_} -\alias{get_file_} -\title{Read STICS observation or simulation files (.obs or mod_s)} -\usage{ -get_file_( - workspace = getwd(), - usm_name = NULL, - usms_filepath = NULL, - var_list = NULL, - dates_list = NULL, - javastics_path = NULL, - verbose = TRUE, - type = c("sim", "obs") -) -} -\arguments{ -\item{workspace}{Path of a JavaSTICS workspace} - -\item{usm_name}{Vector of usms to read (optional, used to filter usms)} - -\item{usms_filepath}{Path of the usms file (optional)} - -\item{var_list}{vector of output variables names to filter -(optional, see \code{get_var_info()} to get the names of the variables)} - -\item{dates_list}{list of dates to filter (optional, should be a POSIX date)} - -\item{javastics_path}{JavaSTICS installation path (optional, needed if -the plant files are not in the \code{workspace} but rather in the JavaSTICS -default workspace). Only used to get the plants names.} - -\item{verbose}{Logical value (optional), TRUE to display information -on error, FALSE otherwise (default)} - -\item{type}{The type of file to read, either "obs" or "sim".} -} -\value{ -A named list of \code{data.frame}s with observations or simulation data. -The list elements are named after the usms names. -} -\description{ -Read STICS observation or simulation files from a -JavaSTICS workspace and store data into a list per usm. -Used by \code{get_obs()} and \code{get_sim()}. -} -\details{ -The \code{.obs} files names should match USMs names, e.g. for a -usm called "banana", the \code{.obs} file should be named \code{banana.obs}. -For intercrops, the name should be suffixed by "p" for the principal -and "a" for the associated plant. -} -\keyword{internal} diff --git a/man/get_file_int.Rd b/man/get_file_int.Rd deleted file mode 100644 index 99cb6f21..00000000 --- a/man/get_file_int.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_file_int.R -\name{get_file_int} -\alias{get_file_int} -\title{Read STICS observation or simulation file (\emph{.obs or mod_s})} -\usage{ -get_file_int(workspace, filename, plant_name = NULL, verbose = TRUE) -} -\arguments{ -\item{workspace}{A directory where to read the files} - -\item{filename}{A vector of file names} - -\item{plant_name}{A vector of plant names. Length of filename, or recycled -if one (optional).} - -\item{verbose}{Logical value (optional), TRUE to display read file name, -FALSE otherwise (default)} -} -\value{ -A \code{data.frame} of all observation or simulation files concatenated -by row. -} -\description{ -Read STICS observation or simulation file(s). This function -is not exported because it only reads and pre-formats the file without any -clever tests for intercrops or usms. -} -\examples{ -\dontrun{ -path <- file.path(get_examples_path(file_type = "obs")) -get_file_int(path, "banana.obs") -} -} -\keyword{internal} diff --git a/man/get_file_one.Rd b/man/get_file_one.Rd deleted file mode 100644 index 7b1860fe..00000000 --- a/man/get_file_one.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_file.R -\name{get_file_one} -\alias{get_file_one} -\title{Get file for one workspace / file_name / plant_name} -\usage{ -get_file_one(dirpath, filename, p_name, verbose, dates_list, var_list) -} -\arguments{ -\item{dirpath}{Path of a JavaSTICS workspace} - -\item{filename}{File name(s)} - -\item{p_name}{Plant name(s)} - -\item{verbose}{Logical value (optional), TRUE to display information -on error, FALSE otherwise (default)} - -\item{dates_list}{list of dates to filter (optional, should be a POSIX date)} - -\item{var_list}{vector of output variables names to filter -(optional, see \code{get_var_info()} to get the names of the variables)} -} -\value{ -the obs or simulation output -} -\description{ -Get a simulation or observation file for one situation at a time, -for sole or intercrop -} -\keyword{internal} diff --git a/man/get_formalisms_xml.Rd b/man/get_formalisms_xml.Rd deleted file mode 100644 index 4b08f327..00000000 --- a/man/get_formalisms_xml.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_formalisms_xml.R -\name{get_formalisms_xml} -\alias{get_formalisms_xml} -\title{Get the formalism(s) parameters from a file or a list of} -\usage{ -get_formalisms_xml(xml_file, par_name = NULL, by_form = TRUE) -} -\arguments{ -\item{xml_file}{an xml file path or a vector of paths} - -\item{par_name}{Optional. A parameter name or a vector of. If not provided, -all the parameters are extracted.} - -\item{by_form}{Logical. Structuring parameters by formalism (TRUE), -or not (structuring output by parameter) for each file} -} -\value{ -A list (by file) of list of parameters names by formalism name -} -\description{ -Get the formalism(s) parameters from a file or a list of -} -\examples{ -\dontrun{ - -xml_sta <- file.path(get_examples_path(file_type = "xml"), "file_sta.xml") - -par_form <- get_formalisms_xml(xml_sta, "zr") - -par_form_list <- get_formalisms_xml(xml_sta, c("zr", "altistation")) - -par_form_list <- get_formalisms_xml(xml_sta) -} - -} -\keyword{internal} diff --git a/man/get_java_version.Rd b/man/get_java_version.Rd deleted file mode 100644 index 410260cc..00000000 --- a/man/get_java_version.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_cmd_util.R -\name{get_java_version} -\alias{get_java_version} -\title{Getting the java virtual machine version} -\usage{ -get_java_version(java_cmd = "java") -} -\arguments{ -\item{java_cmd}{Name or path of the java virtual machine executable} -} -\value{ -A numerical version, with a string version as "version" attribute -} -\description{ -For Unix like systems, the system java virtual machine needs to -be detected for compatibility checking -} -\examples{ -\dontrun{ -get_java_version(java_cmd = "java") -get_java_version(java_cmd = "/path/to/java") -} - -} -\keyword{internal} diff --git a/man/get_java_workspace.Rd b/man/get_java_workspace.Rd deleted file mode 100644 index 87f9b7c9..00000000 --- a/man/get_java_workspace.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_java_workspace.R -\name{get_java_workspace} -\alias{get_java_workspace} -\title{Getting current workspace in JavaSTICS preferences configuration} -\usage{ -get_java_workspace(javastics) -} -\arguments{ -\item{javastics}{JavaSTICS installation root folder} -} -\description{ -Getting current JavaSTICS working directory, -if not any setting to \code{example} directory -} -\examples{ -\dontrun{ -get_java_workspace("/path/to/JavaSTICS/folder") -} - -} -\keyword{internal} diff --git a/man/get_javastics_cmd.Rd b/man/get_javastics_cmd.Rd deleted file mode 100644 index b062372a..00000000 --- a/man/get_javastics_cmd.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_cmd_util.R -\name{get_javastics_cmd} -\alias{get_javastics_cmd} -\title{Get JavaSTICS command line strings} -\usage{ -get_javastics_cmd( - javastics, - java_cmd = "java", - type = c("generate", "run"), - workspace = NULL, - verbose = TRUE -) -} -\arguments{ -\item{javastics}{JavaSTICS installation root folder} - -\item{java_cmd}{Name or path of the java virtual machine executable -(optional)} - -\item{type}{keywords for filtering in the returned list what kind of command -to be generated (default both: "generate" and "run")} - -\item{workspace}{A JavaSTICS workspace path (optional)} - -\item{verbose}{Logical value (optional), TRUE to display run information, -FALSE otherwise (default)} -} -\value{ -A named list with fields : command (java command/path), cmd_generate -and/or cmd_run that are to be used as args in the system2 function call. -} -\description{ -From a JavaSTICS path, constructing command lines for -files generation from XML and/or running simulation through -a system2 command execution -} -\details{ -According to a JavaSTICS version (i.e. javastics path content) and -the OS type, the function builds command line strings used from system2 -calls. Commands may be filtered using type argument. -} -\examples{ -\dontrun{ -get_javastics_cmd( - javastics = "/path/to/JavaSTICS/folder", , - workspace = "path/to/workspace" -) -} - -} -\keyword{internal} diff --git a/man/get_javastics_path.Rd b/man/get_javastics_path.Rd deleted file mode 100644 index 41c30395..00000000 --- a/man/get_javastics_path.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_path.R -\name{get_javastics_path} -\alias{get_javastics_path} -\title{Getting JavaSTICS path from javastics_path environment variable} -\usage{ -get_javastics_path() -} -\value{ -Path of the JavaSTICS root directory if javastics_path -environment variable exists -} -\description{ -Getting JavaSTICS path from javastics_path environment variable -} -\keyword{internal} diff --git a/man/get_lai_forcing.Rd b/man/get_lai_forcing.Rd index 9102cf09..09b85cca 100644 --- a/man/get_lai_forcing.Rd +++ b/man/get_lai_forcing.Rd @@ -23,13 +23,11 @@ Use \code{get_usms_list()} to get the list of the usm names for an usms.xml file. } \examples{ -\dontrun{ - # Xml case xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") get_lai_forcing(xml_usms) get_lai_forcing(xml_usms, "wheat") get_lai_forcing(xml_usms, c("wheat", "intercrop_pea_barley")) -} + } diff --git a/man/get_lai_forcing_xml.Rd b/man/get_lai_forcing_xml.Rd deleted file mode 100644 index dc8a2ebc..00000000 --- a/man/get_lai_forcing_xml.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_lai_forcing.R -\name{get_lai_forcing_xml} -\alias{get_lai_forcing_xml} -\title{Is LAI forced ? plants number per usm, all or selected from -a given list} -\usage{ -get_lai_forcing_xml(usm_xml_path, usms_list = c()) -} -\arguments{ -\item{usm_xml_path}{Path to usms.xml file} - -\item{usms_list}{Usms to filter (optional, see details)} -} -\value{ -A names numeric vector of a boolean value for each usm -} -\description{ -Is the lai forced in usms from a usms.xml file -} -\details{ -Use \code{get_usms_list()} to get the list of the usm names. -} -\keyword{internal} diff --git a/man/get_name_value_file_value.Rd b/man/get_name_value_file_value.Rd deleted file mode 100644 index 5856b121..00000000 --- a/man/get_name_value_file_value.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_name_value_file_value.R -\name{get_name_value_file_value} -\alias{get_name_value_file_value} -\title{Getting parameters values from a STICS text file with name/value on -following lines} -\usage{ -get_name_value_file_value(file_path, param_names, names_dict = NULL) -} -\arguments{ -\item{file_path}{STICS text file path} - -\item{param_names}{vector of parameters names} - -\item{names_dict}{List of correspondence between parameter names -given and files intern names} -} -\value{ -A vector of parameters values -} -\description{ -Getting parameters values from a STICS text file with name/value on -following lines -} -\keyword{internal} diff --git a/man/get_obs.Rd b/man/get_obs.Rd index af068cd5..28207274 100644 --- a/man/get_obs.Rd +++ b/man/get_obs.Rd @@ -90,15 +90,16 @@ If \code{usms_file} is not specified, the plants are named "plant_1" by default (+ "plant_2" for intercrops). } \examples{ -\dontrun{ + path <- file.path(get_examples_path(file_type = "obs"), "mixed") # Get observations for all usms, but only banana has observations: Meas <- get_obs(path) + # Get observations only for banana: Meas_banana <- get_obs(path, "banana") - +\dontrun{ # Get observations with real plant names when plant # folder is not in the workspace: get_obs(path, "banana", javastics = "/path/to/JavaSTICS/folder") diff --git a/man/get_obs_txt.Rd b/man/get_obs_txt.Rd deleted file mode 100644 index 7307d92f..00000000 --- a/man/get_obs_txt.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_obs_txt.R -\name{get_obs_txt} -\alias{get_obs_txt} -\title{Read STICS observation file (*.obs) in the context of txt files} -\usage{ -get_obs_txt(dirpath = getwd(), filename = NULL, mixed = NULL) -} -\arguments{ -\item{dirpath}{Directory path} - -\item{filename}{A vector of observation file name(s). Optional, see details.} - -\item{mixed}{(optional) Is the simulation on mixed species (boolean)} -} -\value{ -A data.frame of the STICS-formatted observations. -Return is \code{NULL} if no files were found, -or more files than usable. If mixed crops (two \code{filename} provided), -the function binds them and add a new column called "Plant" -which corresponds to the name of each observation file. -} -\description{ -Read STICS observation file(s) for sole and/or mixed crops. -} -\details{ -If \code{filename} is not specified (or equal to \code{NULL}), -the function tries first to match the \code{mod_s*} names for -the same \*.obs names, and then to use the \code{.obs} file if there -is one only (used for sole crops or for both mixed crops). -If there are no .obs files, or two but not specified for reading, -the function returns \code{NULL} -If \code{mixed} is not specified (or equal to \code{NULL}), -the function tries to read the number of species from the -input files. -} -\examples{ -\dontrun{ - -obs_table <- SticsRFiles:::get_obs_txt() -} - -} -\keyword{internal} diff --git a/man/get_option_choice_param_values.Rd b/man/get_option_choice_param_values.Rd deleted file mode 100644 index e0791d08..00000000 --- a/man/get_option_choice_param_values.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_option_choice_param_values.R -\name{get_option_choice_param_values} -\alias{get_option_choice_param_values} -\title{Getting parameter values from an xml parameter file for an -option choice} -\usage{ -get_option_choice_param_values( - xml_file_path, - option_param_name, - choice_name_or_code -) -} -\arguments{ -\item{xml_file_path}{path of xml parameter file} - -\item{option_param_name}{name of the option} - -\item{choice_name_or_code}{name or code of the option choice desired} -} -\value{ -A list containing a vector of strings of parameters values ($values) -and a vector of strings of parameters names ($names) -} -\description{ -Extracting parameter values from an XML file, corresponding -to parameters -defined in a option choice node (as \emph{param} nodes) -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") - -get_option_choice_param_values(xml_path, "codetemp", "2") -} - -} -\keyword{internal} diff --git a/man/get_options_choices.Rd b/man/get_options_choices.Rd deleted file mode 100644 index 4ad3198a..00000000 --- a/man/get_options_choices.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_options_choices.R -\name{get_options_choices} -\alias{get_options_choices} -\title{Getting options parameter choices from an xml parameter file} -\usage{ -get_options_choices(xml_file_path, options_names = NULL) -} -\arguments{ -\item{xml_file_path}{path of xml parameter file} - -\item{options_names}{options names to take into account (optional)} -} -\value{ -A list of strings of options choice values -} -\description{ -Extracting options choices values from an xml file data -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") - -# For getting all options choices -SticsRFiles:::get_options_choices(xml_path) - -# For getting one option choices or more -SticsRFiles:::get_options_choices(xml_path, "codetemp") -SticsRFiles:::get_options_choices(xml_path, c("codegdh", "codetemp")) -} - -} -\keyword{internal} diff --git a/man/get_options_names.Rd b/man/get_options_names.Rd deleted file mode 100644 index 126b2b85..00000000 --- a/man/get_options_names.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_options_names.R -\name{get_options_names} -\alias{get_options_names} -\title{Getting options parameter names from an xml parameter file} -\usage{ -get_options_names(xml_file_path, option_names = NULL) -} -\arguments{ -\item{xml_file_path}{path of xml parameter file} - -\item{option_names}{options names vector (optional)} -} -\value{ -A vector of strings of options parameter names -} -\description{ -Extracting options parameter name from an xml file data, -and checking names if provided in options_names -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") - -SticsRFiles:::get_options_names(xml_path) - -SticsRFiles:::get_options_names(xml_path, c("codemonocot", "codlainet")) -} - -} -\keyword{internal} diff --git a/man/get_param_bounds.Rd b/man/get_param_bounds.Rd deleted file mode 100644 index b45824ec..00000000 --- a/man/get_param_bounds.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_bounds.R -\name{get_param_bounds} -\alias{get_param_bounds} -\title{Getting parameters bounds from an xml_document object} -\usage{ -get_param_bounds( - xml_doc, - param_name, - bounds_name = NULL, - output = "data.frame" -) -} -\arguments{ -\item{xml_doc}{an xml_document class object} - -\item{param_name}{a parameter name of a vector of parameters names} - -\item{bounds_name}{bounds name "min" or "max" -(optional, default value c("min","max ))} - -\item{output}{Output data format either "list" or "data.frame" (default)} -} -\value{ -A data.frame with the name of the parameter and min, max values or -one of them. Or a named list (with parameter name) containing a named vector -for bounds. -} -\description{ -Extracting parameters min and/or max bounds for a parameter -or a vector of parameters from an xml_document class object. -} -\examples{ -\dontrun{ -xml_sta <- file.path(get_examples_path(file_type = "xml"), "file_sta.xml") - -sta_doc <- SticsRFiles:::xmldocument(xml_sta) - -par_bounds <- SticsRFiles:::get_param_bounds(sta_doc, "zr") - -par_bounds_list <- SticsRFiles:::get_param_bounds(sta_doc, - c("zr", "altistation")) - - -SticsRFiles:::get_param_bounds(sta_doc, c("zr", "altistation"), "min") -} - -} -\keyword{internal} diff --git a/man/get_param_bounds_xml.Rd b/man/get_param_bounds_xml.Rd deleted file mode 100644 index 41fd624a..00000000 --- a/man/get_param_bounds_xml.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_bounds_xml.R -\name{get_param_bounds_xml} -\alias{get_param_bounds_xml} -\title{Getting parameters bounds from xml files} -\usage{ -get_param_bounds_xml( - xml_file, - param_name, - bounds_name = NULL, - output = "data.frame" -) -} -\arguments{ -\item{xml_file}{an xml file path or a vector of paths} - -\item{param_name}{a parameter name of a vector of parameters names} - -\item{bounds_name}{bounds name "min" or "max" -(optional, default value c("min","max ))} - -\item{output}{Output data format either "list" or "data.frame" (default)} -} -\value{ -A list of parameters bounds values -} -\description{ -Extracting parameters min and/or max bounds for a parameter -or a vector of parameters from a file or a vector of xml files. -} -\examples{ -\dontrun{ -library(SticsRFiles) -xml_file <- "path/to/xmlfile" -xml_files_list <- c("path/to/xmlfile1", "path/to/xmlfile2") -param_bounds <- get_param_bounds_xml(xml_file, "param", "min") - -param_bounds <- get_param_bounds_xml(xml_file, c("param1", "param2"), "max") - -param_bounds <- get_param_bounds_xml(xml_file, c("param1", "param2")) - -param_bounds <- get_param_bounds_xml(xml_files_list, "param", "min") -} - -} -\keyword{internal} diff --git a/man/get_param_data_df.Rd b/man/get_param_data_df.Rd deleted file mode 100644 index e48923f8..00000000 --- a/man/get_param_data_df.Rd +++ /dev/null @@ -1,67 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_info.R -\name{get_param_data_df} -\alias{get_param_data_df} -\title{Getting parameters information using partial search words} -\usage{ -get_param_data_df( - param = NULL, - file = NULL, - stics_version = "latest", - kind = "all", - exact = FALSE -) -} -\arguments{ -\item{param}{Optional name or partial name or a vector of} - -\item{file}{Optional, xml file path or a vector of} - -\item{stics_version}{An optional version name as listed in -get_stics_versions_compat() return} - -\item{kind}{Kind of information to be retrieved for parameters -among "parameter", "formalism" or "all" for both of them} - -\item{exact}{Logical, if TRUE, the exact name is searched} -} -\value{ -A data.frame containing parameters names and -their origin (file name), and their bounds or the formalism they belong to, -or both of them. -} -\description{ -Getting parameters information using partial search words -} -\details{ -If not any name vector of names, information are extracted for -all the existing parameters -} -\examples{ -\dontrun{ - -get_param_data_df(param = "albedo") - -get_param_data_df(param = "albedo", file = "/path/to/file.xml") - -get_param_data_df(param = "albedo", kind = "formalism") - -get_param_data_df(param = "albedo", stics_version = "V9.0") - -get_param_data_df(param = c("albedo", "latitude", "humcapil")) - -get_param_data_df( - param = c("albedo", "latitude", "humcapil"), - kind = "formalism" -) - -get_param_data_df(file = "/path/to/JavaSTICS/folder/config/inputs.csv") - -get_param_data_df( - param = "albedo", - file = "/path/to/JavaSTICS/folder/config/inputs.csv" -) -} - -} -\keyword{internal} diff --git a/man/get_param_desc.Rd b/man/get_param_desc.Rd deleted file mode 100644 index 635469cc..00000000 --- a/man/get_param_desc.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_desc.R -\name{get_param_desc} -\alias{get_param_desc} -\title{Getting parameters description} -\usage{ -get_param_desc( - file_path = NULL, - stics_version = "latest", - name = NULL, - kind = FALSE -) -} -\arguments{ -\item{file_path}{csv file path} - -\item{stics_version}{The STICS version. See \code{get_stics_versions_compat()} -to get all compatible versions. Default -to "latest", a special code to get the latest version.} - -\item{name}{a name vector for selecting loaded content using -name column matching} - -\item{kind}{a name vector for selecting loaded content using -kind column matching} -} -\description{ -Getting parameters description -} -\keyword{internal} diff --git a/man/get_param_formalisms.Rd b/man/get_param_formalisms.Rd deleted file mode 100644 index 648c6aa9..00000000 --- a/man/get_param_formalisms.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_formalisms.R -\name{get_param_formalisms} -\alias{get_param_formalisms} -\title{Get the "formalisme" node "@nom" attribute value of a -(or a list of) parameter(s) in an xml_document, of a vector of} -\usage{ -get_param_formalisms(xml_doc, name = NULL, form_only = FALSE) -} -\arguments{ -\item{xml_doc}{an xml_document object (created from any xml file), -or a vector of} - -\item{name}{Optional. A parameter name or a vector of. If not given, -all parameters names are extracted.} -} -\value{ -a list parameters formalism name -} -\description{ -Get the "formalisme" node "@nom" attribute value of a -(or a list of) parameter(s) in an xml_document, of a vector of -} -\examples{ -\dontrun{ - -xml_sta <- file.path(get_examples_path(file_type = "xml"), "file_sta.xml") - -sta_doc <- SticsRFiles:::xmldocument(xml_sta) - -par_form <- SticsRFiles:::get_param_formalisms(sta_doc, "zr") - -par_form_list <- SticsRFiles:::get_param_formalisms(sta_doc, - c("zr", "altistation")) -} - -} -\keyword{internal} diff --git a/man/get_param_info.Rd b/man/get_param_info.Rd index 44ee315c..09497ce0 100644 --- a/man/get_param_info.Rd +++ b/man/get_param_info.Rd @@ -55,9 +55,8 @@ parameter and formalism may be both set or only one of them, but none of them can be if keyword argument is used. } \examples{ - -get_param_info(param = "albedo") \dontrun{ +get_param_info(param = "albedo") get_param_info(param = "albedo", file = "/path/to/file.xml") get_param_info(param = "albedo", formalism = "special") diff --git a/man/get_param_names.Rd b/man/get_param_names.Rd deleted file mode 100644 index e5c6f60c..00000000 --- a/man/get_param_names.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_names.R -\name{get_param_names} -\alias{get_param_names} -\title{Get a list of STICS xml parameters names an xml_document or XML node} -\usage{ -get_param_names( - xml_object, - param_list = c(), - parent_name = NULL, - parent_sel_attr = NULL, - full_list = FALSE, - root_name = NULL -) -} -\arguments{ -\item{xml_object}{an xml XML::XMLInternalElementNode -or SticsRFiles::xml_document object} - -\item{param_list}{param names vector, only used for recursive calls} - -\item{full_list}{TRUE for getting all names, FALSE otherwise (default)} - -\item{root_name}{Only for getting the root node name (file type), -useful for filtering unwanted names to be includes in parameters names list - -for unique names list} -} -\value{ -a character vector of parameters names -} -\description{ -Get a list of STICS xml parameters names an xml_document or XML node -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -SticsRFiles:::get_param_names(sols_doc) -} - -} -\keyword{internal} diff --git a/man/get_param_names_xml.Rd b/man/get_param_names_xml.Rd deleted file mode 100644 index a235c07d..00000000 --- a/man/get_param_names_xml.Rd +++ /dev/null @@ -1,55 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_names_xml.R -\name{get_param_names_xml} -\alias{get_param_names_xml} -\title{Getting parameters names from xml files} -\usage{ -get_param_names_xml( - xml_file, - name = NULL, - bounds = TRUE, - output = "data.frame", - combine = TRUE, - exact = FALSE -) -} -\arguments{ -\item{xml_file}{an xml file path or a vector of paths} - -\item{name}{Parameter name or name part, or a vector of} - -\item{bounds}{Boolean. Are the parameter bounds to be returned ?} - -\item{output}{Output data format either "list" or "data.frame" (default)} - -\item{combine}{Logical, useful only for data.frame. -TRUE, to transform a data.frame list to a unique data.frame, -FALSE otherwise.} - -\item{exact}{Logical, if TRUE, the exact name is searched, FALSE otherwise -for partial search} -} -\value{ -A list of parameters names data.frames or list, or a unique -data.frame for multiple files. -} -\description{ -Extracting parameters names for an xml files or a vector -of files. -} -\examples{ -\dontrun{ -library(SticsRFiles) -xml_file <- "path/to/xmlfile" -xml_files_list <- c("path/to/xmlfile1", "path/to/xmlfile2") - -param_names <- get_param_names_xml(xml_file) - -param_names <- get_param_names_xml(xml_files_list) - -param_names <- get_param_names_xml(xml_files_list, - param_name = c("al", "albedo")) -} - -} -\keyword{internal} diff --git a/man/get_param_number.Rd b/man/get_param_number.Rd deleted file mode 100644 index 7dcf31cf..00000000 --- a/man/get_param_number.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_number.R -\name{get_param_number} -\alias{get_param_number} -\title{Get the number of a (or a list of) STICS xml parameter(s) occurence -from a request in an xml_document} -\usage{ -get_param_number(xml_doc_object, param_name, ...) -} -\arguments{ -\item{xml_doc_object}{an xml_document object (created from an xml file)} - -\item{param_name}{parameter name or a vector of names} - -\item{...}{other arguments that can be transmitted to get_param_value -function (see doc)} -} -\value{ -a numeric vector -} -\description{ -Get the number of a (or a list of) STICS xml parameter(s) occurence -from a request in an xml_document -} -\examples{ -\dontrun{ -xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") - -usms_doc <- SticsRFiles:::xmldocument(xml_usms) - -par_nb <- SticsRFiles:::get_param_number(usms_doc, "usm") - -par_nb_vec <- SticsRFiles:::get_param_number(usms_doc, c("usm", "fplt")) -} - -} -\keyword{internal} diff --git a/man/get_param_txt.Rd b/man/get_param_txt.Rd index eef7d682..cc352863 100644 --- a/man/get_param_txt.Rd +++ b/man/get_param_txt.Rd @@ -13,7 +13,7 @@ \title{Read STICS input parameters from text files} \usage{ get_param_txt( - workspace = getwd(), + workspace, param = NULL, variety = NULL, exact = FALSE, @@ -135,14 +135,12 @@ The functions are compatible with intercrops. Users generally only use \code{get_param_txt()}, which is a wrapper for all these functions. } \examples{ -# Read the interrow distance parameter: -\dontrun{ -library(SticsRFiles) path <- get_examples_path(file_type = "txt") -get_param_txt(path, param = "interrang") -# Getting varietal values: +# Getting the interrow distance parameter value +get_param_txt(path, param = "interrang") +# Getting varietal parameters values # Get the leaf lifespan of the variety used in the usm: get_param_txt(workspace = path, param = "durvieF") # Get the leaf lifespan of another variety available in the plant file: @@ -152,7 +150,7 @@ varieties <- c("Pactol", "Cherif", "Furio", "Dunia", "Volga", "Cecilia") get_param_txt(workspace = path, param = "durvieF", variety = varieties) # Or get it from the output of the function returning all parameters: get_param_txt(workspace = path)$plant$plant1$durvieF -} + \dontrun{ # Read the initialisation file (ficini.txt): diff --git a/man/get_param_type.Rd b/man/get_param_type.Rd deleted file mode 100644 index e898661a..00000000 --- a/man/get_param_type.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_type.R -\name{get_param_type} -\alias{get_param_type} -\title{Get a STICS xml parameter type and xpath -from a request in an xml_document} -\usage{ -get_param_type( - xml_doc, - param_name, - parent_name = NULL, - parent_sel_attr = NULL, - id = NULL -) -} -\arguments{ -\item{xml_doc}{an xml_document object (created from an xml file)} - -\item{param_name}{parameter name or a vector of names} - -\item{parent_name}{xml parent node name} - -\item{parent_sel_attr}{parent attribute value for selecting} - -\item{id}{node identifier(s) (if multiple nodes) for selecting} -} -\value{ -a list with fields $type, $xpath and $length, or a named list of -} -\description{ -Get a STICS xml parameter type and xpath -from a request in an xml_document -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -SticsRFiles:::get_param_type(sols_doc, "argi") -SticsRFiles:::get_param_type(sols_doc, c("argi", "norg")) -} - -} -\keyword{internal} diff --git a/man/get_param_value.Rd b/man/get_param_value.Rd deleted file mode 100644 index b7fa9083..00000000 --- a/man/get_param_value.Rd +++ /dev/null @@ -1,54 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_value.R -\name{get_param_value} -\alias{get_param_value} -\title{Get a set of a (or a list of) STICS xml parameter(s) -values from a request} -\usage{ -get_param_value( - xml_doc, - param_name = NULL, - parent_name = NULL, - parent_sel_attr = NULL, - ... -) -} -\arguments{ -\item{xml_doc}{an xml_document object} - -\item{param_name}{parameter name or a vector of names (optional)} - -\item{parent_name}{parent node name or attribute name (optional)} - -\item{parent_sel_attr}{parent attribute value (optional)} - -\item{...}{To pass some other arguments} -} -\value{ -a numeric vector values of parameter or a list of -} -\description{ -Extracting parameter value from an xml document object -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -SticsRFiles:::get_param_value(sols_doc, "argi") -SticsRFiles:::get_param_value(sols_doc, c("argi", "norg")) - -SticsRFiles:::get_param_value(sols_doc, "argi", - parent_name = "sol", parent_sel_attr = "solcanne" -) - -SticsRFiles:::get_param_value(sols_doc, c("argi", "norg"), - parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") -) - -SticsRFiles:::get_param_value(list(sols_doc, sols_doc), c("argi", "norg"), - parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") -) -} - -} -\keyword{internal} diff --git a/man/get_param_xml.Rd b/man/get_param_xml.Rd index 4e1db6a2..d5e1ee83 100644 --- a/man/get_param_xml.Rd +++ b/man/get_param_xml.Rd @@ -47,7 +47,7 @@ Extracting parameter values for a list of xml files and parameters } \examples{ -\dontrun{ + # Soil file file <- file.path(get_examples_path(file_type = "xml"), "sols.xml") @@ -80,5 +80,5 @@ get_param_xml(file, c("julapI_or_sum_upvt", "amount")) # Getting all parameters for a given formalism: "irrigation" get_param_xml(file, select = "formalisme", select_value = "irrigation") -} + } diff --git a/man/get_params_dict.Rd b/man/get_params_dict.Rd deleted file mode 100644 index 802ca86a..00000000 --- a/man/get_params_dict.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_params_dict.R -\name{get_params_dict} -\alias{get_params_dict} -\title{Getting an intern dictionary or merging it with a given dictionary -given as argument} -\usage{ -get_params_dict(in_dict = NULL) -} -\arguments{ -\item{in_dict}{a named list with parameters names as values} -} -\value{ -A named list with XML parameters names -} -\description{ -Getting an intern dictionary or merging it with a given dictionary -given as argument -} -\examples{ -\dontrun{ -# Getting internal dictionary default content -# get_param_dict() - -# Giving a new dictionary -in_dict <- list(name1 = "param_name1", name2 = "param_name2") - -get_params_dict(in_dict) - -# Giving a new dictionary with common values with the internal one -in_dict <- list(name1 = "amount", name2 = "julapI_or_sum_upvt") - -get_params_dict(in_dict) -} -} -\keyword{internal} diff --git a/man/get_params_from_doc.Rd b/man/get_params_from_doc.Rd deleted file mode 100644 index 253c4e6d..00000000 --- a/man/get_params_from_doc.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_params_from_doc.R -\name{get_params_from_doc} -\alias{get_params_from_doc} -\title{Get a list of STICS xml parameters names in an xml_document} -\usage{ -get_params_from_doc(xml_doc_object, type_name = NULL, unique_val = TRUE) -} -\arguments{ -\item{xml_doc_object}{an xml_document object (created from an xml file)} - -\item{type_name}{type name, one of "option", "param", "colonne"} - -\item{unique_val}{logical, TRUE to get unique names list, FALSE otherwise} -} -\value{ -a character vector of parameters names -} -\description{ -Get a list of STICS xml parameters names in an xml_document -} -\keyword{internal} diff --git a/man/get_params_from_doc_attr.Rd b/man/get_params_from_doc_attr.Rd deleted file mode 100644 index 51cc8d5a..00000000 --- a/man/get_params_from_doc_attr.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_params_from_doc_attr.R -\name{get_params_from_doc_attr} -\alias{get_params_from_doc_attr} -\title{Get a list of STICS xml parameters names from nodes attributes in -an xml_document} -\usage{ -get_params_from_doc_attr(xml_doc, type_name = NULL, unique_val = TRUE) -} -\arguments{ -\item{xml_doc}{an xml_document object (created from an xml file)} - -\item{type_name}{type name, one of "option", "param", "colonne"} - -\item{unique_val}{logical, TRUE to get unique names list, FALSE otherwise} -} -\value{ -a named list of parameter names -} -\description{ -Get a list of STICS xml parameters names from nodes attributes in -an xml_document -} -\keyword{internal} diff --git a/man/get_params_from_doc_node.Rd b/man/get_params_from_doc_node.Rd deleted file mode 100644 index 141d2c04..00000000 --- a/man/get_params_from_doc_node.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_params_from_doc_node.R -\name{get_params_from_doc_node} -\alias{get_params_from_doc_node} -\title{Get a list of STICS xml parameters names from nodes names in -an xml_document} -\usage{ -get_params_from_doc_node(xml_node, param_list = c(), unique_val = TRUE) -} -\arguments{ -\item{xml_node}{an xml XMLInternalElementNode} - -\item{param_list}{parameters names vector, used for recursive calls} - -\item{unique_val}{logical, TRUE to get unique names list, FALSE otherwise} -} -\value{ -a character vector of parameters names -} -\description{ -Get a list of STICS xml parameters names from nodes names in -an xml_document -} -\keyword{internal} diff --git a/man/get_params_from_table.Rd b/man/get_params_from_table.Rd deleted file mode 100644 index 2db9bd6c..00000000 --- a/man/get_params_from_table.Rd +++ /dev/null @@ -1,57 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_params_from_table.R -\name{get_params_from_table} -\alias{get_params_from_table} -\title{Get a list of STICS xml parameters names and values from a table -(data.frame, tibble)} -\usage{ -get_params_from_table( - params_table, - param_names = NULL, - xml_doc, - lines_id = NULL, - stopping = FALSE, - dict = NULL, - na_values = NA -) -} -\arguments{ -\item{params_table}{a table (df, tibble) containing parameters to use} - -\item{param_names}{parameters names to select} - -\item{xml_doc}{an xml_document object (of any xml type)} - -\item{lines_id}{table lines identifiers to select} - -\item{stopping}{logical value for stopping if any unknown parameters -(if TRUE)} - -\item{dict}{List of names correspondence between short names (tags) -and real parameters names} - -\item{na_values}{value to use as missing value in param_table -(optional, default : NA)} -} -\value{ -a named list (with parameters names as list names) -of data.frame/tibble -} -\description{ -Get a list of STICS xml parameters names and values from a table -(data.frame, tibble) -} -\examples{ -\dontrun{ - -download_usm_xl(file = "inputs_stics_example.xlsx", - dest_dir = "/path/to/dest/dir") -xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") -ini_param_df <- read_excel(xl_path, sheet = "Ini") -xml_path <- "path/to/ini/xml" -ini_doc <- SticsRFiles:::xmldocument(xml_path) -get_params_from_table(ini_param_df, ini_doc) -} - -} -\keyword{internal} diff --git a/man/get_plant_name.Rd b/man/get_plant_name.Rd deleted file mode 100644 index d62541bf..00000000 --- a/man/get_plant_name.Rd +++ /dev/null @@ -1,55 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_plant_name.R -\name{get_plant_name} -\alias{get_plant_name} -\title{Get plant names} -\usage{ -get_plant_name( - workspace, - usms_filepath, - usm_name = NULL, - javastics_path = NULL, - verbose = TRUE -) -} -\arguments{ -\item{workspace}{Path of a JavaSTICS workspace, or a vector of -(recursive call).} - -\item{usms_filepath}{Path of the usms file (\code{usms.xml})} - -\item{usm_name}{Vector of usms to read (optional, used to filter usms)} - -\item{javastics_path}{JavaSTICS installation path (Optional, needed if the -plant files are not in the \code{workspace} but rather in the JavaSTICS -default workspace). Only used to get the plants names.} - -\item{verbose}{Logical value (optional), TRUE to display information -on error, FALSE otherwise (default)} -} -\value{ -A list of plant names for each usm with one value for sole crop -and two values for intercrop (principal, associated). -} -\description{ -Get the plant name (and file name) for each usm in a workspace -} -\examples{ -\dontrun{ -path <- get_examples_path(file_type = "xml") - -# Get plant names for all usms (no javastics path, so only the file -# name is returned): -get_plant_name(path) -# Get plant names only for banana: -get_plant_name(path, "banana") - -# Get plant names for banana with a javastics path, so the plant -# name is returned: -get_plant_name(path) -# NB: if the plant folder is in the workspace, no need to provide -# javastics_path -} - -} -\keyword{internal} diff --git a/man/get_plants_nb.Rd b/man/get_plants_nb.Rd index fcdb1052..c7fce05e 100644 --- a/man/get_plants_nb.Rd +++ b/man/get_plants_nb.Rd @@ -32,8 +32,6 @@ Use \code{get_usms_list()} to get the list of the usm names for an usms.xml file. } \examples{ -\dontrun{ - # Xml case xml_usms <- file.path(get_examples_path(file_type = "xml"), "usms.xml") get_plants_nb(xml_usms) @@ -43,6 +41,5 @@ get_plants_nb(xml_usms, c("wheat", "intercrop_pea_barley")) # Txt case txt_usm <- file.path(get_examples_path(file_type = "txt"), "new_travail.usm") get_plants_nb(txt_usm) -} } diff --git a/man/get_plants_nb_xml.Rd b/man/get_plants_nb_xml.Rd deleted file mode 100644 index 175ab0b9..00000000 --- a/man/get_plants_nb_xml.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_plants_nb.R -\name{get_plants_nb_xml} -\alias{get_plants_nb_xml} -\title{Getting plants number per usm, all or selected from a given list} -\usage{ -get_plants_nb_xml( - usms_file, - usms_list = c(), - usm_xml_path = lifecycle::deprecated() -) -} -\arguments{ -\item{usms_file}{Path of usms.xml file} - -\item{usms_list}{Usms selection list inside usms from usms.xml file -(optional, see details)} - -\item{usm_xml_path}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} \code{usm_xml_path} is no -longer supported, use \code{usms_file} instead.} -} -\value{ -A names numeric vector of plants number per usm -} -\description{ -Extracting plant number from usms.xml file data -} -\details{ -Use \code{get_usms_list()} to get the list of the usm names. -} -\examples{ -\dontrun{ - -usms_file <- file.path(get_examples_path(file_type = "xml"), "usms.xml") -get_plants_nb(usms_file) -get_plants_nb(usms_file, "wheat") -get_plants_nb(usms_file, c("wheat", "intercrop_pea_barley")) -} - -} -\keyword{internal} diff --git a/man/get_referenced_dirs.Rd b/man/get_referenced_dirs.Rd deleted file mode 100644 index 4572cd1e..00000000 --- a/man/get_referenced_dirs.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/download_data.R -\name{get_referenced_dirs} -\alias{get_referenced_dirs} -\title{Getting valid directories string for download from SticsRPacks data -repository} -\usage{ -get_referenced_dirs(dirs = NULL, stics_version = NULL) -} -\arguments{ -\item{dirs}{Directories names of the referenced use cases (optional), -starting with "study_case_"} - -\item{stics_version}{An optional version string -within those given by get_stics_versions_compat()$versions_list} -} -\value{ -Vector of referenced directories string (as "study_case_1/V9.0") -} -\description{ -Getting valid directories string for download from SticsRPacks data -repository -} -\examples{ -\dontrun{ -# Getting all available dirs from the data repos -SticsRFiles:::get_referenced_dirs() - -# Getting dirs for a use case -SticsRFiles:::get_referenced_dirs("study_case_1") - -# Getting dirs for a use case and a version -SticsRFiles:::get_referenced_dirs("study_case_1", "V9.0") - -SticsRFiles:::get_referenced_dirs(c("study_case_1", "study_case_2"), "V9.0") -} - -} -\keyword{internal} diff --git a/man/get_report_results.Rd b/man/get_report_results.Rd index 9ffe712d..09971d25 100644 --- a/man/get_report_results.Rd +++ b/man/get_report_results.Rd @@ -40,7 +40,6 @@ and/or \code{var_list} vector of variables names. In the returned data.frame, variables names respect the same syntax as in the get_sim output. } \examples{ -\dontrun{ path <- get_examples_path(file_type = "sti") get_report_results(workspace = path) @@ -53,6 +52,6 @@ get_report_results(workspace = path, usm = c("DurumWheat", "grass")) get_report_results(workspace = path) get_report_results(workspace = path, file_name = "mod_rapportA.sti") -} + } diff --git a/man/get_sim.Rd b/man/get_sim.Rd index 777084c3..b9a2d77e 100644 --- a/man/get_sim.Rd +++ b/man/get_sim.Rd @@ -85,9 +85,7 @@ If \code{usms_file} is not specified, the plants are named "plant_1" by default (+ "plant_2" for intercrops). } \examples{ -\dontrun{ path <- get_examples_path(file_type = "sti") -get_sim(path, "banana") -} +sim_data <- get_sim(path, "banana") } diff --git a/man/get_stics_versions_compat.Rd b/man/get_stics_versions_compat.Rd index c675a65b..53103588 100644 --- a/man/get_stics_versions_compat.Rd +++ b/man/get_stics_versions_compat.Rd @@ -20,9 +20,6 @@ Get the versions of STICS that are fully compatible with this package. } \examples{ -# -\dontrun{ - # Getting the complete versions list get_stics_versions_compat() @@ -32,7 +29,5 @@ get_stics_versions_compat(1) # Getting the previous version of the latest one get_stics_versions_compat(-1) -# -} } diff --git a/man/get_svn_identifiers.Rd b/man/get_svn_identifiers.Rd deleted file mode 100644 index c622e299..00000000 --- a/man/get_svn_identifiers.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{get_svn_identifiers} -\alias{get_svn_identifiers} -\title{Getting read only account identifiers for the STICS subversion repository} -\usage{ -get_svn_identifiers() -} -\value{ -A list with fields \code{username} and \code{password} -} -\description{ -Getting read only account identifiers for the STICS subversion repository -} -\examples{ -\dontrun{ -SticsRFiles:::get_svn_identifiers() -} -} -\keyword{internal} diff --git a/man/get_txt_generic.Rd b/man/get_txt_generic.Rd deleted file mode 100644 index cc9530b4..00000000 --- a/man/get_txt_generic.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_param_txt.R -\name{get_txt_generic} -\alias{get_txt_generic} -\title{Read parameter values from file} -\usage{ -get_txt_generic(file, names = TRUE) -} -\arguments{ -\item{file}{Path (including name) of the file to read} - -\item{names}{Boolean, read the parameter names ?} -} -\value{ -A named (if names=TRUE) list of parameter values -} -\description{ -Generic function to read STICS parameter files -} -\examples{ -\dontrun{ -path <- file.path(get_examples_path(file_type = "txt", - stics_version = "V8.5"), "station.txt") -get_txt_generic(path) -} - -} -\keyword{internal} diff --git a/man/get_values_by_param.Rd b/man/get_values_by_param.Rd deleted file mode 100644 index 2baa1b0c..00000000 --- a/man/get_values_by_param.Rd +++ /dev/null @@ -1,45 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_values_by_param.R -\name{get_values_by_param} -\alias{get_values_by_param} -\title{Extract a named list of parameters values or a list of -from data.frame row(s), for all parameters columns or a selection} -\usage{ -get_values_by_param( - params_table, - param_name = NULL, - lines_id = NULL, - na_values = NA -) -} -\arguments{ -\item{params_table}{a table (df, tibble) with parameters names -indexed with suffixes _1, _2 ... i.e. paramname_1, paramname_2 -or not for scalar parameters} - -\item{param_name}{Optional parameter(s) name(s) vector} - -\item{lines_id}{Optional data.frame lines numerical identifiers} - -\item{na_values}{value to use as missing value in param_table -(optional, default : NA)} -} -\value{ -a named list of parameters values, with sorted values for multiple -parameter values (indexed with suffixes _1, _2, ...) -} -\description{ -Extract a named list of parameters values or a list of -from data.frame row(s), for all parameters columns or a selection -} -\examples{ -\dontrun{ -download_usm_xl(file = "inputs_stics_example.xlsx", - dest_dir = "/path/to/dest/dir") -xl_path <- file.path("/path/to/dest/dir", "inputs_stics_example.xlsx") -tec_param_df <- read_excel(xl_path, sheet = "Tec") -SticsRFiles:::get_values_by_param(params_table = tec_param_df) -} - -} -\keyword{internal} diff --git a/man/get_var_info.Rd b/man/get_var_info.Rd index b9ede77e..0d16c506 100644 --- a/man/get_var_info.Rd +++ b/man/get_var_info.Rd @@ -39,7 +39,7 @@ STICS output variables from a partial name and/or descriptive keywords. The function understand \code{\link[base]{regex}} as input. } \examples{ -\dontrun{ + # Find by variable name (fuzzy search): SticsRFiles::get_var_info("lai") @@ -48,9 +48,6 @@ SticsRFiles::get_var_info(keyword = "lai") # Find for a particular version: SticsRFiles::get_var_info("lai", stics_version = "V9.0") -} -} -\seealso{ -\code{\link{all_out_var}} + } diff --git a/man/get_version_info_tmpl.Rd b/man/get_version_info_tmpl.Rd deleted file mode 100644 index 79d9959c..00000000 --- a/man/get_version_info_tmpl.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{get_version_info_tmpl} -\alias{get_version_info_tmpl} -\title{Get a basic data.frame for a version} -\usage{ -get_version_info_tmpl(version_name) -} -\arguments{ -\item{version_name}{name (i.e. "VX.Y") of the version to set -in the output data.frame} -} -\value{ -a data.frame, with version set in \code{versions} and \code{csv} columns -(for existing inputs.csv and outputs.csv files in a versions VX.Y -sub-directory) -} -\description{ -Get a basic data.frame for a version -} -\examples{ -\dontrun{ -SticsRFiles:::get_versions_info(version_name = "V10.0") -} -} -\keyword{internal} diff --git a/man/get_version_num.Rd b/man/get_version_num.Rd deleted file mode 100644 index abb0c18d..00000000 --- a/man/get_version_num.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_stics_versions_compat.R -\name{get_version_num} -\alias{get_version_num} -\title{Getting version number from the version string} -\usage{ -get_version_num(stics_version = "latest", numeric = TRUE) -} -\arguments{ -\item{stics_version}{An optional version name as listed in -get_stics_versions_compat() return} - -\item{numeric}{logical, TRUE for numerical output format, -FALSE for character output format} -} -\value{ -version number (numeric or character) -} -\description{ -Getting version number from the version string -} -\examples{ -\dontrun{ -SticsRFiles:::get_version_num() -} -} -\keyword{internal} diff --git a/man/get_version_string.Rd b/man/get_version_string.Rd deleted file mode 100644 index 0649aed4..00000000 --- a/man/get_version_string.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_stics_versions_compat.R -\name{get_version_string} -\alias{get_version_string} -\title{Getting version string from the version number} -\usage{ -get_version_string(stics_version) -} -\arguments{ -\item{stics_version}{numeric (i.e. X.Y)} -} -\value{ -version string -} -\description{ -Getting version string from the version number -} -\examples{ -\dontrun{ -SticsRFiles:::get_version_string() -} -} -\keyword{internal} diff --git a/man/get_versions_file_name.Rd b/man/get_versions_file_name.Rd deleted file mode 100644 index 0a496b5c..00000000 --- a/man/get_versions_file_name.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_stics_versions_compat.R -\name{get_versions_file_name} -\alias{get_versions_file_name} -\title{Getting the csv file name storing versions information} -\usage{ -get_versions_file_name() -} -\value{ -file name -} -\description{ -Getting the csv file name storing versions information -} -\examples{ -\dontrun{ -SticsRFiles:::get_versions_file_name() -} -} -\keyword{internal} diff --git a/man/get_versions_file_path.Rd b/man/get_versions_file_path.Rd deleted file mode 100644 index 9e62b39b..00000000 --- a/man/get_versions_file_path.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{get_versions_file_path} -\alias{get_versions_file_path} -\title{Getting versions information csv file path according to its location} -\usage{ -get_versions_file_path(location = "install") -} -\arguments{ -\item{location}{The destination where to remove information and data -"install" for removing things from the installed SticsRFiles library -(default), "package" for removing them from the package project (in RStudio)} -} -\value{ -A file path -} -\description{ -Getting versions information csv file path according to its location -} -\examples{ -\dontrun{ -SticsRFiles:::get_versions_file_path() - -SticsRFiles:::get_versions_file_path(location = "package") -} -} -\keyword{internal} diff --git a/man/get_versions_info.Rd b/man/get_versions_info.Rd deleted file mode 100644 index 939722e6..00000000 --- a/man/get_versions_info.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_stics_versions_compat.R -\name{get_versions_info} -\alias{get_versions_info} -\title{Getting versions data (versions strings and examples files directories list)} -\usage{ -get_versions_info(stics_version = NULL, location = "install") -} -\arguments{ -\item{stics_version}{Optional version string (i.e. "VX.Y")} - -\item{versions_dir}{Optional, either an \code{extdata} directory path -of the installed SticsRFiles library (default) or of the package project} -} -\value{ -A data.frame with versions data -} -\description{ -Getting versions data (versions strings and examples files directories list) -} -\examples{ -\dontrun{ - -SticsRFiles:::get_versions_info() - -get_versions_info(stics_version = "V8.5") - - -get_versions_info( - stics_version = "V8.5", - versions_dir = "path/to/SticsRFilesproject/inst/extdata" -) -} -} -\keyword{internal} diff --git a/man/get_xml_base_doc.Rd b/man/get_xml_base_doc.Rd deleted file mode 100644 index fc1fc034..00000000 --- a/man/get_xml_base_doc.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_xml_base_doc.R -\name{get_xml_base_doc} -\alias{get_xml_base_doc} -\title{Get an xml_document from a STICS xml file template} -\usage{ -get_xml_base_doc(xml_type = NULL, stics_version = "latest") -} -\arguments{ -\item{xml_type}{xml file type (see types returned when calling -get_xml_base_doc())} - -\item{stics_version}{the STICS files version to use} -} -\value{ -an xml_document object -} -\description{ -Get an xml_document from a STICS xml file template -} -\examples{ -\dontrun{ -# Getting xml STICS files types list (i.e. keywords) -SticsRFiles:::get_xml_base_doc() - -# Getting a soil document with one soil definition -SticsRFiles:::get_xml_base_doc("sols") - -# STICS version can be provided, V9.1 -# corresponds to stics_version = "latest" -# View available STICS files version -SticsRFiles:::get_xml_stics_version() -# Giving STICS version -SticsRFiles:::get_xml_base_doc("sols", stics_version = "V9.1") -} - -} -\keyword{internal} diff --git a/man/get_xml_base_node.Rd b/man/get_xml_base_node.Rd deleted file mode 100644 index 30f305d4..00000000 --- a/man/get_xml_base_node.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_xml_base_node.R -\name{get_xml_base_node} -\alias{get_xml_base_node} -\title{Get an xml_document node (set of parameters) from a STICS xml node -file template} -\usage{ -get_xml_base_node(file_tag, form_name = NULL, stics_version = "latest") -} -\arguments{ -\item{file_tag}{file tag among "usms","sols", "tec"} - -\item{form_name}{formalism name} - -\item{stics_version}{the STICS files version to use} -} -\value{ -An xml node of type "usm", "sol", "intervention" -} -\description{ -Get an xml_document node (set of parameters) from a STICS xml node -file template -} -\examples{ -\dontrun{ -SticsRFiles:::get_xml_base_node("usms") - -SticsRFiles:::get_xml_base_node("sols") - -# Formalism labels can be retrieved using -SticsRFiles:::get_xml_base_node()$form_names$tec - -SticsRFiles:::get_xml_base_node("tec", "irrigation") -} - -} -\keyword{internal} diff --git a/man/get_xml_doc_example.Rd b/man/get_xml_doc_example.Rd deleted file mode 100644 index d38cb80e..00000000 --- a/man/get_xml_doc_example.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_xml_doc_example.R -\name{get_xml_doc_example} -\alias{get_xml_doc_example} -\title{Get an xml_document from a STICS xml file example} -\usage{ -get_xml_doc_example(xml_name = NULL, stics_version = "latest") -} -\arguments{ -\item{xml_name}{xml file name -(see file names by calling get_xml_doc_example())} - -\item{stics_version}{the STICS files version to use} -} -\value{ -An xml_document object -} -\description{ -Get an xml_document from a STICS xml file example -} -\examples{ -\dontrun{ -# Retrieving xml examples files to get xml_document from -SticsRFiles:::get_xml_doc_example() - -# Loading an usms.xml file -usm_doc <- SticsRFiles:::get_xml_doc_example("usms.xml") -} - -} -\keyword{internal} diff --git a/man/get_xml_files_param_df.Rd b/man/get_xml_files_param_df.Rd deleted file mode 100644 index f0ee3bc4..00000000 --- a/man/get_xml_files_param_df.Rd +++ /dev/null @@ -1,94 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_xml_files_param_df.R -\name{get_xml_files_param_df} -\alias{get_xml_files_param_df} -\title{Extracting a data.frame of parameters values for an xml file or a set of -(whatever the xml file kind)} -\usage{ -get_xml_files_param_df( - file_path, - select = NULL, - name = NULL, - param_names = NULL, - wide_shape = FALSE -) -} -\arguments{ -\item{file_path}{A file path or a vector of} - -\item{select}{node name or attribute name to use for selection -(optional, default to no selection)} - -\item{name}{value used for select (optional)} - -\item{param_names}{vector of parameters names (optional)} - -\item{wide_shape}{Optional logical for keeping the long data.frame -format FALSE, default) or converting it to a wider format one (TRUE)} -} -\value{ -A data.frame with name, type, param, id and value columns -} -\description{ -Extracting a data.frame of parameters values for an xml file or a set of -(whatever the xml file kind) -} -\details{ -An extract of an example of data.frame for the 2 formats -\itemize{ -\item Default one -}\tabular{lllrl}{ - name \tab type \tab param \tab id \tab value \cr - SugarCane \tab usms \tab datedebut \tab NA \tab 286 \cr - SugarCane \tab usms \tab datefin \tab NA \tab 650 \cr - SugarCane \tab usms \tab finit \tab NA \tab canne_ini.xml \cr - SugarCane \tab usms \tab nomsol \tab NA \tab solcanne \cr - SugarCane \tab usms \tab fstation \tab NA \tab climcanj_sta.xml \cr - ... \tab ... \tab ... \tab ... \tab ... \cr - ... \tab ... \tab ... \tab ... \tab ... \cr - param_gen.xml \tab fichierpar \tab Qmulchdec \tab 17 \tab 0 \cr - param_gen.xml \tab fichierpar \tab Qmulchdec \tab 18 \tab 0 \cr - param_gen.xml \tab fichierpar \tab Qmulchdec \tab 19 \tab 0 \cr - param_gen.xml \tab fichierpar \tab Qmulchdec \tab 20 \tab 0 \cr - param_gen.xml \tab fichierpar \tab Qmulchdec \tab 21 \tab 0 \cr -} - - -name: a file name or an usm or soil name -type: type of file -param: param name -id: NA for scalar, integer id for vectors parameters -value: parameter value -\itemize{ -\item wide format -}\tabular{llrrll}{ - name \tab type \tab datedebut \tab datefin \tab finit \tab nomsol \cr - SugarCane \tab usms \tab 286 \tab 650 \tab canne_ini.xml \tab solcanne \cr - potato \tab usms \tab 91 \tab 250 \tab patate_ini.xml \tab solpatate \cr - banana \tab usms \tab 30 \tab 300 \tab banane_ini.xml \tab solbanane \cr - sorghum \tab usms \tab 112 \tab 360 \tab sorgho_ini.xml \tab solsorgho \cr - barley \tab usms \tab 88 \tab 196 \tab orge_ini.xml \tab solorge \cr -} - - -name: a file name or an usm or soil name -type: type of file -all other columns names correspond to parameter names, with indices as suffix -for multiple values -} -\examples{ -\dontrun{ -dir_path <- get_examples_path("xml") -get_xml_files_param_df(file_path = file.path(dir_path, "sols.xml")) - -get_xml_files_param_df( - file_path = file.path(dir_path, "sols.xml"), - select = "sol", c("solcanne", "solble") -) - -files_list <- file.path(dir_path, c("sols.xml", "usms.xml", "param_gen.xml")) -get_xml_files_param_df(file_path = files_list) -} - -} -\keyword{internal} diff --git a/man/get_xml_stics_version.Rd b/man/get_xml_stics_version.Rd deleted file mode 100644 index 64eb7d96..00000000 --- a/man/get_xml_stics_version.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_xml_stics_version.R -\name{get_xml_stics_version} -\alias{get_xml_stics_version} -\title{Get a version/or the latest version string of available -STICS files templates in the package} -\usage{ -get_xml_stics_version(stics_version = "latest", xml_doc = NULL) -} -\arguments{ -\item{stics_version}{A version key of a STICS version (i.e. V9.1)} - -\item{xml_doc}{an xml_document of a STICS xml file (Unused for the moment, -no version String included in xml files)} -} -\value{ -a STICS version string -} -\description{ -Get a version/or the latest version string of available -STICS files templates in the package -} -\examples{ -\dontrun{ -# View available STICS files version -SticsRFiles:::get_xml_stics_version() - -# View the latest version -SticsRFiles:::get_xml_stics_version("latest") - -# Checking if a version exists -SticsRFiles:::get_xml_stics_version("V9.2") -} - -} -\keyword{internal} diff --git a/man/init_javastics_pref.Rd b/man/init_javastics_pref.Rd deleted file mode 100644 index 4f2c923a..00000000 --- a/man/init_javastics_pref.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/init_javastics_pref.R -\name{init_javastics_pref} -\alias{init_javastics_pref} -\title{Initialize JavaSTICS preferences} -\usage{ -init_javastics_pref(javastics, overwrite = FALSE) -} -\arguments{ -\item{javastics}{JavaSTICS installation folder} - -\item{overwrite}{Boolean. Overwrite the existing preference file ?} -} -\value{ -\code{TRUE} if the file was created, \code{FALSE} otherwise. -} -\description{ -Initialize the JavaSTICS \code{preferences.xml} file. -} -\examples{ -\dontrun{ -init_javastics_pref("/path/to/JavaSTICS/folder") -} - -} -\keyword{internal} diff --git a/man/is_os_name.Rd b/man/is_os_name.Rd deleted file mode 100644 index 4fbcf768..00000000 --- a/man/is_os_name.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/is_os_name.R -\name{is_os_name} -\alias{is_os_name} -\title{Testing OS name} -\usage{ -is_os_name(os_tag_name = character()) -} -\arguments{ -\item{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 -} -\description{ -Returning if the given OS name is the system name -} -\examples{ -\dontrun{ -os_list <- is_os_name() -is_os_name <- is_os_name("windows") -} - -} -\keyword{internal} diff --git a/man/is_stics_doc.Rd b/man/is_stics_doc.Rd deleted file mode 100644 index 1508f52b..00000000 --- a/man/is_stics_doc.Rd +++ /dev/null @@ -1,55 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/is_stics_doc.R -\name{is_stics_doc} -\alias{is_stics_doc} -\alias{is_stics_ini} -\alias{is_stics_usms} -\alias{is_stics_sols} -\alias{is_stics_tec} -\alias{is_stics_sta} -\alias{is_stics_plt} -\alias{is_stics_par} -\alias{is_stics_newpar} -\title{Is it a STICS xml document} -\usage{ -is_stics_doc(xml_doc, doc_type = NULL, doc_types = NULL) - -is_stics_ini(xml_doc) - -is_stics_usms(xml_doc) - -is_stics_sols(xml_doc) - -is_stics_tec(xml_doc) - -is_stics_sta(xml_doc) - -is_stics_plt(xml_doc) - -is_stics_par(xml_doc) - -is_stics_newpar(xml_doc) -} -\arguments{ -\item{xml_doc}{An xml document} - -\item{doc_type}{The type of xml document} - -\item{doc_types}{The different possible document types (optional)} -} -\value{ -A logical value giving if xml_doc is a STICS xml_document object -(TRUE, with document type as attribute "type"), or not (FALSE) -} -\description{ -Test if an XML document is a STICS document. -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -SticsRFiles:::is_stics_doc(sols_doc) -} - -} -\keyword{internal} diff --git a/man/is_stics_var.Rd b/man/is_stics_var.Rd index 2bc11d05..8c4a4a5c 100644 --- a/man/is_stics_var.Rd +++ b/man/is_stics_var.Rd @@ -18,16 +18,15 @@ is used.} longer supported, use \code{stics_version} instead.} } \value{ -A boolean vector: \code{TRUE} if the variable exist, \code{FALSE} if it doesn't +A boolean vector: \code{TRUE} if the variable exist, \code{FALSE} otherwise } \description{ Tells if one or more variable names are valid STICS output variables. } \examples{ -\dontrun{ -is_stics_var(c("lai(n)", "masec(n)", "truc")) -} +is_stics_var(c("lai(n)", "masec(n)", "unknown")) + } \seealso{ \code{get_var_info()} for interactive use. diff --git a/man/is_stics_xml.Rd b/man/is_stics_xml.Rd deleted file mode 100644 index 89e5ef9e..00000000 --- a/man/is_stics_xml.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/is_stics_xml.R -\name{is_stics_xml} -\alias{is_stics_xml} -\alias{is_ini_xml} -\alias{is_usms_xml} -\alias{is_sols_xml} -\alias{is_tec_xml} -\alias{is_sta_xml} -\alias{is_plt_xml} -\alias{is_par_xml} -\alias{is_newpar_xml} -\title{Is it a STICS xml file} -\usage{ -is_stics_xml(xml_path, file_type = NULL) - -is_ini_xml(xml_path) - -is_usms_xml(xml_path) - -is_sols_xml(xml_path) - -is_tec_xml(xml_path) - -is_sta_xml(xml_path) - -is_plt_xml(xml_path) - -is_par_xml(xml_path) - -is_newpar_xml(xml_path) -} -\arguments{ -\item{xml_path}{An xml file path} - -\item{file_type}{The type of the xml file} -} -\value{ -A logical value giving if input xml file is a STICS one -(TRUE), or not (FALSE) -} -\description{ -Test if an XML file is a STICS one. -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -SticsRFiles:::is_stics_xml(xml_path) -} - -} -\keyword{internal} diff --git a/man/merge_nodesets.Rd b/man/merge_nodesets.Rd deleted file mode 100644 index 9088a7a6..00000000 --- a/man/merge_nodesets.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/merge_nodesets.R -\name{merge_nodesets} -\alias{merge_nodesets} -\title{Merging 2 XML node sets} -\usage{ -merge_nodesets(ns1, ns2) -} -\arguments{ -\item{ns1}{First XMLNodeSet} - -\item{ns2}{Second XMLNodeSet} -} -\value{ -An XMLNodeSet -} -\description{ -Merging 2 XML node sets -} -\keyword{internal} diff --git a/man/parse_mixed_file.Rd b/man/parse_mixed_file.Rd deleted file mode 100644 index a7c22035..00000000 --- a/man/parse_mixed_file.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_file.R -\name{parse_mixed_file} -\alias{parse_mixed_file} -\title{Get mixed file names} -\usage{ -parse_mixed_file(file_names, type = c("sim", "obs")) -} -\arguments{ -\item{file_names}{A list of files} - -\item{type}{The type of file to read, either "obs" or "sim".} -} -\value{ -A list of observation or simulation files associated to -their usm name. The mixed crops are always returned as -c("Principal","Associated"). -} -\description{ -Get mixed observation or simulation files by name -} -\note{ -The function use the obs/sim files names to retrieve the usm name. -So each obs file should be named with the usm name, followed by a or p -at the end in the case of associated crops. -} -\examples{ -\dontrun{ -parse_mixed_file(list("banana.obs", "IC_banana_sorghuma.obs", - "IC_banana_sorghump.obs"), - type = "obs" -) - -# Simulations with usm names starting with "a", with or -# without intercropping: -file_names <- list( - "mod_sauzevilleSC_Wheat_Wheat_2005-2006_N0.sti", - "mod_saIC_Wheat_Wheat_2005-2006_N0.sti", - "mod_spIC_Wheat_Wheat_2005-2006_N0.sti" -) - -parse_mixed_file(file_names, type = "sim") -} - -} -\keyword{internal} diff --git a/man/remove_node_from_doc.Rd b/man/remove_node_from_doc.Rd deleted file mode 100644 index 53e67e8c..00000000 --- a/man/remove_node_from_doc.Rd +++ /dev/null @@ -1,54 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/remove_node_from_doc.R -\name{remove_node_from_doc} -\alias{remove_node_from_doc} -\title{Remove a node from an xml object} -\usage{ -remove_node_from_doc( - xml_doc, - param_name, - parent_name = NULL, - remove_parent = FALSE, - nodes_ids = NULL -) -} -\arguments{ -\item{xml_doc}{The XML document} - -\item{param_name}{The parameter name} - -\item{parent_name}{The name of the parent parameter -(node name or attribute value of nom, nomParam)} - -\item{remove_parent}{Logical, indicating if the parent node must be removed -(TRUE) or not (FALSE)} - -\item{nodes_ids}{The node IDs to be removed (optional)} -} -\description{ -Remove a node from an xml_document instance -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -tec_doc <- SticsRFiles:::xmldocument(xml_path) - -# removing a single parameter -SticsRFiles:::remove_node_from_doc(tec_doc, param_name = "jultrav") - -# removing all the parent nodes the parameter belongs to -SticsRFiles:::remove_node_from_doc(tec_doc, - param_name = "julapI_or_sum_upvt", - remove_parent = TRUE -) - -# removing some of the parent nodes the parameter belongs to -SticsRFiles:::remove_node_from_doc(tec_doc, - param_name = "julapI_or_sum_upvt", - remove_parent = TRUE, nodes_ids = c(1, 3) -) -} - -} -\keyword{internal} diff --git a/man/remove_parent_from_doc.Rd b/man/remove_parent_from_doc.Rd deleted file mode 100644 index 4863e4a3..00000000 --- a/man/remove_parent_from_doc.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/remove_parent_from_doc.R -\name{remove_parent_from_doc} -\alias{remove_parent_from_doc} -\title{Remove parent node of a parameter} -\usage{ -remove_parent_from_doc(xml_doc, param_name, nodes_ids = NULL) -} -\arguments{ -\item{xml_doc}{The XML document} - -\item{param_name}{The parameter name} - -\item{nodes_ids}{The node IDs to be removed (optional)} -} -\description{ -Remove a parent node from an XML file. -} -\examples{ -\dontrun{ - -xml_path <- file.path(get_examples_path(file_type = "xml"), "file_tec.xml") -tec_doc <- SticsRFiles:::xmldocument(xml_path) - -# removing all the parent nodes the parameter belongs to -SticsRFiles:::remove_parent_from_doc(tec_doc, - param_name = "julapI_or_sum_upvt") - -# removing some of the parent nodes the parameter belongs to -SticsRFiles:::remove_parent_from_doc(tec_doc, - param_name = "julapI_or_sum_upvt", - nodes_ids = c(1, 3) -) -} - -} -\keyword{internal} diff --git a/man/remove_stics_version.Rd b/man/remove_stics_version.Rd deleted file mode 100644 index ae827cf3..00000000 --- a/man/remove_stics_version.Rd +++ /dev/null @@ -1,45 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{remove_stics_version} -\alias{remove_stics_version} -\title{Removing a version and data from the SticsRFiles library or package} -\usage{ -remove_stics_version( - version_name, - delete_files = TRUE, - location = "install", - verbose = TRUE -) -} -\arguments{ -\item{version_name}{name (i.e. "VX.Y") of the version to set -in the csv file containing informations about versions} - -\item{delete_files}{Logical, TRUE for removing files (default), -FALSE otherwise} - -\item{location}{The destination where to remove information and data -"install" for removing things from the installed SticsRFiles library -(default), "package" for removing them from the package project (in RStudio)} - -\item{verbose}{Logical, TRUE for displaying warnings (default), -FALSE otherwise} -} -\value{ -An invisible logical value, TRUE if successful removing, -FALSE otherwise -} -\description{ -Removing a version and data from the SticsRFiles library or package -} -\examples{ -\dontrun{ -SticsRFiles:::remove_stics_version(version_name = "V10.0") - -SticsRFiles:::remove_stics_version( - version_name = "V10.0", - location = "package" -) -} -} -\keyword{internal} diff --git a/man/replace_string_in_file.Rd b/man/replace_string_in_file.Rd deleted file mode 100644 index 674e7923..00000000 --- a/man/replace_string_in_file.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/replace_string_in_file.R -\name{replace_string_in_file} -\alias{replace_string_in_file} -\title{Replacing a string in a file} -\usage{ -replace_string_in_file( - file_path, - target_string, - replace_string, - new_file_path = NULL -) -} -\arguments{ -\item{file_path}{The path to the file} - -\item{target_string}{The target string to replace} - -\item{replace_string}{The replacing string} - -\item{new_file_path}{The newly-created file path} -} -\description{ -Replacing occurrences of a string by another one, -in place or creating a new file -} -\keyword{internal} diff --git a/man/replace_txt_param_value.Rd b/man/replace_txt_param_value.Rd deleted file mode 100644 index 13b21d0d..00000000 --- a/man/replace_txt_param_value.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/replace_txt_param_value.R -\name{replace_txt_param_value} -\alias{replace_txt_param_value} -\title{Replacing value in STICS parameters files} -\usage{ -replace_txt_param_value( - file_path, - param_tag, - param_value, - out_file_path = NULL -) -} -\arguments{ -\item{file_path}{The file path} - -\item{param_tag}{The parameter name} - -\item{param_value}{The parameter values} - -\item{out_file_path}{The new file path} -} -\description{ -Replacing one or several values in a source file -corresponding to a parameter tag for generating one (in place or not) -or several files -} -\keyword{internal} diff --git a/man/set_codeoptim.Rd b/man/set_codeoptim.Rd deleted file mode 100644 index fed1fdb2..00000000 --- a/man/set_codeoptim.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_codeoptim.R -\name{set_codeoptim} -\alias{set_codeoptim} -\title{Set codoptim} -\usage{ -set_codeoptim(workspace, value = 1, file_name = "new_travail.usm") -} -\arguments{ -\item{workspace}{Path of the STICS inputs files of an usm} - -\item{value}{Value of the codeoptim parameter (1 = activating -parameters values forcing)} - -\item{file_name}{Name of the file} -} -\description{ -Change value of codeoptim in the new_travail.usm file -} -\examples{ -\dontrun{ - -ws <- "path/to/stics/workspace" -SticsRFiles:::set_codoptim(workspace = ws, value = 0) -} - -} -\keyword{internal} diff --git a/man/set_file_executable.Rd b/man/set_file_executable.Rd deleted file mode 100644 index 86ce5847..00000000 --- a/man/set_file_executable.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_file_executable.R -\name{set_file_executable} -\alias{set_file_executable} -\title{Setting a file to executable access mode} -\usage{ -set_file_executable(file_path) -} -\arguments{ -\item{file_path}{A file path} -} -\value{ -Execution status: TRUE for successful operation, FALSE otherwise -} -\description{ -Setting executable status on for a file under Linux or Mac OS. -} -\keyword{internal} diff --git a/man/set_file_txt.Rd b/man/set_file_txt.Rd deleted file mode 100644 index 65bd1c69..00000000 --- a/man/set_file_txt.Rd +++ /dev/null @@ -1,56 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_param_txt.R -\name{set_file_txt} -\alias{set_file_txt} -\title{Internal function to set some STICS input file parameters} -\usage{ -set_file_txt( - file, - param, - value, - append, - plant_id = NULL, - variety = NULL, - layer = NULL, - stics_version = "latest" -) -} -\arguments{ -\item{file}{Path to the parameter file} - -\item{param}{Parameter name} - -\item{value}{New parameter value} - -\item{append}{Boolean. Append input to existing file} - -\item{plant_id}{The plant identifier (main crop: 1 ; associated crop: 2).} - -\item{variety}{The plant variety to set the parameter value, -either the variety -name (\code{codevar} in the plant file) or the index -(\code{variete} in the technical file).} - -\item{layer}{The soil layer if any (only concerns soil-related parameters)} - -\item{stics_version}{An optional version name as listed in -get_stics_versions_compat() return} -} -\description{ -Replace or set an input parameter from a pre-existing -STICS input file. This function is called by some of the -generic \code{set_*} functions under the hood. -} -\details{ -The function uses \code{base::sys.call()} to know from which function -of the \code{set_*} family it is called, so it won't work properly -if called by the user directly. This is why this function -is internal. -} -\note{ -This function is not used for \code{\link{set_soil_txt}}. -} -\seealso{ -\code{\link{set_param_txt}}. -} -\keyword{internal} diff --git a/man/set_java_workspace.Rd b/man/set_java_workspace.Rd deleted file mode 100644 index 6396bf37..00000000 --- a/man/set_java_workspace.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_java_workspace.R -\name{set_java_workspace} -\alias{set_java_workspace} -\title{Setting JavaSTICS workspace} -\usage{ -set_java_workspace(javastics, workspace) -} -\arguments{ -\item{javastics}{JavaSTICS installation root folder} - -\item{workspace}{JavaSTICS working directory -(absolute,relative to javastics path)} -} -\description{ -Setting a new JavaSTICS working directory, a relative directory -to JavaSTICS path or an absolute one -} -\details{ -Checking if the directory is a JavaSTICS workspace -(any usms.xml file), and if it's already registered - -before setting new one -} -\examples{ -\dontrun{ -set_java_workspace("/path/to/JavaSTICS/folder", "my_wd") -set_java_workspace("/path/to/JavaSTICS/folder", "/path/to/my_wd") -} - -} -\keyword{internal} diff --git a/man/set_javastics_path.Rd b/man/set_javastics_path.Rd deleted file mode 100644 index 9ac8a0f9..00000000 --- a/man/set_javastics_path.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_path.R -\name{set_javastics_path} -\alias{set_javastics_path} -\title{Set JavaSTICS path in \code{javastics_path} environment variable} -\usage{ -set_javastics_path(javastics_path, write = FALSE) -} -\arguments{ -\item{javastics_path}{Absolute path of the root directory of JavaSTICS} - -\item{write}{boolean, TRUE if \code{javastics_path} has to be written in -a \code{.Renviron} file, FALSE otherwise} -} -\description{ -Set JavaSTICS path in \code{javastics_path} environment variable -} -\keyword{internal} diff --git a/man/set_param_txt.Rd b/man/set_param_txt.Rd index e456d053..65b8d0e1 100644 --- a/man/set_param_txt.Rd +++ b/man/set_param_txt.Rd @@ -13,7 +13,7 @@ \title{Set (replace) STICS input file parameters} \usage{ set_param_txt( - workspace = getwd(), + workspace, param, value, append = FALSE, @@ -162,8 +162,6 @@ To replace the output variables required from STICS, please directly call \code{gen_varmod}. } \examples{ -\dontrun{ - # Getting example data path path <- get_examples_path(file_type = "txt") @@ -181,11 +179,11 @@ set_param_txt(workspace = path, param = "durvieF", set_param_txt(workspace = path, param = "infil", layer = 2, value = 60) # If the parameter is found in several files, use the set_* -functions directly, e.g. cailloux is found in the general file -("codetycailloux") and the soil file. If we want to change its value -in the soil file, we use set_soil_txt(): +# functions directly, e.g. cailloux is found in the general file +# ("codecailloux") and the soil file. If we want to change its value +# in the soil file, we use set_soil_txt(): set_soil_txt(file = file.path(path, "param.sol"), param = "cailloux", layer = 2, value = 1) -} + } diff --git a/man/set_param_value.Rd b/man/set_param_value.Rd deleted file mode 100644 index 704a9978..00000000 --- a/man/set_param_value.Rd +++ /dev/null @@ -1,58 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_param_value.R -\name{set_param_value} -\alias{set_param_value} -\title{Setting parameter value for different kinds of parameters} -\usage{ -set_param_value( - xml_doc, - param_name, - param_value, - parent_name = NULL, - parent_sel_attr = NULL, - ... -) -} -\arguments{ -\item{xml_doc}{an xml_document object} - -\item{param_name}{parameter name} - -\item{param_value}{vector of parameter values, or a list of} - -\item{parent_name}{parent node name or attribute name (optional)} - -\item{parent_sel_attr}{parent attribute value (optional)} - -\item{ids}{elements indices (optional)} - -\item{show_xpath}{Print the xpath} -} -\value{ -A logical vector with successes status return -} -\description{ -Setting parameter value in a xml_document object -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) -SticsRFiles:::get_param_value(sols_doc, "argi") - - -# setting all argi parameters with the same value -SticsRFiles:::set_param_value(sols_doc, "argi", 15) -SticsRFiles:::get_param_value(sols_doc, "argi") - - -# setting specific values for some soils -SticsRFiles:::set_param_value(sols_doc, "argi", c(30, 35), - parent_name = "sol", parent_sel_attr = c("solcanne", "solbanane") -) -SticsRFiles:::get_param_value(sols_doc, "argi") - -} - -} -\keyword{internal} diff --git a/man/set_param_xml.Rd b/man/set_param_xml.Rd index 098efbba..7fe60b1e 100644 --- a/man/set_param_xml.Rd +++ b/man/set_param_xml.Rd @@ -69,64 +69,65 @@ a vector of values. For example, for two parameters with two values each: value= list(c(1,2), c(2.3,4.5)) } \examples{ -\dontrun{ + +ex_path <- get_examples_path(file_type = "xml") # Soil file -file.copy(file.path(get_examples_path(file_type = "xml"), - "sols.xml"), getwd()) +sol_path <- file.path(ex_path, "sols.xml") # For scalar parameters per soil # Setting all soils "argi" values to 50 -set_param_xml("sols.xml", "argi", 50, overwrite = TRUE) +set_param_xml(sol_path, "argi", 50, overwrite = TRUE) -get_param_xml("sols.xml", "argi") +get_param_xml(sol_path, "argi") # Setting a specific value to "argi" for "solcanne" soil -set_param_xml("sols.xml", "argi", 56, - select = "sol", select_value = "solcanne", overwrite = TRUE +set_param_xml(file = sol_path, param = "argi", values = 56, + select = "sol", select_value = "solcanne", overwrite = TRUE ) -get_param_xml("sols.xml", "argi", +get_param_xml(sol_path, "argi", select = "sol", select_value = "solcanne" ) # Setting a specific values to 2 parameters "argi" and # "norg" for "solcanne" soil -set_param_xml("sols.xml", c("argi", "norg"), list(100, 150), +set_param_xml(sol_path, c("argi", "norg"), list(100, 150), select = "sol", select_value = "solcanne", overwrite = TRUE ) -get_param_xml("sols.xml", c("argi", "norg"), +get_param_xml(sol_path, c("argi", "norg"), select = "sol", select_value = "solcanne" ) # For vector parameters per soil (5 values, one per soil layer) -set_param_xml("sols.xml", c("epc", "HCCF"), +set_param_xml(sol_path, c("epc", "HCCF"), select = "sol", select_value = c("solcanne", "solbanane"), param_value = list(c(20:24, 10:14), c(50:54, 40:44)), overwrite = TRUE ) -get_param_xml("sols.xml", c("epc", "HCCF"), +get_param_xml(sol_path, c("epc", "HCCF"), select = "sol", select_value = c("solcanne", "solbanane") ) # Crop management file -file.copy(file.path(get_examples_path(file_type = "xml"), - "file_tec.xml"), getwd()) + + +tec_path <- file.path(ex_path, "file_tec.xml") # Modifying irrigations parameters -set_param_xml("file_tec.xml", c("julapI_or_sum_upvt", "amount"), +set_param_xml(tec_path, c("julapI_or_sum_upvt", "amount"), param_value = list(200:215, 20:35), overwrite = TRUE ) -get_param_xml("file_tec.xml", c("julapI_or_sum_upvt", "amount")) -} +get_param_xml(tec_path, c("julapI_or_sum_upvt", "amount")) + } diff --git a/man/set_sols_param_xml.Rd b/man/set_sols_param_xml.Rd deleted file mode 100644 index 8a685586..00000000 --- a/man/set_sols_param_xml.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_sols_param_xml.R -\name{set_sols_param_xml} -\alias{set_sols_param_xml} -\title{Setting soil parameter(s) value(s) in a sols xml_document} -\usage{ -set_sols_param_xml(xml_doc_object, sols_param, overwrite = FALSE) -} -\arguments{ -\item{xml_doc_object}{an xml_document object (created from an xml sols file)} - -\item{sols_param}{soils parameters (data.frame)} - -\item{overwrite}{replace existing soil (TRUE) or not, -updating existing ones (FALSE)} -} -\description{ -Setting soil parameter(s) value(s) in a sols xml_document -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "sols.xml") -sols_doc <- SticsRFiles:::xmldocument(xml_path) - -xl_path <- file.path(get_examples_path(file_type = "xl"), - "inputs_stics_example.xlsx") -sols_df <- read_excel(xl_path, sheet = "Soils") - -# For updating an existing xml doc (using existing soils names) -# Creating a fake existing_doc -existing_doc <- SticsRFiles:::gen_usms_sols_doc("sols", nodes_nb = 3) -SticsRFiles:::set_param_value(existing_doc, - param_name = "sol", - param_value = sols_df$Soil_name[c(3, 1, 5)] -) - -SticsRFiles:::set_sols_param_xml(existing_doc, sols_df) - - -# For a new xml doc -# In that case: sols_df must contain all the soils parameters !) -soils_nb <- dim(sols_df)[1] -new_doc <- SticsRFiles:::gen_usms_sols_doc("sols", nodes_nb = soils_nb) - -SticsRFiles:::set_sols_param_xml(new_doc, sols_df, overwrite = TRUE) -} - -} -\keyword{internal} diff --git a/man/set_usms_param_xml.Rd b/man/set_usms_param_xml.Rd deleted file mode 100644 index e39aa183..00000000 --- a/man/set_usms_param_xml.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_usms_param_xml.R -\name{set_usms_param_xml} -\alias{set_usms_param_xml} -\title{Setting a usm param value(s) in an usms} -\usage{ -set_usms_param_xml(xml_doc_object, usms_param = NULL, overwrite = FALSE) -} -\arguments{ -\item{xml_doc_object}{an object (created from an usms file)} - -\item{usms_param}{usms parameters (data.frame)} - -\item{overwrite}{replace existing usms (TRUE) or not, -updating existing ones (FALSE)} -} -\description{ -Setting a usm param value(s) in an usms -} -\examples{ -\dontrun{ -xml_path <- file.path(get_examples_path(file_type = "xml"), "usms.xml") -usms_doc <- SticsRFiles:::xmldocument(xml_path) - -xl_path <- file.path(get_examples_path(file_type = "xl"), - "inputs_stics_example.xlsx") -usms_df <- read_excel(xl_path, sheet = "USMs") - -# For updating an existing xml doc (using existing usms names) -# Creating a fake existing_doc -existing_doc <- SticsRFiles:::gen_usms_sols_doc("usms", nodes_nb = 3) -SticsRFiles:::set_param_value(existing_doc, - param_name = "usm", - param_value = usms_df$usm_nom[c(3, 1, 5)] -) - -SticsRFiles:::set_usms_param_xml(existing_doc, usms_df) - - -# For a new xml doc -# In that case: usms_df must contain all the usms parameters ! -usms_nb <- dim(usms_df)[1] -new_doc <- SticsRFiles:::gen_usms_sols_doc("usms", nodes_nb = usms_nb) - -SticsRFiles:::set_usms_param_xml(new_doc, usms_df, overwrite = TRUE) -} - -} -\keyword{internal} diff --git a/man/set_versions_info.Rd b/man/set_versions_info.Rd deleted file mode 100644 index f4c9785e..00000000 --- a/man/set_versions_info.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{set_versions_info} -\alias{set_versions_info} -\title{Writing information about STICS versions and related example files -directories in the SticsRFiles library or package} -\usage{ -set_versions_info( - version_name, - location = "install", - overwrite = FALSE, - verbose = TRUE -) -} -\arguments{ -\item{version_name}{name (i.e. "VX.Y") of the version to add in versions -information} - -\item{location}{The destination where to write information "install" -for writing things in the installed SticsRFiles library (default), -"package" for writing them in the package project (in RStudio)} - -\item{overwrite}{A logical, TRUE to overwrite versions info file, -FALSE otherwise (default)} - -\item{verbose}{Logical, TRUE for displaying warnings (default), -FALSE otherwise} -} -\description{ -Writing information about STICS versions and related example files -directories in the SticsRFiles library or package -} -\keyword{internal} diff --git a/man/static_help.Rd b/man/static_help.Rd deleted file mode 100644 index a6a4e193..00000000 --- a/man/static_help.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/static_help.R -\name{static_help} -\alias{static_help} -\title{Generate html help from functions Rd help files} -\usage{ -static_help( - pkg, - links_level = 0, - topic = NULL, - out_dir = getwd(), - overwrite = TRUE -) -} -\arguments{ -\item{pkg}{Package name} - -\item{links_level}{integer, 0: inside the given package, 1: with base and -recommended packages, 2: other packages specified by .libPaths()} - -\item{topic}{Optional, selecting specific topics with their -names vector (functions names)} - -\item{out_dir}{Optional, where to store html functions help files} - -\item{overwrite}{Optional, logical TRUE for overwriting hmtl files (default), -FALSE otherwise} -} -\value{ -An invisible character vector of file paths -} -\description{ -Generate html help from functions Rd help files -} -\examples{ -\dontrun{ -static_help("SticsRFiles") -static_help(pkg = "SticsRFiles", out_dir = "/path/to/out/dir") -} -} -\keyword{internal} diff --git a/man/stics_class.Rd b/man/stics_class.Rd deleted file mode 100644 index 593f8c0e..00000000 --- a/man/stics_class.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_class} -\alias{stics_class} -\title{Get the class of a STICS object} -\usage{ -stics_class(name, env_name = sticsenv_name()) -} -\value{ -A vector of classes -} -\description{ -Get the class of a STICS object -} -\keyword{internal} diff --git a/man/stics_clean.Rd b/man/stics_clean.Rd deleted file mode 100644 index 045ace0e..00000000 --- a/man/stics_clean.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_clean} -\alias{stics_clean} -\title{Clean STICS environment} -\usage{ -stics_clean() -} -\value{ -Nothing. Just cleans the STICS environment. -} -\description{ -Clean STICS environment -} -\examples{ -\dontrun{ -stics_clean() -} -} -\keyword{internal} diff --git a/man/stics_env.Rd b/man/stics_env.Rd deleted file mode 100644 index bd4a4853..00000000 --- a/man/stics_env.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_env} -\alias{stics_env} -\title{Don't know what purpose this function serve} -\usage{ -stics_env(name = NULL, env_name = globalenv(), create = TRUE) -} -\arguments{ -\item{name}{Name of an object in an env OR env name ??? (optional)} - -\item{env_name}{The environment name} - -\item{create}{Create the environment name} -} -\description{ -Too complicated, does so many things I don't know what to tell -about this function. Patrice, can you write the doc, or simplify -the interface ? -} -\keyword{internal} diff --git a/man/stics_exists.Rd b/man/stics_exists.Rd deleted file mode 100644 index da325650..00000000 --- a/man/stics_exists.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_exists} -\alias{stics_exists} -\title{Is object part of STICS env} -\usage{ -stics_exists(name = NULL, env_name = sticsenv_name()) -} -\arguments{ -\item{name}{Name of the object in the STICS environment} - -\item{env_name}{The name of the STICS environment} -} -\value{ -A boolean, \code{TRUE} if the object is in the env, \code{FALSE} otherwise. -} -\description{ -Test if an object is in a STICS environment -} -\keyword{internal} diff --git a/man/stics_get.Rd b/man/stics_get.Rd deleted file mode 100644 index c1e90ff5..00000000 --- a/man/stics_get.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_get} -\alias{stics_get} -\title{Get object from STICS env} -\usage{ -stics_get(name = NULL, env_name = sticsenv_name()) -} -\arguments{ -\item{name}{Name of the object in the STICS environment} - -\item{env_name}{The name of the STICS environment} -} -\value{ -The object value. -} -\description{ -Get an object from the STICS environment -} -\keyword{internal} diff --git a/man/stics_remove.Rd b/man/stics_remove.Rd deleted file mode 100644 index aa47382d..00000000 --- a/man/stics_remove.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_remove} -\alias{stics_remove} -\title{Remove objects from STICS environment} -\usage{ -stics_remove(name = NULL, env_name = sticsenv_name()) -} -\value{ -Nothing. Just removes an object from the STICS environment. -} -\description{ -Remove objects listed in a STICS environment. -} -\examples{ -\dontrun{ -stics_remove() -} -} -\keyword{internal} diff --git a/man/stics_set.Rd b/man/stics_set.Rd deleted file mode 100644 index 8c45f5a5..00000000 --- a/man/stics_set.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_set} -\alias{stics_set} -\title{Add to STICS env} -\usage{ -stics_set(name, value, env_name = sticsenv_name()) -} -\arguments{ -\item{name}{Name of the object used in the STICS environment} - -\item{value}{Value to associate to the object} - -\item{env_name}{The name of the STICS environment} -} -\value{ -Nothing. Just adds an object to the given environment. -} -\description{ -Add an object to the STICS environment -} -\keyword{internal} diff --git a/man/stics_split_list.Rd b/man/stics_split_list.Rd deleted file mode 100644 index 3ab7c7bd..00000000 --- a/man/stics_split_list.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{stics_split_list} -\alias{stics_split_list} -\title{Split STICS names} -\usage{ -stics_split_list(name) -} -\value{ -A vector of names -} -\description{ -Split STICS names by "$" -} -\keyword{internal} diff --git a/man/sticsenv_create.Rd b/man/sticsenv_create.Rd deleted file mode 100644 index ef5ae97b..00000000 --- a/man/sticsenv_create.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{sticsenv_create} -\alias{sticsenv_create} -\title{Create a new STICS environment} -\usage{ -sticsenv_create(name, env_name = ".GlobalEnv") -} -\arguments{ -\item{name}{The name of the STICS environment} - -\item{env_name}{The name of the parent environment} -} -\value{ -The new environment -} -\description{ -Create a new STICS environment -} -\keyword{internal} diff --git a/man/sticsenv_get_name.Rd b/man/sticsenv_get_name.Rd deleted file mode 100644 index e857b1bf..00000000 --- a/man/sticsenv_get_name.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{sticsenv_get_name} -\alias{sticsenv_get_name} -\title{Get STICS env name from object} -\usage{ -sticsenv_get_name(name = NULL, env_name = sticsenv_name()) -} -\arguments{ -\item{name}{The name of an object potentially found in a STICS environment} - -\item{env_name}{The name of the STICS environment} -} -\value{ -A vector of environment names -} -\description{ -Get the name of the environment where an object is found -} -\keyword{internal} diff --git a/man/sticsenv_ls.Rd b/man/sticsenv_ls.Rd deleted file mode 100644 index a2bc2a65..00000000 --- a/man/sticsenv_ls.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{sticsenv_ls} -\alias{sticsenv_ls} -\title{List STICS env} -\usage{ -sticsenv_ls(name = NULL, env_name = sticsenv_name(), detail = FALSE) -} -\arguments{ -\item{name}{Optionally, the name of an object in the STICS environment} - -\item{env_name}{The name of the STICS environment} - -\item{detail}{Return all details ? (use \code{ls.str()})} -} -\value{ -A vector of all object names in the environment -} -\description{ -List all objects in a STICS environment -} -\keyword{internal} diff --git a/man/sticsenv_name.Rd b/man/sticsenv_name.Rd deleted file mode 100644 index 1d2ab82f..00000000 --- a/man/sticsenv_name.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{sticsenv_name} -\alias{sticsenv_name} -\title{STICS env name} -\usage{ -sticsenv_name() -} -\value{ -The default STICS env name -} -\description{ -Get the default STICS environment name -} -\keyword{internal} diff --git a/man/sticsenv_set_name.Rd b/man/sticsenv_set_name.Rd deleted file mode 100644 index 72172bf9..00000000 --- a/man/sticsenv_set_name.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_environment.R -\name{sticsenv_set_name} -\alias{sticsenv_set_name} -\title{Replace STICS env name} -\usage{ -sticsenv_set_name(name, env_name = sticsenv_name(), fix_name = NULL) -} -\arguments{ -\item{name}{The name of an object potentially found in a STICS environment} - -\item{env_name}{The name of the STICS environment} - -\item{fix_name}{Fix the name of the environment to \code{fix_name}, -or to \code{paste0("R_", name)} if \code{NULL} (default).} -} -\value{ -The new environment -} -\description{ -Set the name of the environment where an object is found -} -\keyword{internal} diff --git a/man/sub-.cropr_simulation.Rd b/man/sub-.cropr_simulation.Rd index f3dd4fcf..9cc044e3 100644 --- a/man/sub-.cropr_simulation.Rd +++ b/man/sub-.cropr_simulation.Rd @@ -19,9 +19,8 @@ This method ensure keeping the \code{cropr_simulation} attribute when subsetting \code{cropr_simulation} list. } \examples{ -\dontrun{ -library(SticsRFiles) -sim <- SticsRFiles::get_sim(workspace = "inst/extdata/stics_example_1") -sim[[1]] # returns a `cropr_simulation` list -} +path <- file.path(get_examples_path("sti"), "workspace1") +sim <- SticsRFiles::get_sim(workspace = path) +# sim returns a `cropr_simulation` list + } diff --git a/man/unzip_examples.Rd b/man/unzip_examples.Rd deleted file mode 100644 index cf64fa62..00000000 --- a/man/unzip_examples.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/stics_examples_utils.R -\name{unzip_examples} -\alias{unzip_examples} -\title{Unzip files archive if needed and return examples files path -in extdata directory} -\usage{ -unzip_examples(files_type, version_dir) -} -\arguments{ -\item{version_dir}{version directory names of the example files} - -\item{examples_type_path}{library path for examples files set} -} -\value{ -library examples files path -} -\description{ -Unzip files archive if needed and return examples files path -in extdata directory -} -\keyword{internal} diff --git a/man/update_stics_version.Rd b/man/update_stics_version.Rd deleted file mode 100644 index 7df76007..00000000 --- a/man/update_stics_version.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/manage_stics_versions.R -\name{update_stics_version} -\alias{update_stics_version} -\title{Updating csv files for a given version} -\usage{ -update_stics_version( - version_name, - url, - file_name = "all", - location = "install", - verbose = FALSE -) -} -\arguments{ -\item{version_name}{name (i.e. "VX.Y") of the version} - -\item{url}{Subversion repository address of the branch, tag to get -information from} - -\item{file_name}{File name(s)} - -\item{location}{The destination where to write information "install" -for writing things in the installed SticsRFiles library (default), -"package" for writing them in the package project (in RStudio)} - -\item{verbose}{Logical, TRUE for displaying warnings, FALSE otherwise} -} -\value{ -An invisible data.frame containing versions data in the -SticsRFiles library (or package) -} -\description{ -Updating csv files for a given version -} -\examples{ -\dontrun{ -SticsRFiles:::update_stics_version( - version_name = "V10.0", - url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10" -) - -SticsRFiles:::update_stics_version( - version_name = "V10.0", - url = "https://w3.avignon.inra.fr/svn/modulostics/branches/branch10", - location = "package" -) -} -} -\keyword{internal} diff --git a/man/upgrade_ini_xml.Rd b/man/upgrade_ini_xml.Rd index d9e0523d..15f8faaa 100644 --- a/man/upgrade_ini_xml.Rd +++ b/man/upgrade_ini_xml.Rd @@ -47,11 +47,13 @@ Upgrading _ini.xml file(s) to a newer version 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( - file = "/path/to/_ini.xml", - out_dir = "/path/to/directory", - param_gen_file = "/path/to/param_gen.xml" + file = file.path(dir_path,"file_ini.xml"), + out_dir = tempdir(), + param_gen_file = file.path(dir_path, "param_gen.xml") ) -} + } diff --git a/man/upgrade_param_gen_xml.Rd b/man/upgrade_param_gen_xml.Rd index ddccd839..ec82b0c6 100644 --- a/man/upgrade_param_gen_xml.Rd +++ b/man/upgrade_param_gen_xml.Rd @@ -37,13 +37,13 @@ None Upgrading a param_gen.xml file to a newer version } \details{ -See SticsRFiles::get_stics_versions_compat() for listing versions +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( - file = "/path/to/param_gen.xml", - out_dir = "/path/to/directory" + file = file.path(dir_path, "param_gen.xml"), + out_dir = tempdir() ) } -} diff --git a/man/upgrade_param_newform_xml.Rd b/man/upgrade_param_newform_xml.Rd index bb55af12..913e1c22 100644 --- a/man/upgrade_param_newform_xml.Rd +++ b/man/upgrade_param_newform_xml.Rd @@ -44,11 +44,13 @@ Upgrading a param_newform.xml file to a newer version 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( - file = "/path/to/param_newform.xml", - out_dir = "/path/to/directory", - param_gen_file = "/path/to/param_gen.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_plt_xml.Rd b/man/upgrade_plt_xml.Rd index da4efbf7..27241852 100644 --- a/man/upgrade_plt_xml.Rd +++ b/man/upgrade_plt_xml.Rd @@ -48,15 +48,17 @@ None Upgrading _plt.xml file(s) to a newer version } \details{ -See SticsRFiles::get_stics_versions_compat() for listing versions +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( - file = "/path/to/_plt.xml", - param_gen_file = "/path/to/param_gen.xml", - param_newform_file = "/path/to/param_newform.xml", - out_dir = "/path/to/directory" + 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") ) -} + } diff --git a/man/upgrade_sols_xml.Rd b/man/upgrade_sols_xml.Rd index 6df2e27e..0eebae20 100644 --- a/man/upgrade_sols_xml.Rd +++ b/man/upgrade_sols_xml.Rd @@ -44,11 +44,13 @@ Upgrading a sols.xml file to a newer version 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( - file = "/path/to/sols.xml", - param_gen_file = "/path/to/param_gen.xml", - out_dir = "/path/to/an/output/directory" + file = file.path(dir_path,"sols.xml" ), + out_dir = tempdir(), + param_gen_file = file.path(dir_path, "param_gen.xml") ) -} + } diff --git a/man/upgrade_sta_xml.Rd b/man/upgrade_sta_xml.Rd index 1a2a3ebb..3baa2681 100644 --- a/man/upgrade_sta_xml.Rd +++ b/man/upgrade_sta_xml.Rd @@ -47,11 +47,13 @@ Upgrading _sta.xml file(s) to a newer version 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( - file = "/path/to/_sta.xml", - out_dir = "/path/to/directory", - param_gen_file = "/path/to/param_gen.xml" + file = file.path(dir_path,"file_sta.xml" ), + out_dir = tempdir(), + param_gen_file = file.path(dir_path, "param_gen.xml") ) -} + } diff --git a/man/upgrade_tec_xml.Rd b/man/upgrade_tec_xml.Rd index 8e990d11..d80b8b4d 100644 --- a/man/upgrade_tec_xml.Rd +++ b/man/upgrade_tec_xml.Rd @@ -48,15 +48,18 @@ None Upgrading _tec.xml file(s) to a newer version } \details{ -See SticsRFiles::get_stics_versions_compat() for listing versions +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( - file = "/path/to/_tec.xml", - out_dir = "/path/to/directory", - param_newform_file = "/path/to/param_newform.xml", - param_gen_file = "/path/to/param_gen.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") ) -} + + } diff --git a/man/upgrade_usms_xml.Rd b/man/upgrade_usms_xml.Rd index 36bc4d53..d27bdc59 100644 --- a/man/upgrade_usms_xml.Rd +++ b/man/upgrade_usms_xml.Rd @@ -44,15 +44,16 @@ None Upgrading a usms.xml file to a newer version } \details{ -See SticsRFiles::get_stics_versions_compat() for listing versions +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( - file = "/path/to/usms.xml", - out_dir = "/path/to/directory", - param_gen_file = "/path/to/param_gen.xml", - obs_dir = "/path/to/obs/directory" + file = file.path(dir_path,"usms.xml"), + out_dir = tempdir(), + param_gen_file = file.path(dir_path, "param_gen.xml") ) -} + } diff --git a/man/var_to_col_names.Rd b/man/var_to_col_names.Rd deleted file mode 100644 index 19662d00..00000000 --- a/man/var_to_col_names.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/var_to_col_names.R -\name{var_to_col_names} -\alias{var_to_col_names} -\title{Convert STICS variables names, or generated column names to -valid conventional column names.} -\usage{ -var_to_col_names(var_vec) -} -\arguments{ -\item{var_vec}{Valid names vector} -} -\value{ -Vector of formatted column names -} -\description{ -Change STICS variables names as valid variable R name -Like \code{varname(n)} or \code{varname.n.} to \code{varname_n}. -Other names are unchanged (i.e.: varname, varname_n, ...) -} -\examples{ -var_names <- c("var1", "var2(n)", "var2.n.") -valid_names <- SticsRFiles:::var_to_col_names(var_names) -} -\keyword{internal} diff --git a/man/var_to_stics_name.Rd b/man/var_to_stics_name.Rd deleted file mode 100644 index 224d23a4..00000000 --- a/man/var_to_stics_name.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/var_to_col_names.R -\name{var_to_stics_name} -\alias{var_to_stics_name} -\title{Variable name to STICS variable name} -\usage{ -var_to_stics_name(var, version = "latest") -} -\arguments{ -\item{var}{Vector of variable names} - -\item{version}{STICS version.} -} -\value{ -A vector of variable names compatible with STICS -(usually used for \code{gen_varmod()}) -} -\description{ -Convert a variable name into a STICS-compatible variable name. -E.g. \code{lai_n} into \code{lai(n)}. -} -\examples{ -\dontrun{ -var_to_stics_name(c("lai_n", "masec_n")) -} - -} -\seealso{ -\code{gen_varmod()} -} -\keyword{internal} diff --git a/man/write_javastics_path.Rd b/man/write_javastics_path.Rd deleted file mode 100644 index 7a967f2b..00000000 --- a/man/write_javastics_path.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/javastics_path.R -\name{write_javastics_path} -\alias{write_javastics_path} -\title{Write the \code{javastics_path} variable in a \code{.Renviron} file, or replace its -content if it already exists.} -\usage{ -write_javastics_path(javastics_path) -} -\arguments{ -\item{javastics_path}{Absolute path of the root directory of JavaSTICS} -} -\description{ -Write the \code{javastics_path} variable in a \code{.Renviron} file, or replace its -content if it already exists. -} -\keyword{internal} diff --git a/tests/testthat/test-check_java_path.R b/tests/testthat/test-check_java_path.R index 36d7fa97..5447f687 100644 --- a/tests/testthat/test-check_java_path.R +++ b/tests/testthat/test-check_java_path.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() workspace_path <- get_examples_path("xml", stics_version = stics_version) diff --git a/tests/testthat/test-convert_xml2txt.R b/tests/testthat/test-convert_xml2txt.R index eeaaccd1..5790becd 100644 --- a/tests/testthat/test-convert_xml2txt.R +++ b/tests/testthat/test-convert_xml2txt.R @@ -5,12 +5,12 @@ xml_plt <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") xsl_file <- file.path(get_examples_path(file_type = "xsl"), "xml2txt.xsl") out_dir <- file.path(tempdir(), "Test_Convert") if (!dir.exists(out_dir)) dir.create(out_dir) -SticsRFiles:::convert_xml2txt_int(xml_file = xml_plt, +convert_xml2txt_int(xml_file = xml_plt, style_file = xsl_file, - file.path(out_dir,"ficplt.txt")) + file.path(out_dir, "ficplt.txt")) context("Convert file type") test_that("Convert xml file to txt file", { - expect_true(file.exists(file.path(out_dir,"ficplt.txt"))) + expect_true(file.exists(file.path(out_dir, "ficplt.txt"))) }) diff --git a/tests/testthat/test-exist_param_xml.R b/tests/testthat/test-exist_param_xml.R index 74580ca9..12afac5f 100644 --- a/tests/testthat/test-exist_param_xml.R +++ b/tests/testthat/test-exist_param_xml.R @@ -1,6 +1,5 @@ -library(SticsRFiles) -stics_version <- SticsRFiles:::get_stics_versions_compat()$latest_version +stics_version <- get_stics_versions_compat()$latest_version context("Exist param ") diff --git a/tests/testthat/test-expand_stics_names.R b/tests/testthat/test-expand_stics_names.R index 289ac42b..9b1ed21b 100644 --- a/tests/testthat/test-expand_stics_names.R +++ b/tests/testthat/test-expand_stics_names.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Creating a file containing expanded stics names") @@ -11,7 +11,7 @@ csv_file <- file.path(workspace_path, "inputs.csv") out_dir <- file.path(tempdir(), "CSVexport") if (!dir.exists(out_dir)) dir.create(out_dir) out_csv_file <- file.path(out_dir, "inputs_xpanded.csv") -SticsRFiles:::expand_stics_names(csv_file, out_csv_file) +expand_stics_names(csv_file, out_csv_file) test_that("expanded names", { expect_true(file.exists(file.path(out_dir, "inputs_xpanded.csv"))) diff --git a/tests/testthat/test-gen_ini_xml.R b/tests/testthat/test-gen_ini_xml.R index f30c9901..9c0bc3d2 100644 --- a/tests/testthat/test-gen_ini_xml.R +++ b/tests/testthat/test-gen_ini_xml.R @@ -3,7 +3,7 @@ library(dplyr) stics_version <- get_stics_versions_compat()$latest_version -if (SticsRFiles:::get_version_num(stics_version = stics_version) +if (get_version_num(stics_version = stics_version) >= 10) { stics_version <- "V10.0" } diff --git a/tests/testthat/test-gen_paramsti.R b/tests/testthat/test-gen_paramsti.R index ce26223a..2cb4b51b 100644 --- a/tests/testthat/test-gen_paramsti.R +++ b/tests/testthat/test-gen_paramsti.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Creating an xml station file to latest version") diff --git a/tests/testthat/test-gen_sols_xml.R b/tests/testthat/test-gen_sols_xml.R index 8cff0876..7a52a102 100644 --- a/tests/testthat/test-gen_sols_xml.R +++ b/tests/testthat/test-gen_sols_xml.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Creating an xml soils file to latest version") diff --git a/tests/testthat/test-gen_sta_xml.R b/tests/testthat/test-gen_sta_xml.R index 4118fd26..0f802f70 100644 --- a/tests/testthat/test-gen_sta_xml.R +++ b/tests/testthat/test-gen_sta_xml.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Creating an xml station file to latest version") diff --git a/tests/testthat/test-gen_usms_xml.R b/tests/testthat/test-gen_usms_xml.R index b5e2cb20..5cb8001c 100644 --- a/tests/testthat/test-gen_usms_xml.R +++ b/tests/testthat/test-gen_usms_xml.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Creating an xml usms file to latest version") diff --git a/tests/testthat/test-get_climate_txt.R b/tests/testthat/test-get_climate_txt.R index a59a69f9..56b94a09 100644 --- a/tests/testthat/test-get_climate_txt.R +++ b/tests/testthat/test-get_climate_txt.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Counting rows of climate file") diff --git a/tests/testthat/test-get_obs_txt.R b/tests/testthat/test-get_obs_txt.R index e25247a0..f9db7037 100644 --- a/tests/testthat/test-get_obs_txt.R +++ b/tests/testthat/test-get_obs_txt.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Read obs file") diff --git a/tests/testthat/test-get_option_choice_param_values.R b/tests/testthat/test-get_option_choice_param_values.R index 953d3c74..155bb6fc 100644 --- a/tests/testthat/test-get_option_choice_param_values.R +++ b/tests/testthat/test-get_option_choice_param_values.R @@ -1,12 +1,12 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Get parameter names for an option choice value") xml_path <- file.path(get_examples_path(file_type = "xml"), "file_plt.xml") -SticsRFiles:::get_option_choice_param_values(xml_path, "codetemp", "2") +get_option_choice_param_values(xml_path, "codetemp", "2") test_that("Option choice", { expect_equal( length( diff --git a/tests/testthat/test-get_options_names.R b/tests/testthat/test-get_options_names.R index b7a78f9d..b0d71a18 100644 --- a/tests/testthat/test-get_options_names.R +++ b/tests/testthat/test-get_options_names.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("Reaserching option names") diff --git a/tests/testthat/test-get_param_info.R b/tests/testthat/test-get_param_info.R index 3ba186c1..e09ccfda 100644 --- a/tests/testthat/test-get_param_info.R +++ b/tests/testthat/test-get_param_info.R @@ -8,7 +8,7 @@ test_that("unknown name (should return NULL)", { }) test_that("fuzzy name", { - if (SticsRFiles:::get_version_num() < 10) { + if (get_version_num() < 10) { lai_params <- c( "lai0", "codelaitr", "codlainet", "dlaimax", "dlaimaxbrut", "dlaimin", diff --git a/tests/testthat/test-get_param_ini.R b/tests/testthat/test-get_param_ini.R index 8faa6809..cbca3b61 100644 --- a/tests/testthat/test-get_param_ini.R +++ b/tests/testthat/test-get_param_ini.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_names_xml.R b/tests/testthat/test-get_param_names_xml.R index de719aab..840d1f0b 100644 --- a/tests/testthat/test-get_param_names_xml.R +++ b/tests/testthat/test-get_param_names_xml.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num(stics_version = stics_version) +version_num <- get_version_num(stics_version = stics_version) xml_dir <- get_examples_path("xml", stics_version = stics_version) xml_plt <- file.path(xml_dir, "file_plt.xml") diff --git a/tests/testthat/test-get_param_newform.R b/tests/testthat/test-get_param_newform.R index b4477fd1..ed4c1db2 100644 --- a/tests/testthat/test-get_param_newform.R +++ b/tests/testthat/test-get_param_newform.R @@ -2,7 +2,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_plt.R b/tests/testthat/test-get_param_plt.R index e052bdb4..248f30c6 100644 --- a/tests/testthat/test-get_param_plt.R +++ b/tests/testthat/test-get_param_plt.R @@ -1,7 +1,6 @@ -library(SticsRFiles) -stics_version <- SticsRFiles:::get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +stics_version <- get_stics_versions_compat()$latest_version +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_sols.R b/tests/testthat/test-get_param_sols.R index 06291141..dcb0273f 100644 --- a/tests/testthat/test-get_param_sols.R +++ b/tests/testthat/test-get_param_sols.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_sta.R b/tests/testthat/test-get_param_sta.R index 71616ec7..fe8b8d75 100644 --- a/tests/testthat/test-get_param_sta.R +++ b/tests/testthat/test-get_param_sta.R @@ -1,7 +1,7 @@ -library(SticsRFiles) + stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_tec.R b/tests/testthat/test-get_param_tec.R index d3ed5102..c55bbcd9 100644 --- a/tests/testthat/test-get_param_tec.R +++ b/tests/testthat/test-get_param_tec.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_param_usms.R b/tests/testthat/test-get_param_usms.R index 1932d3c6..11ea392c 100644 --- a/tests/testthat/test-get_param_usms.R +++ b/tests/testthat/test-get_param_usms.R @@ -1,7 +1,7 @@ -library(SticsRFiles) + stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_path <- file.path( diff --git a/tests/testthat/test-get_sim.R b/tests/testthat/test-get_sim.R index 8ebe3de4..a41f0ad7 100644 --- a/tests/testthat/test-get_sim.R +++ b/tests/testthat/test-get_sim.R @@ -1,7 +1,7 @@ stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("get model outputs") diff --git a/tests/testthat/test-get_sols_list.R b/tests/testthat/test-get_sols_list.R index 33ceffa7..c332b4cb 100644 --- a/tests/testthat/test-get_sols_list.R +++ b/tests/testthat/test-get_sols_list.R @@ -1,7 +1,7 @@ library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() xml_sols <- file.path( get_examples_path("xml", stics_version = stics_version), diff --git a/tests/testthat/test-get_var_info.R b/tests/testthat/test-get_var_info.R index 1b6a221e..efb90202 100644 --- a/tests/testthat/test-get_var_info.R +++ b/tests/testthat/test-get_var_info.R @@ -3,7 +3,7 @@ context("searching variables information") # fixing version to latest standard one stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() stics_prev_version <- get_stics_versions_compat(-1) diff --git a/tests/testthat/test-get_xml_doc_example.R b/tests/testthat/test-get_xml_doc_example.R index 50f5d19a..3929689d 100644 --- a/tests/testthat/test-get_xml_doc_example.R +++ b/tests/testthat/test-get_xml_doc_example.R @@ -1,13 +1,12 @@ -library(SticsRFiles) stics_version <- get_stics_versions_compat()$latest_version -version_num <- SticsRFiles:::get_version_num() +version_num <- get_version_num() context("get example doc") -usm_doc <- SticsRFiles:::get_xml_doc_example("usms.xml") +usm_doc <- get_xml_doc_example("usms.xml") test_that("get example doc", { expect_equal(usm_doc@name, "usms.xml") - expect_error(SticsRFiles:::get_xml_doc_example("usm.xml")) - expect_equal(length(unlist(SticsRFiles:::get_xml_doc_example())), 8) + expect_error(get_xml_doc_example("usm.xml")) + expect_equal(length(unlist(get_xml_doc_example())), 8) }) diff --git a/tests/testthat/test-keepattr.R b/tests/testthat/test-keepattr.R index a526708f..8d3a8c0d 100644 --- a/tests/testthat/test-keepattr.R +++ b/tests/testthat/test-keepattr.R @@ -8,5 +8,5 @@ situations <- SticsRFiles::get_usms_list(file = file.path( sim <- SticsRFiles::get_sim(workspace = workspace, usm = situations) test_that("cropr_simulation attribute is kept", { - expect_s3_class(sim[1], "cropr_simulation") + expect_s3_class(sim, "cropr_simulation") }) diff --git a/vignettes/Generating_Stics_XML_files.Rmd b/vignettes/Generating_Stics_XML_files.Rmd index 68f50bfa..bfcbe0b3 100644 --- a/vignettes/Generating_Stics_XML_files.Rmd +++ b/vignettes/Generating_Stics_XML_files.Rmd @@ -164,7 +164,7 @@ in some cases used parameters names in tables may be different from real paramet Here is the actual **correspondence table** of `keywords` to be used in parameters tables (i.e excel files for example) in replacement of real names in XML files: ```{r echo=FALSE, eval=TRUE, fig.align='center'} -l <- get_params_dict() +l <- SticsRFiles:::get_params_dict() df <- data.frame(keyword = names(l), realname = unlist(l, use.names = FALSE), stringsAsFactors = FALSE) rmarkdown::paged_table(df)