Skip to content

Commit

Permalink
New release 1.2.0 (#20)
Browse files Browse the repository at this point in the history
* updates: added new JavaStics version/java version, info about how to handle the stics exe generation under MacOS (ref to the JavaStics doc), fixed internal page links.
Fix: mask messages about common names of the SticsRFiles and xml2 xml_document class name.

* Update CITATION.cff

* updates for a new release + little fix about a note about a global variable "."

* Update CITATION.cff

* fix: SticsRFiles in imports

* Update CITATION.cff

* SticsRFiles in suggests

* Update CITATION.cff

* trying to force main install in checks as in CroptimizR

* let SticsRFiles in Imports and Remotes

* Update CITATION.cff

* restoring previous install config for SticsRFiles@main

* SticsRFiles again in Imports

* Update CITATION.cff

* new release 1.2.0

* Update CITATION.cff

---------

Co-authored-by: plecharpent <[email protected]>
  • Loading branch information
plecharpent and plecharpent authored Feb 23, 2024
1 parent 4cd5168 commit 85c3582
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 162 deletions.
88 changes: 52 additions & 36 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "SticsOnR" in publications use:'
type: software
license: LGPL-3.0-or-later
title: 'SticsOnR: Manage STICS Simulations Running the Executable or JavaStics,'
version: 1.1.0
version: 1.2.0
abstract: 'Running simulations with the ''STICS'' crop model. Different ways of performing
simulations are available and based on three use-cases: 1/ Calling ''JavaStics''
command line to run simulations on given situations. ''JavaStics'' handles text
Expand Down Expand Up @@ -37,7 +37,7 @@ authors:
orcid: https://orcid.org/0000-0002-9310-2377
repository-code: https://github.com/SticsRPacks/SticsOnR
url: https://doi.org/10.5281/zenodo.4443130
date-released: '2023-07-12'
date-released: '2024-02-22'
contact:
- family-names: Lecharpentier
given-names: Patrice
Expand All @@ -52,7 +52,7 @@ references:
- name: R Core Team
location:
name: Vienna, Austria
year: '2023'
year: '2024'
institution:
name: R Foundation for Statistical Computing
version: '>= 3.6.0'
Expand All @@ -66,7 +66,7 @@ references:
- family-names: Csárdi
given-names: Gábor
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: crayon
abstract: 'crayon: Colored Terminal Output'
Expand All @@ -77,7 +77,7 @@ references:
- family-names: Csárdi
given-names: Gábor
email: [email protected]
year: '2023'
year: '2024'
version: '>= 1.3.4'
- type: software
title: doParallel
Expand All @@ -90,7 +90,7 @@ references:
given-names: Microsoft
- family-names: Weston
given-names: Steve
year: '2023'
year: '2024'
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
Expand All @@ -114,7 +114,7 @@ references:
given-names: Davis
email: [email protected]
orcid: https://orcid.org/0000-0003-4777-038X
year: '2023'
year: '2024'
- type: software
title: foreach
abstract: 'foreach: Provides Foreach Looping Construct'
Expand All @@ -125,7 +125,7 @@ references:
- name: Microsoft
- family-names: Weston
given-names: Steve
year: '2023'
year: '2024'
- type: software
title: lifecycle
abstract: 'lifecycle: Manage the Life Cycle of your Package Functions'
Expand All @@ -135,12 +135,12 @@ references:
authors:
- family-names: Henry
given-names: Lionel
email: lionel@rstudio.com
email: lionel@posit.co
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
email: hadley@posit.co
orcid: https://orcid.org/0000-0003-4757-117X
year: '2023'
year: '2024'
- type: software
title: magrittr
abstract: 'magrittr: A Forward-Pipe Operator for R'
Expand All @@ -154,7 +154,7 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: parallel
abstract: 'R: A Language and Environment for Statistical Computing'
Expand All @@ -163,7 +163,7 @@ references:
- name: R Core Team
location:
name: Vienna, Austria
year: '2023'
year: '2024'
institution:
name: R Foundation for Statistical Computing
- type: software
Expand All @@ -185,7 +185,7 @@ references:
- family-names: Ritchie
given-names: Gary
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: stats
abstract: 'R: A Language and Environment for Statistical Computing'
Expand All @@ -194,9 +194,40 @@ references:
- name: R Core Team
location:
name: Vienna, Austria
year: '2023'
year: '2024'
institution:
name: R Foundation for Statistical Computing
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Imports
url: https://tibble.tidyverse.org/
repository: https://CRAN.R-project.org/package=tibble
authors:
- family-names: Müller
given-names: Kirill
email: [email protected]
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2024'
- type: software
title: tidyr
abstract: 'tidyr: Tidy Messy Data'
notes: Imports
url: https://tidyr.tidyverse.org
repository: https://CRAN.R-project.org/package=tidyr
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
- family-names: Vaughan
given-names: Davis
email: [email protected]
- family-names: Girlich
given-names: Maximilian
year: '2024'
- type: software
title: SticsRFiles
abstract: 'SticsRFiles: Read and Modify ''STICS'' Input/Output Files'
Expand All @@ -220,23 +251,8 @@ references:
given-names: Michel
email: [email protected]
orcid: https://orcid.org/0000-0002-9310-2377
year: '2023'
year: '2024'
version: '>= 1.1.3'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Imports
url: https://tibble.tidyverse.org/
repository: https://CRAN.R-project.org/package=tibble
authors:
- family-names: Müller
given-names: Kirill
email: [email protected]
orcid: https://orcid.org/0000-0002-1416-3412
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
- type: software
title: covr
abstract: 'covr: Test Coverage for Packages'
Expand All @@ -247,7 +263,7 @@ references:
- family-names: Hester
given-names: Jim
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
Expand All @@ -259,7 +275,7 @@ references:
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
year: '2023'
year: '2024'
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
Expand Down Expand Up @@ -302,7 +318,7 @@ references:
given-names: Richard
email: [email protected]
orcid: https://orcid.org/0000-0003-3925-190X
year: '2023'
year: '2024'
- type: software
title: spelling
abstract: 'spelling: Tools for Spell Checking in R'
Expand All @@ -317,7 +333,7 @@ references:
- family-names: Hester
given-names: Jim
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
Expand All @@ -328,4 +344,4 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: SticsOnR
Title: Manage STICS Simulations Running the Executable or JavaStics,
Version: 1.1.0
Date: 2023-07-12
Version: 1.2.0
Date: 2024-02-22
Authors@R: c(
person("Patrice", "Lecharpentier", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-4044-4322")),
Expand Down Expand Up @@ -46,9 +46,9 @@ Imports:
parallel,
rstudioapi,
stats,
SticsRFiles (>= 1.1.3),
tibble,
tidyr
tidyr,
SticsRFiles (>= 1.1.3)
Suggests:
covr,
knitr,
Expand All @@ -61,4 +61,4 @@ ByteCompile: true
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.3.1
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(run_stics)
export(stics_wrapper)
export(stics_wrapper_options)
importFrom(doParallel,registerDoParallel)
importFrom(foreach,"%do%")
importFrom(foreach,"%dopar%")
importFrom(magrittr,"%>%")
importFrom(parallel,clusterCall)
Expand Down
17 changes: 17 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# SticsOnR 1.2.0 _2024-02-22_

MAIN CHANGES:
* paralellization in the wrapper is now optional (cluster deactivation)
* README update with latest JavaStics/STICS versions and information
about executable installation on MacOS systems


FIXES:
* tidyr package was missing in imports
* checking if the JavaStics folder is given when forcing parameters values
in the wrapper
* for several years simulations, the wrapper now is returning specific values
for stages for each year, not the same one for all the years
* limitation of sub-dirs discovering (recursivity deactivated) in the
workspace for the run_system function

# SticsOnR 1.1.0 _2023-07-12_

MAIN CHANGES:
Expand Down
1 change: 1 addition & 0 deletions R/global.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
utils::globalVariables(".")
34 changes: 27 additions & 7 deletions R/stics_exe_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ set_stics_exe <- function(javastics,
# saving a previous version
file.copy(xml_path, xml_path_prev)


xml_pref <- SticsRFiles:::xmldocument(xml_path)
xml_pref <- get_xml_doc(xml_path)


# Getting the existing list in pref file
Expand Down Expand Up @@ -214,7 +213,9 @@ set_stics_exe <- function(javastics,
names(stics_exe_list$stics_list),
stics_exe_list$stics_list
), collapse = "")
xml_pref <- SticsRFiles:::xmldocument(xml_path)

xml_pref <- get_xml_doc(xml_path)

SticsRFiles:::set_values(
xml_pref,
'//entry[@key="model.last"]', new_stics_name
Expand Down Expand Up @@ -274,7 +275,9 @@ list_stics_exe <- function(javastics) {
} else {
# If the preferences is availabble, control that it is complete
# (it is not on at install)
xml_pref <- SticsRFiles:::xmldocument(config_pref)

xml_pref <- get_xml_doc(config_pref)

current_stics <- SticsRFiles:::get_values(
xml_pref,
'//entry[@key="model.last"]'
Expand All @@ -286,7 +289,8 @@ list_stics_exe <- function(javastics) {
}
}

xml_pref <- SticsRFiles:::xmldocument(config_pref)
xml_pref <- get_xml_doc(config_pref)

current_stics <- SticsRFiles:::get_values(
xml_pref,
'//entry[@key="model.last"]'
Expand Down Expand Up @@ -447,7 +451,8 @@ select_stics_exe <- function(javastics, stics_exe = "stics_modulo") {
# saving a previous version
file.copy(xml_path, xml_path_prev)

xml_pref <- SticsRFiles:::xmldocument(xml_path)
xml_pref <- get_xml_doc(xml_path)

current_model <- SticsRFiles:::get_values(
xml_pref,
'//entry[@key="model.last"]'
Expand Down Expand Up @@ -555,7 +560,7 @@ remove_stics_exe <- function(javastics, stics_exe) {
stics_exe_list$stics_list
), collapse = "")

xml_pref <- SticsRFiles:::xmldocument(xml_path)
xml_pref <- get_xml_doc(xml_path)

# removing model from last if needed
if (stics_exe_list$current == stics_exe) {
Expand All @@ -576,3 +581,18 @@ remove_stics_exe <- function(javastics, stics_exe) {
# writing file
SticsRFiles:::save_xml_doc(xml_pref, xml_path)
}


#' Getting a xml_document from an XML file
#'
#' @param file
#'
#' @return a SticsRFiles xml_document object
#' @keywords internal
#'
#' @noRd

get_xml_doc <- function(file) {
suppressMessages(doc <- SticsRFiles:::xmldocument(file))
doc
}
3 changes: 1 addition & 2 deletions R/stics_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ stics_wrapper <- function(model_options,
# + handle the case when simulations does not reach the asked stages ...)
#


if (lifecycle::is_present(sit_names)) {
lifecycle::deprecate_warn(
"1.0.0", "stics_wrapper(sit_names)",
Expand Down Expand Up @@ -181,10 +182,8 @@ stics_wrapper <- function(model_options,
registerDoParallel(cl)
clusterCall(cl, function(x) .libPaths(x), .libPaths())

#`%doparornot%` <- `%dopar%`
`%do_par_or_not%` <- foreach::`%dopar%`
} else {
#`%doparornot%` <- `%do%`
`%do_par_or_not%` <- foreach::`%do%`

}
Expand Down
Loading

0 comments on commit 85c3582

Please sign in to comment.