Skip to content

Commit

Permalink
New release 1.2.0 (#61)
Browse files Browse the repository at this point in the history
* fix: masquing message related to common xml_document class name for xml2 and SticsRFIles.

* upgrade files fix and doc

* tests fixes : no more use of dplyr::all_equal

* fixes for versions management
update JavaStics version in avignette

* update data (examples, templates,...) for new version 10.1.0, some fixes in usms files for version 10.0

* fix: txt example files reference

* updates/fixes about versions meta-data and inputs.csv (10.1.0)

* documentatin updates: description, news, readme, man

* Update CITATION.cff

* little update

* fix: testing if objects are of the xml_document class

* fix: limiting execution time of the example

* trying to reduce examples execution duration following CRAN checks results

* Updates func man, according to execution time of examples (rhub check), DESC.

* Update CITATION.cff

* 1.2.0 submission

* missing is_stics_param in pkgdown yaml

---------

Co-authored-by: plecharpent <[email protected]>
  • Loading branch information
plecharpent and plecharpent authored Feb 23, 2024
1 parent 4d06f43 commit 8aeba09
Show file tree
Hide file tree
Showing 73 changed files with 14,397 additions and 235 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ man/figures
^\.vscode$
^CRAN-SUBMISSION$
^LICENSE\.md$
^revdep$
65 changes: 36 additions & 29 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "SticsRFiles" in publications use:'
type: software
license: LGPL-3.0-or-later
title: 'SticsRFiles: Read and Modify ''STICS'' Input/Output Files'
version: 1.1.3
version: 1.2.0
abstract: Manipulating input and output files of the 'STICS' crop 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
Expand All @@ -35,7 +35,7 @@ authors:
repository: https://CRAN.R-project.org/package=SticsRFiles
repository-code: https://github.com/SticsRPacks/SticsRFiles
url: https://doi.org/10.5281/zenodo.4443206
date-released: '2023-07-10'
date-released: '2024-02-23'
contact:
- family-names: Lecharpentier
given-names: Patrice
Expand All @@ -50,7 +50,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 @@ -64,7 +64,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 @@ -75,7 +75,7 @@ references:
- family-names: Csárdi
given-names: Gábor
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: curl
abstract: 'curl: A Modern and Flexible Web Client for R'
Expand All @@ -87,7 +87,7 @@ references:
given-names: Jeroen
email: [email protected]
orcid: https://orcid.org/0000-0002-4035-0289
year: '2023'
year: '2024'
- type: software
title: data.table
abstract: 'data.table: Extension of `data.frame`'
Expand All @@ -104,7 +104,14 @@ references:
- family-names: Srinivasan
given-names: Arun
email: [email protected]
year: '2023'
- family-names: Gorecki
given-names: Jan
- family-names: Chirico
given-names: Michael
- family-names: Hocking
given-names: Toby
orcid: https://orcid.org/0000-0002-3146-0865
year: '2024'
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
Expand All @@ -128,7 +135,7 @@ references:
given-names: Davis
email: [email protected]
orcid: https://orcid.org/0000-0003-4777-038X
year: '2023'
year: '2024'
version: '>= 1.0.0'
- type: software
title: lifecycle
Expand All @@ -144,7 +151,7 @@ references:
given-names: Hadley
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
year: '2023'
year: '2024'
- type: software
title: lubridate
abstract: 'lubridate: Make Dealing with Dates a Little Easier'
Expand All @@ -159,7 +166,7 @@ references:
given-names: Garrett
- family-names: Wickham
given-names: Hadley
year: '2023'
year: '2024'
- type: software
title: methods
abstract: 'R: A Language and Environment for Statistical Computing'
Expand All @@ -168,7 +175,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 @@ -184,7 +191,7 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: rstudioapi
abstract: 'rstudioapi: Safely Access the RStudio API'
Expand All @@ -204,7 +211,7 @@ references:
- family-names: Ritchie
given-names: Gary
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: stringr
abstract: 'stringr: Simple, Consistent Wrappers for Common String Operations'
Expand All @@ -215,7 +222,7 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
Expand All @@ -230,7 +237,7 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: tidyr
abstract: 'tidyr: Tidy Messy Data'
Expand All @@ -246,7 +253,7 @@ references:
email: [email protected]
- family-names: Girlich
given-names: Maximilian
year: '2023'
year: '2024'
- type: software
title: tools
abstract: 'R: A Language and Environment for Statistical Computing'
Expand All @@ -255,7 +262,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 @@ -266,7 +273,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 @@ -280,7 +287,7 @@ references:
given-names: Duncan
email: [email protected]
orcid: https://orcid.org/0000-0003-0159-1546
year: '2023'
year: '2024'
- type: software
title: xml2
abstract: 'xml2: Parse XML'
Expand All @@ -295,7 +302,7 @@ references:
given-names: Jim
- family-names: Ooms
given-names: Jeroen
year: '2023'
year: '2024'
- type: software
title: xslt
abstract: 'xslt: Extensible Style-Sheet Language Transformations'
Expand All @@ -307,7 +314,7 @@ references:
given-names: Jeroen
email: [email protected]
orcid: https://orcid.org/0000-0002-4035-0289
year: '2023'
year: '2024'
- type: software
title: covr
abstract: 'covr: Test Coverage for Packages'
Expand All @@ -318,7 +325,7 @@ references:
- family-names: Hester
given-names: Jim
email: [email protected]
year: '2023'
year: '2024'
- type: software
title: formatR
abstract: 'formatR: Format R Code Automatically'
Expand All @@ -330,7 +337,7 @@ references:
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
year: '2023'
year: '2024'
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
Expand All @@ -342,7 +349,7 @@ references:
given-names: Yihui
email: [email protected]
orcid: https://orcid.org/0000-0003-0645-5666
year: '2023'
year: '2024'
- type: software
title: learnr
abstract: 'learnr: Interactive Tutorials for R'
Expand All @@ -365,7 +372,7 @@ references:
given-names: Alexander
email: [email protected]
orcid: https://orcid.org/0000-0001-9412-0457
year: '2023'
year: '2024'
- type: software
title: readxl
abstract: 'readxl: Read Excel Files'
Expand All @@ -381,7 +388,7 @@ references:
given-names: Jennifer
email: [email protected]
orcid: https://orcid.org/0000-0002-6983-2759
year: '2023'
year: '2024'
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
Expand Down Expand Up @@ -424,7 +431,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 @@ -439,7 +446,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 @@ -450,4 +457,4 @@ references:
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2023'
year: '2024'
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.2.0
Date: 2024-02-23 14:29:17 UTC
SHA: 238104929d9b5fe938aa9d239559eb5979ee6ebc
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SticsRFiles
Title: Read and Modify 'STICS' Input/Output Files
Version: 1.1.3
Date: 2023-07-10
Version: 1.2.0
Date: 2024-02-23
Authors@R: c(
person("Patrice", "Lecharpentier", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-4044-4322")),
Expand Down Expand Up @@ -68,7 +68,7 @@ ByteCompile: true
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Collate:
'add_node_to_doc.R'
'add_stics_nodes.R'
Expand Down
23 changes: 22 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# SticsRFiles 1.2.0 _2024-02-21_

* FUNCTIONS
* Text files generation from xml files are now done without using JavaStics
command line (the speedup is about 10 times)
* Getting parameters information (get_param_info) do not use XML files
exploration anymore, the speed is largely improved
* Improvement of XML files manipulations/generation for reducing memory
use/freezing in R when intensive use is performed
* tests coverage improvement

* FIXES
* update of a bunch of unit tests according to other packages evolutions
* STICS versions management and XML files upgrade

* DATA
* examples, templates files for different files format added for the latest
STICS version 10.1.0
* versions meta-data update


# SticsRFiles 1.1.3 _2023-07-10_

* FUNCTIONS
* New function for generating the new_travail.usm STICS file
* New function for generating weather data files (climat.txt)
* New unit tests added

* FIXES:
* FIXES
* get_param_value: forcing to get a character returned value
* get_var_info: for variables names vector
* get_param_txt: removed global variables use, looking for parameters names
Expand Down
8 changes: 1 addition & 7 deletions R/download_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
#'
#' @examples
#'
#' # Getting all data
#' download_data()
#'
# # Getting data for a given example : study_case_1
#' download_data(example_dirs = "study_case_1")
#'
#' # Getting data for a given example : study_case_1 and a given version
#' # Getting data for a given example : study_case_1 and a given STICS version
#' download_data(example_dirs = "study_case_1", stics_version = "V9.0")
#'
download_data <- function(out_dir = tempdir(), example_dirs = NULL,
Expand Down
13 changes: 8 additions & 5 deletions R/expand_stics_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @param in_csv_file Input csv file path
#' @param out_csv_file Output csv file path
#' @param header_vec An optional header vector
#' @param header A logical TRUE if a header line exists, FALSE otherwise
#'
#'
#' @examples
Expand All @@ -20,17 +20,20 @@
#'
#' @noRd
#'
expand_stics_names <- function(in_csv_file, out_csv_file, header_vec = NULL) {
expand_stics_names <- function(in_csv_file, out_csv_file, header = FALSE) {

skip <- as.integer(header)
in_data <- utils::read.table(in_csv_file,
sep = ";", stringsAsFactors = FALSE,
header = FALSE
header = FALSE, skip = skip
)
if (base::is.null(header_vec)) {

#if (base::is.null(header_vec)) {
names(in_data) <- c(
"name", "def", "unit", "param", "dim", "type",
"min", "max", "optim", "n"
)
}
#}

# getting param names to duplicate
par_to_expand <- in_data[in_data$dim > 1, ]
Expand Down
4 changes: 2 additions & 2 deletions R/gen_ini_xml.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#' ini_param_df <- read_excel(xl_path, sheet = "Ini")
#' gen_ini_xml(
#' out_dir = tempdir(),
#' param_table = ini_param_df
#' param_df = ini_param_df[1:2,]
#' )
#'
#' @export
Expand Down Expand Up @@ -166,6 +166,6 @@ gen_ini_xml <- function(param_df,
delete(xml_docs[[f]])
}

if (!base::is.null(xml_doc_tmpl) && class(xml_doc_tmpl) == "xml_document")
if (!base::is.null(xml_doc_tmpl) && inherits(xml_doc_tmpl, "xml_document"))
delete(xml_doc_tmpl)
}
Loading

0 comments on commit 8aeba09

Please sign in to comment.