diff --git a/.Rbuildignore b/.Rbuildignore index d988cd48d7cf9b292349f0624d378fbefcf9e4df..aa7059a3b2102a246821ef37d6ddd1d831deb5f0 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -15,7 +15,5 @@ # Suggested by http://r-pkgs.had.co.nz/package.html ^.*\.Rproj$ # Automatically added by RStudio, ^\.Rproj\.user$ # used for temporary files. -^README\.Rmd$ # An Rmarkdown file used to generate README.md ^cran-comments\.md$ # Comments for CRAN submission #^NEWS\.md$ # A news file written in Markdown -^\.gitlab-ci\.yml$ diff --git a/DESCRIPTION b/DESCRIPTION index 173bacaaa482db6982262cdb135768d145de976b..60fa08cdacb88cba6abc5814af42af6020084162 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: startR Title: Automatically Retrieve Multidimensional Distributed Data Sets -Version: 2.2.3 +Version: 2.3.0 Authors@R: c( person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = c("aut")), person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 888fb729955e559437f574fd6ec013f573dedeef..9219f962797d99c8bdc6c950bc13dc272583f2d3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# startR v2.3.0 (Release date: 2023-08-31) +- Load variable metadata when retreive = F +- Change Compute() "threads_load" to 1 to be consistent with documentation +- Add Autosubmit as workflow manager +- SelectorChecker() to recognize class integer + # startR v2.2.3 (Release date: 2023-06-06) - Bugfix in Start(): when using parameter `longitude = 'all'` with transform, there was a missing point for some cases. diff --git a/R/ByChunks_autosubmit.R b/R/ByChunks_autosubmit.R index 08414f9dc91bcc0583bbedbe4ccd9862534308de..65ab36eeeef2b475a2449f0ab7af28a19e7e67e7 100644 --- a/R/ByChunks_autosubmit.R +++ b/R/ByChunks_autosubmit.R @@ -27,7 +27,7 @@ #' where to store temporary files generated for the automatic management of the #' workflow manager. This path should be available in local workstation as well #' as autosubmit machine. The default value is NULL, and a temporary folder -#' will be created. +#' under the current working folder will be created. #'@param autosubmit_server A character vector indicating the login node of the #' autosubmit machine. It can be "bscesautosubmit01" or "bscesautosubmit02". #' The default value is NULL, and the node will be randomly chosen. diff --git a/R/Compute.R b/R/Compute.R index 321a0a192a647fc7e13f00d5ec4724a61bd70e7e..5a58abd9467bf91c1cea057d13b1bbada0afc1ba 100644 --- a/R/Compute.R +++ b/R/Compute.R @@ -20,9 +20,9 @@ #' value is 'auto', which lists all the non-target dimensions and each one has #' one chunk. #'@param threads_load An integer indicating the number of parallel execution -#' processes to use for the data retrieval stage. The default value is 1. +#' cores to use for the data retrieval stage. The default value is 1. #'@param threads_compute An integer indicating the number of parallel execution -#' processes to use for the computation. The default value is 1. +#' cores to use for the computation. The default value is 1. #'@param cluster A list of components that define the configuration of the #' machine to be run on. The comoponents vary from the different machines. #' Check \href{https://earth.bsc.es/gitlab/es/startR/-/blob/master/inst/doc/practical_guide.md}{Practical guide on GitLab} for more @@ -37,7 +37,15 @@ #'@param ecflow_server A named vector indicating the host and port of the #' EC-Flow server. The vector form should be #' \code{c(host = 'hostname', port = port_number)}. Only needed when the -#' execution is run#' remotely. The default value is NULL. +#' execution is run remotely. The default value is NULL. +#'@param autosubmit_suite_dir A character string indicating the path to a folder +#' where to store temporary files generated for the automatic management of the +#' workflow manager. This path should be available in local workstation as well +#' as autosubmit machine. The default value is NULL, and a temporary folder +#' under the current working folder will be created. +#'@param autosubmit_server A character vector indicating the login node of the +#' autosubmit machine. It can be "bscesautosubmit01" or "bscesautosubmit02". +#' The default value is NULL, and the node will be randomly chosen. #'@param silent A logical value deciding whether to print the computation #' progress (FALSE) on the R session or not (TRUE). It only works when the #' execution runs locally or the parameter 'wait' is TRUE. The default value diff --git a/R/Start.R b/R/Start.R index b72a02b4fec0f7b8b35eeece2ba9f1bc388ff223..b0ad40d2c81114ce21ea635471c3d02612ca7c2a 100644 --- a/R/Start.R +++ b/R/Start.R @@ -704,7 +704,7 @@ #'@param num_procs An integer of number of processes to be created for the #' parallel execution of the retrieval/transformation/arrangement of the #' multiple involved files in a call to Start(). If set to NULL, -#' takes the number of available cores (as detected by future::detectCores). +#' takes the number of available cores (as detected by future::availableCores). #' The default value is 1 (no parallel execution). #'@param ObjectBigmemory a character string to be included as part of the #' bigmemory object name. This parameter is thought to be used internally by the diff --git a/R/Utils.R b/R/Utils.R index 940e2d3a92c3373922203d41515a11944117f9f8..e440ddeedd76a6fe1c9fa3b7f81746f611c0692b 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -919,7 +919,7 @@ write_autosubmit_bash <- function(chunks, cluster, autosubmit_suite_dir) { dest_dir <- file.path(autosubmit_suite_dir, paste0("/STARTR_CHUNKING_", cluster$expid)) if (!file.exists(dest_dir)) { - dir.create(dest_fir, recursive = TRUE) + dir.create(dest_dir, recursive = TRUE) } writeLines(bash_script_lines, paste0(dest_dir, '/startR_autosubmit_', n_chunk, '.sh')) } diff --git a/inst/doc/practical_guide.md b/inst/doc/practical_guide.md index 7038ad79e933adc4763a23e8878656d478c7078d..b22c6292c2923f54f2119fdbb5af3898a6c9af5d 100644 --- a/inst/doc/practical_guide.md +++ b/inst/doc/practical_guide.md @@ -378,8 +378,8 @@ The common Compute() parameters of local and remote execution are: - `wf`: The workflow defined by the previous steps. - `chunks`: The dimensions to be chunked and how many chunks you want for each dimension. startR will automatically chunk the data for you. See more details in session [#5-1](#5-1-how-to-choose-the-number-of-chunks-jobs-and-cores). -- `threads_load`: The number of parallel execution processes to be created for data retrieval stage. It is used as Start() parameter "num_procs" if it is not specified when Start() is defined. -- `threads_compute`: The number of parallel execution processes to be created for data computing. It is used as multiApply::Apply parameter "ncores". +- `threads_load`: The number of parallel execution cores to be created for data retrieval stage. It is used as Start() parameter "num_procs" if it is not specified when Start() is defined. +- `threads_compute`: The number of parallel execution cores to be created for data computing. It is used as multiApply::Apply parameter "ncores". Using more than 2 threads for the retrieval will usually be perjudicial, since two will already be able to make full use of the bandwidth between the workstation and the data repository. The optimal number of threads for the computation will depend on the number of processors in your machine, the number of cores they have, and the number of threads supported by each of them. diff --git a/man/Compute.Rd b/man/Compute.Rd index 270846a0790c401a99ba8167cbc125327404b334..96d063a361ce3302abac5a8040bbe8b71086d51e 100644 --- a/man/Compute.Rd +++ b/man/Compute.Rd @@ -35,10 +35,10 @@ one chunk.} 'ecFlow'.} \item{threads_load}{An integer indicating the number of parallel execution -processes to use for the data retrieval stage. The default value is 1.} +cores to use for the data retrieval stage. The default value is 1.} \item{threads_compute}{An integer indicating the number of parallel execution -processes to use for the computation. The default value is 1.} +cores to use for the computation. The default value is 1.} \item{cluster}{A list of components that define the configuration of the machine to be run on. The comoponents vary from the different machines. @@ -54,7 +54,17 @@ remotely. The default value is NULL.} \item{ecflow_server}{A named vector indicating the host and port of the EC-Flow server. The vector form should be \code{c(host = 'hostname', port = port_number)}. Only needed when the -execution is run#' remotely. The default value is NULL.} +execution is run remotely. The default value is NULL.} + +\item{autosubmit_suite_dir}{A character string indicating the path to a folder +where to store temporary files generated for the automatic management of the +workflow manager. This path should be available in local workstation as well +as autosubmit machine. The default value is NULL, and a temporary folder +under the current working folder will be created.} + +\item{autosubmit_server}{A character vector indicating the login node of the +autosubmit machine. It can be "bscesautosubmit01" or "bscesautosubmit02". +The default value is NULL, and the node will be randomly chosen.} \item{silent}{A logical value deciding whether to print the computation progress (FALSE) on the R session or not (TRUE). It only works when the diff --git a/man/Start.Rd b/man/Start.Rd index 7cdc9f83ca388f4912c829812e53fccf4208414c..25eb8d744084a7d7da286206eb01d3d59acfa907 100644 --- a/man/Start.Rd +++ b/man/Start.Rd @@ -684,7 +684,7 @@ value is FALSE.} \item{num_procs}{An integer of number of processes to be created for the parallel execution of the retrieval/transformation/arrangement of the multiple involved files in a call to Start(). If set to NULL, -takes the number of available cores (as detected by future::detectCores). +takes the number of available cores (as detected by future::availableCores). The default value is 1 (no parallel execution).} \item{ObjectBigmemory}{a character string to be included as part of the diff --git a/tests/testthat/test-AddStep-DimNames.R b/tests/testthat/test-AddStep-DimNames.R index 647ca2fc646c4e04510c1167401cc6098bd80e59..5e1fe9cb345c92b3329c4edacdd6c35244e88c46 100644 --- a/tests/testthat/test-AddStep-DimNames.R +++ b/tests/testthat/test-AddStep-DimNames.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Error with bad dimensions tests.") test_that("Single File - Local execution", { suppressWarnings( data <- Start(dataset = '/esarchive/scratch/aho/startR_unittest_files/esarchive/recon/jma/jra55/monthly_mean/$var$_f6h/$var$_$sdate$$month$.nc', diff --git a/tests/testthat/test-Compute-CDORemap.R b/tests/testthat/test-Compute-CDORemap.R index b1479e2d6ad4dc3755402e96c5a77e5e864b7afe..fb31d00bc062368d0aa4ac642a2af2cf276c3168 100644 --- a/tests/testthat/test-Compute-CDORemap.R +++ b/tests/testthat/test-Compute-CDORemap.R @@ -1,5 +1,3 @@ -context("Compute use CDORemap") - test_that("ex2_3", { repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc' diff --git a/tests/testthat/test-Compute-NumChunks.R b/tests/testthat/test-Compute-NumChunks.R index 5d9a77573004424fa29481180ca08e152f02b693..ffce880299e12b7043f5628b4114bdd2206327fe 100644 --- a/tests/testthat/test-Compute-NumChunks.R +++ b/tests/testthat/test-Compute-NumChunks.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Number of chunks tests.") test_that("Single File - Local execution", { path <- '/esarchive/recon/jma/jra55/monthly_mean/$var$_f6h/$var$_$sdate$$month$.nc' @@ -48,7 +47,7 @@ res2 <- Compute(workflow = wf, expect_equal( res1, res2, -check.attributes = FALSE +ignore_attr = TRUE ) }) diff --git a/tests/testthat/test-Compute-chunk_depend_dim.R b/tests/testthat/test-Compute-chunk_depend_dim.R index 9c7876484781895de160fadc46ac7af89e5b778a..101bfb592ed5e21a975db603e167123b1b22dd90 100644 --- a/tests/testthat/test-Compute-chunk_depend_dim.R +++ b/tests/testthat/test-Compute-chunk_depend_dim.R @@ -6,8 +6,6 @@ # b. depended dim is list of values # Note that 2.b. doesn't work. -context("Chunk over dimensions that have dependency relationship") - path <- paste0('/esarchive/exp/CMIP6/dcppA-hindcast/HadGEM3-GC31-MM/DCPP/MOHC/', 'HadGEM3-GC31-MM/dcppA-hindcast/', 'r1i1p1f2/Omon/tos/gn/v20200417/', diff --git a/tests/testthat/test-Compute-chunk_split_dim.R b/tests/testthat/test-Compute-chunk_split_dim.R index a40f74501cfebcfd50c894d2a3f52c8d452c2036..0c1da4ac5dda36b01669bd566efa6d0563fb4e34 100644 --- a/tests/testthat/test-Compute-chunk_split_dim.R +++ b/tests/testthat/test-Compute-chunk_split_dim.R @@ -1,8 +1,6 @@ # This unit test is to check chunking over the split dim. It involves # how to arrange the chunks in a correct order even when chunking is happening. -context("Chunk over split dim") - test_that("1. The files are not repeated", { repos_exp <- paste0('/esarchive/exp/ecearth/a1tr/cmorfiles/CMIP/EC-Earth-Consortium/', diff --git a/tests/testthat/test-Compute-extra_params.R b/tests/testthat/test-Compute-extra_params.R index 02eab307b056f1887870d9e91aed8c7e7413a871..f055e96b48853b8f9f79437fcf2004dd7f50f253 100644 --- a/tests/testthat/test-Compute-extra_params.R +++ b/tests/testthat/test-Compute-extra_params.R @@ -1,4 +1,3 @@ -context("Compute, extra function arguments") test_that("ex2_6", { diff --git a/tests/testthat/test-Compute-inconsistent_target_dim.R b/tests/testthat/test-Compute-inconsistent_target_dim.R index 7ebc6f55f6cda555434ff0b53983cccfd04ce4f8..58f96a93af392b6ec7a4d3f3021370f4ede5256a 100644 --- a/tests/testthat/test-Compute-inconsistent_target_dim.R +++ b/tests/testthat/test-Compute-inconsistent_target_dim.R @@ -1,4 +1,3 @@ -context("Compute()/ByChunks(): dimension consistence check") # If dataset are more than 1 (e.g., exp and obs), ByChunks() checks if # they have consistent dimensions in favor of Apply() computation. However, # only margin dimensions need to be identical. Target dimensions can have diff --git a/tests/testthat/test-Compute-irregular_regrid.R b/tests/testthat/test-Compute-irregular_regrid.R index c76793d268706af0d89c9dda101d74c9ef7a6d05..7de1471811e0ce838b28368267eb418a5a230a20 100644 --- a/tests/testthat/test-Compute-irregular_regrid.R +++ b/tests/testthat/test-Compute-irregular_regrid.R @@ -1,7 +1,5 @@ library(s2dv) -context("Irregular regriding in the workflow") - test_that("1. ex2_13", { path <- paste0('/esarchive/exp/CMIP6/dcppA-hindcast/CMCC-CM2-SR5/', diff --git a/tests/testthat/test-Compute-timedim.R b/tests/testthat/test-Compute-timedim.R index d63ae6cd981cfb6851ccbee0e29e6623ce4a8ecf..fbc5af0464989ebb977d6ac7c69adde6aa868b4a 100644 --- a/tests/testthat/test-Compute-timedim.R +++ b/tests/testthat/test-Compute-timedim.R @@ -1,5 +1,3 @@ -context("Compute on time dimension") - test_that("ex2_1", { repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc' diff --git a/tests/testthat/test-Compute-transform_all.R b/tests/testthat/test-Compute-transform_all.R index a7a67ddb93417dc0f89ab650593313fe6629ae1e..05d5de6639254346bea59cbfb16466e6f516699a 100644 --- a/tests/testthat/test-Compute-transform_all.R +++ b/tests/testthat/test-Compute-transform_all.R @@ -1,4 +1,3 @@ -context("Transform with 'all'") test_that("1. Chunk along non-lat/lon dim", { #skip_on_cran() diff --git a/tests/testthat/test-Compute-transform_indices.R b/tests/testthat/test-Compute-transform_indices.R index 37decfc538152e6f781227c64dc1de33a746bb2b..c2d3e35a65a99110996e19ddc6404c2b0f381747 100644 --- a/tests/testthat/test-Compute-transform_indices.R +++ b/tests/testthat/test-Compute-transform_indices.R @@ -1,4 +1,3 @@ -context("Transform with indices") # Using indinces() to assign lat and lon, and transform the data. # Also test transform + chunk along lat/lon. diff --git a/tests/testthat/test-Compute-transform_values.R b/tests/testthat/test-Compute-transform_values.R index 191d6519c33b74b6963d3e75f1a654d7fa1fdd47..25a803f2b158048242a382dd880106181a34cfc8 100644 --- a/tests/testthat/test-Compute-transform_values.R +++ b/tests/testthat/test-Compute-transform_values.R @@ -1,4 +1,3 @@ -context("Compute: Transform and chunk values()") # Using values() to assign lat and lon, and transform the data. # Also test transform + chunk along lat/lon. diff --git a/tests/testthat/test-Compute-two_data.R b/tests/testthat/test-Compute-two_data.R index 735735fb81d66586c366cf85bc528165ff73856b..dfa579abd9f4f201e848c446cfe5798151662e48 100644 --- a/tests/testthat/test-Compute-two_data.R +++ b/tests/testthat/test-Compute-two_data.R @@ -1,5 +1,3 @@ -context("Compute with two datasets") - test_that("ex2_7", { # exp data diff --git a/tests/testthat/test-Compute-use_attribute.R b/tests/testthat/test-Compute-use_attribute.R index 7ec3dc2445918b5e6b7c3da1d27677b7a77edf67..6f218e664a37e1481f08efb18e9f4b50789125a8 100644 --- a/tests/testthat/test-Compute-use_attribute.R +++ b/tests/testthat/test-Compute-use_attribute.R @@ -1,5 +1,3 @@ -context("Compute use attributes") - test_that("ex2_2", { repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc' diff --git a/tests/testthat/test-Start-DCPP-across-depends.R b/tests/testthat/test-Start-DCPP-across-depends.R index c561abd93f63b8332a6c0d032e26abcdbfb574c9..bfe44b13727dd6cfa264efc4b5fdf144b3004ee0 100644 --- a/tests/testthat/test-Start-DCPP-across-depends.R +++ b/tests/testthat/test-Start-DCPP-across-depends.R @@ -1,4 +1,3 @@ -context("DCPP successfull retrieved for depends and across parameters.") test_that("Chunks of DCPP files- Local execution", { path <- '/esarchive/exp/CMIP6/dcppA-hindcast/HadGEM3-GC31-MM/DCPP/MOHC/HadGEM3-GC31-MM/dcppA-hindcast/r1i1p1f2/Omon/tos/gn/v20200417/$var$_Omon_HadGEM3-GC31-MM_dcppA-hindcast_s$sdate$-r1i1p1f2_gn_$chunk$.nc' path <- paste0('/esarchive/scratch/aho/startR_unittest_files/', path) diff --git a/tests/testthat/test-Start-calendar.R b/tests/testthat/test-Start-calendar.R index 0ee4c5e7b971170a184c92a5270e7d08db216401..7dfbc2cfc6e3bb9724fa4445b36964aa4359bae4 100644 --- a/tests/testthat/test-Start-calendar.R +++ b/tests/testthat/test-Start-calendar.R @@ -1,4 +1,3 @@ -context("Start() different calendar") test_that("1. 360_day, daily, unit = 'days since 1850-01-01'", { path_hadgem3 <- paste0('/esarchive/exp/CMIP6/dcppA-hindcast//HadGEM3-GC31-MM/', diff --git a/tests/testthat/test-Start-depends_values.R b/tests/testthat/test-Start-depends_values.R index e4e4adcb8362c982acf9c4d3b2fbf9f3d4814038..9cccc2d24694d28fb76c8d853dcb8de96f8ea3e8 100644 --- a/tests/testthat/test-Start-depends_values.R +++ b/tests/testthat/test-Start-depends_values.R @@ -2,9 +2,6 @@ # and depending dimensions. The depending dimension should be a list with # names that are the values of depended dimensions. -context("Start() using values() to define dependency relations") - - path <- '/esarchive/exp/CMIP6/dcppA-hindcast/HadGEM3-GC31-MM/DCPP/MOHC/HadGEM3-GC31-MM/dcppA-hindcast/r1i1p1f2/Omon/tos/gn/v20200417/$var$_Omon_HadGEM3-GC31-MM_dcppA-hindcast_s$sdate$-r1i1p1f2_gn_$chunk$.nc' path <- paste0('/esarchive/scratch/aho/startR_unittest_files/', path) diff --git a/tests/testthat/test-Start-first_file_missing.R b/tests/testthat/test-Start-first_file_missing.R index 9c232e699a585b6b9586dc6172a8deb618570d46..fecbd7c05cbe19ca40dd9d4a058495893a49fd44 100644 --- a/tests/testthat/test-Start-first_file_missing.R +++ b/tests/testthat/test-Start-first_file_missing.R @@ -1,5 +1,3 @@ -context("Start() retrieves files that the first file is missing") - # When some of the files are missing, Start() still can retrieve the data and # put NA in those missing positions. However, when the first file is missing, # Start() returned error before because of failing to find metadata. The bug is diff --git a/tests/testthat/test-Start-global-lon-across_meridian.R b/tests/testthat/test-Start-global-lon-across_meridian.R index 0360629fe342dddbce1ea6fe1fe5bcca45a97064..921c3313d5c0d22b0d98344e06463faac6a5ee28 100644 --- a/tests/testthat/test-Start-global-lon-across_meridian.R +++ b/tests/testthat/test-Start-global-lon-across_meridian.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() across_meridia global lon length check") - test_that("first test", { repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc" diff --git a/tests/testthat/test-Start-implicit_dependency_by_selector.R b/tests/testthat/test-Start-implicit_dependency_by_selector.R index 4e89190b571f5d2fb58ea5d95354bc7f36502614..d493a87ba41589d96988146d27d24afac3dc9406 100644 --- a/tests/testthat/test-Start-implicit_dependency_by_selector.R +++ b/tests/testthat/test-Start-implicit_dependency_by_selector.R @@ -6,7 +6,6 @@ # If assign a selector with an array that has file dim as dimension, Start() read # the values depending on the the file dim. #--------------------------------------------------- -context("Start() implicit dependency by selector dimension") #NOTE: The files don't exist anymore. #test_that("1. region with different index between files", { diff --git a/tests/testthat/test-Start-implicit_inner_dim.R b/tests/testthat/test-Start-implicit_inner_dim.R index fcae53ed87c0418ba3103ae2873e7e001e234c06..7e0264c5a3905d6125c8b326fed548403d56dd03 100644 --- a/tests/testthat/test-Start-implicit_inner_dim.R +++ b/tests/testthat/test-Start-implicit_inner_dim.R @@ -1,4 +1,3 @@ -context("Start() implicit inner dimension") # The unit test is for the implicit inner dimension. If the inner dimension length is 1, # startR allows it not to be specified in the call. Users can still define it in # 'return_vars'. diff --git a/tests/testthat/test-Start-indices_list_vector.R b/tests/testthat/test-Start-indices_list_vector.R index b225a0a1f499aed02dcd5638c954c032948ce973..2effede805887d40bef16cb1da1986e9c5eddd79 100644 --- a/tests/testthat/test-Start-indices_list_vector.R +++ b/tests/testthat/test-Start-indices_list_vector.R @@ -4,8 +4,6 @@ # 3. transform, indices reversed # 4. no transform, indices reversed -context("List of indices and vector of indices") - repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc" repos <- paste0('/esarchive/scratch/aho/startR_unittest_files/', repos) diff --git a/tests/testthat/test-Start-largest_dims_length.R b/tests/testthat/test-Start-largest_dims_length.R index 6a796a24aba0bb4a19da61c6d41e221b2ecaf710..211c1321ac8865914ea4ecdd51fdce53044629cd 100644 --- a/tests/testthat/test-Start-largest_dims_length.R +++ b/tests/testthat/test-Start-largest_dims_length.R @@ -1,4 +1,3 @@ -context("Start() largest_dims_length check") # When certain inner dim of files is not consistent, the parameter 'largest_dims_length' can # be used to ensure the returned array has the largest length of inner dimensions. diff --git a/tests/testthat/test-Start-line_order-consistency.R b/tests/testthat/test-Start-line_order-consistency.R index 8bf4564d5661a94cf4d54873c6b7bb684dba948c..11be10996738dc56baf8fff4c6d248540c3e29e8 100644 --- a/tests/testthat/test-Start-line_order-consistency.R +++ b/tests/testthat/test-Start-line_order-consistency.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() line order consistency check") - variable <- "tas" obs.path <- "/esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h/tas_$file_date$.nc" obs.path <- paste0('/esarchive/scratch/aho/startR_unittest_files/', obs.path) diff --git a/tests/testthat/test-Start-metadata_dims.R b/tests/testthat/test-Start-metadata_dims.R index 569a28e8e65abfb3ac9460cccb149d83f55454f2..2a2e7358824ca68b3240765e9b106ea0ff41c93c 100644 --- a/tests/testthat/test-Start-metadata_dims.R +++ b/tests/testthat/test-Start-metadata_dims.R @@ -1,5 +1,3 @@ -context("Start() metadata_dims check") - test_that("1. One data set, one var", { repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc" repos <- paste0('/esarchive/scratch/aho/startR_unittest_files/', repos) diff --git a/tests/testthat/test-Start-metadata_filedim_dependency.R b/tests/testthat/test-Start-metadata_filedim_dependency.R index 13cac4775c49525fb08ece5ee4742f61a1b9a842..227383bd17d735bd7ded03c465d12b0a67be4160 100644 --- a/tests/testthat/test-Start-metadata_filedim_dependency.R +++ b/tests/testthat/test-Start-metadata_filedim_dependency.R @@ -1,4 +1,3 @@ -context("Start() metadata filedim dependency") # When inner dimension selector is an array with filedim dimension name (e.g., time = [sdate = 2, time = 4], # or *_across is used, the inner dim has dependency on file dim. In this case, return_vars must # specify this relationship, i.e., return_vars = list(time = 'sdate'). @@ -84,7 +83,7 @@ expect_equal( expect_equal( test6, test4, - check.attributes = FALSE + ignore_attr = TRUE ) #---------------------------------------- @@ -120,7 +119,7 @@ expect_equal( expect_equal( test6, test6a, - check.attributes = FALSE + ignore_attr = TRUE ) #---------------------------------------- @@ -158,7 +157,7 @@ expect_equal( expect_equal( test14a, test6a, - check.attributes = FALSE + ignore_attr = TRUE ) #------------------------------------------------- @@ -194,7 +193,7 @@ expect_equal( expect_equal( test15a, test6a, - check.attributes = FALSE + ignore_attr = TRUE ) }) diff --git a/tests/testthat/test-Start-metadata_reshaping.R b/tests/testthat/test-Start-metadata_reshaping.R index 92e831b6c36ac29c65b0975c3413bd443e2f8b1d..b14326894d512bb2b003d55cf422c6b413d54552 100644 --- a/tests/testthat/test-Start-metadata_reshaping.R +++ b/tests/testthat/test-Start-metadata_reshaping.R @@ -1,4 +1,3 @@ -context("Start() metadata reshaping") # When data is reshaping (e.g., time_across = 'sdate'), the corresponding attribute should be reshaped too. test_that("1. time across fyear, fyear depends on sdate", { diff --git a/tests/testthat/test-Start-multiple-sdates.R b/tests/testthat/test-Start-multiple-sdates.R index 6467a8420ff14a540912cb04c526fa58b58b8152..e16f2bf4eb647ba103a7b2de612ab3828ab118e0 100644 --- a/tests/testthat/test-Start-multiple-sdates.R +++ b/tests/testthat/test-Start-multiple-sdates.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() multiple sdate with split + merge dim") - # When certain values in one observation file are required more than once, # and 'merge_across_dims' + 'split_multiselected_dims' are used, the values may be misplaced. # It might happen when reading experimental data with many start dates, diff --git a/tests/testthat/test-Start-path_glob_permissive.R b/tests/testthat/test-Start-path_glob_permissive.R index e32d0b3f67fae8165a8d2b1b98314df5a43bf6d0..75f28d43c7e751dc5da5d6bfefce88477adeed85 100644 --- a/tests/testthat/test-Start-path_glob_permissive.R +++ b/tests/testthat/test-Start-path_glob_permissive.R @@ -1,5 +1,3 @@ -context("Start() path_glob_permissive check") - test_that("1. expid/member/version", { years <- paste0(c(1960:1961), '01-', c(1960:1961), '12') diff --git a/tests/testthat/test-Start-reorder-lat.R b/tests/testthat/test-Start-reorder-lat.R index 0ac770167a58a63c5d4b7d26b5c8319464dc6abb..c87792e972259100dae6ba604aa1851b95a2d3fc 100644 --- a/tests/testthat/test-Start-reorder-lat.R +++ b/tests/testthat/test-Start-reorder-lat.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lat Reorder test") - #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] #3 resolution 1-1 2-<1 3->1 diff --git a/tests/testthat/test-Start-reorder-latCoarse.R b/tests/testthat/test-Start-reorder-latCoarse.R index af9c2db255c7c5e8e3c684165cd7c3b62db58c3c..34a766f78653209266c493823d460b2cbe89d842 100644 --- a/tests/testthat/test-Start-reorder-latCoarse.R +++ b/tests/testthat/test-Start-reorder-latCoarse.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lat Reorder test") - #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] #3 resolution 1-1 2-<1 3->1 4-> mixed diff --git a/tests/testthat/test-Start-reorder-lon-180to180.R b/tests/testthat/test-Start-reorder-lon-180to180.R index e0a066c3f9d4062716b045f6a38036142b241ecd..0f71f0a0feb28e2cfa6ae7f7a4fcd1b1849c6428 100644 --- a/tests/testthat/test-Start-reorder-lon-180to180.R +++ b/tests/testthat/test-Start-reorder-lon-180to180.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder non-transform -180to180 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[170, 190] #3 resolution 1-1 2-<1 3->1 diff --git a/tests/testthat/test-Start-reorder-lon-transform_-180to180.R b/tests/testthat/test-Start-reorder-lon-transform_-180to180.R index 46da00e441253b53d23754c07fa554c1e7bc50af..5e7701ab41f74ccee5350f04ee88ccb140ca3116 100644 --- a/tests/testthat/test-Start-reorder-lon-transform_-180to180.R +++ b/tests/testthat/test-Start-reorder-lon-transform_-180to180.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder transform -180to180 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[170, 190] #3 resolution 1-1 2-<1 3->1 diff --git a/tests/testthat/test-Start-reorder-lon-transform_0to360.R b/tests/testthat/test-Start-reorder-lon-transform_0to360.R index e05c73109983f01ce54cbddc9199a8b0e30743d0..86ad5e737b30c81668e5b57dbce8f5953a930b66 100644 --- a/tests/testthat/test-Start-reorder-lon-transform_0to360.R +++ b/tests/testthat/test-Start-reorder-lon-transform_0to360.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder transform 0to360 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[350, 370] #3 resolution 1-1 2-<1 3->1 diff --git a/tests/testthat/test-Start-reorder-lon-transform_0to360Coarse.R b/tests/testthat/test-Start-reorder-lon-transform_0to360Coarse.R index d4629af99d396bbc65a34824542c1b78181bc9d5..c18d34a241b47843d04ed45a881fa832fb56b786 100644 --- a/tests/testthat/test-Start-reorder-lon-transform_0to360Coarse.R +++ b/tests/testthat/test-Start-reorder-lon-transform_0to360Coarse.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder transform 0to360 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[350, 370] #3 resolution 1-1 2-<1 3->1 4 -> mixed diff --git a/tests/testthat/test-Start-reorder-lon0to360.R b/tests/testthat/test-Start-reorder-lon0to360.R index 84b0527d5b11ccf48122e3d34d9fe0df968103d1..1e946d994a38fdfe97c061e02e53d4b2804359fa 100644 --- a/tests/testthat/test-Start-reorder-lon0to360.R +++ b/tests/testthat/test-Start-reorder-lon0to360.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder non-transform 0to360 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[350, 370] #3 resolution 1-1 2-<1 3->1 diff --git a/tests/testthat/test-Start-reorder-lon0to360Coarse.R b/tests/testthat/test-Start-reorder-lon0to360Coarse.R index 16ad2e0dfdd68962a026c6e01623a310b58f5a5f..71361d95896f50b465789e7186d43a43bc773be9 100644 --- a/tests/testthat/test-Start-reorder-lon0to360Coarse.R +++ b/tests/testthat/test-Start-reorder-lon0to360Coarse.R @@ -1,6 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder non-transform 0to360 test") #1 selector type 1-values(list) 2-values(vector) 3-indices 4-'all' 5-mix #2 selector range 1-[10, 20] 2-[20, 10] 3-[-10, -20] 4-[-20, -10] 5-[-10, 10] 6-[10, -10] 7-[300, 350] 8-[350, 370] #3 resolution 1-1 2-<1 3->1 4-> mixed diff --git a/tests/testthat/test-Start-reorder-metadata.R b/tests/testthat/test-Start-reorder-metadata.R index 4b6f909176214091a55866245e44e59009ae480c..ea727e5c76b9dba815f6c408cfd91f993d147dc4 100644 --- a/tests/testthat/test-Start-reorder-metadata.R +++ b/tests/testthat/test-Start-reorder-metadata.R @@ -1,4 +1,3 @@ -context("Start() reorder metadata check") # Ensure returns_vars = NULL or 'dat' have the same metadata test_that("1. Sort() and CircularSort(0, 360)", { diff --git a/tests/testthat/test-Start-reorder-retrieve.R b/tests/testthat/test-Start-reorder-retrieve.R index 28d8c7933aa3ed237bfc9523fd5aa277809613ab..25efcfc91b22f6126afbac26864461107f3f2f5e 100644 --- a/tests/testthat/test-Start-reorder-retrieve.R +++ b/tests/testthat/test-Start-reorder-retrieve.R @@ -1,8 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() lon Reorder non-transform retrieve test") - - ############################################## test_that("original range 0to360", { ## Origin longitude in file: [0:359.722222222222] diff --git a/tests/testthat/test-Start-reorder_all.R b/tests/testthat/test-Start-reorder_all.R index fce2dc41818da4ee1412cc6823f051733b8722b3..87a4416e5edef0b51e2b2f06304e4a2ad4e1f2e4 100644 --- a/tests/testthat/test-Start-reorder_all.R +++ b/tests/testthat/test-Start-reorder_all.R @@ -1,8 +1,5 @@ # No transform, test reorder function Sort() and CircularSort() with selector 'all'. - -context("No transform, reorder test: 'all'") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-reorder_indices.R b/tests/testthat/test-Start-reorder_indices.R index 4027b78241e2e5364abc02cb445e7cb7206c9e58..59d00d4accf229fb7b9086060147b071a029bd70 100644 --- a/tests/testthat/test-Start-reorder_indices.R +++ b/tests/testthat/test-Start-reorder_indices.R @@ -1,7 +1,5 @@ # No transform, test reorder function Sort() and CircularSort() with selector indices(). -context("No transform, reorder test: indices()") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-reshape.R b/tests/testthat/test-Start-reshape.R index fc7acb69d96020e26d347403b0e2ed47502e4811..480a3bc64c24c2e74765c289d8179f739602fe40 100644 --- a/tests/testthat/test-Start-reshape.R +++ b/tests/testthat/test-Start-reshape.R @@ -1,4 +1,3 @@ -context("Start() reshape parameters check") # This one is more comprehensive than test-Start-split-merge.R path_exp <- '/esarchive/exp/ecmwf/system5c3s/daily_mean/$var$_f6h/$var$_$sdate$.nc' diff --git a/tests/testthat/test-Start-return_vars_name.R b/tests/testthat/test-Start-return_vars_name.R index e97023d86c9bb8fabe72dfda8cbb012b7c4f8c8f..e3ff876e4dc2dc3f8e5018652488590f4b601aa2 100644 --- a/tests/testthat/test-Start-return_vars_name.R +++ b/tests/testthat/test-Start-return_vars_name.R @@ -1,4 +1,3 @@ -context("Start() return_vars name") # The name of return_vars should be one of the inner dimension names. The synonims can # be used but will be changed back to the inner dim names. diff --git a/tests/testthat/test-Start-split-merge.R b/tests/testthat/test-Start-split-merge.R index d95fa623aefc3cd617e62b1c72c9dcdbd3e9a78f..699c01cc145214b33d2aa8198f3f32956c42e03f 100644 --- a/tests/testthat/test-Start-split-merge.R +++ b/tests/testthat/test-Start-split-merge.R @@ -1,4 +1,3 @@ -context("Start() split + merge dim and value check") var_name <- 'tas' path.exp <- '/esarchive/exp/ecmwf/s2s-monthly_ensforhc/daily_mean/$var$_f6h/$sdate$/$var$_$syear$.nc' diff --git a/tests/testthat/test-Start-time_unit.R b/tests/testthat/test-Start-time_unit.R index a05a42a034d5f75052a451cc01323667710747e8..0c499d31398189a840eedd0fb5a6f07cafcddba7 100644 --- a/tests/testthat/test-Start-time_unit.R +++ b/tests/testthat/test-Start-time_unit.R @@ -1,4 +1,3 @@ -context("To detect the variable with time format and adjust the units") test_that("1. The data has units like time", { diff --git a/tests/testthat/test-Start-transform-all.R b/tests/testthat/test-Start-transform-all.R index 7fbac55aff554a4443403774aef71598a1405830..a8290a6860ba659d9576b6d94c4ce61de65db6a6 100644 --- a/tests/testthat/test-Start-transform-all.R +++ b/tests/testthat/test-Start-transform-all.R @@ -3,8 +3,6 @@ # The test contains three calls with different target grids: # two with 'r128x64' (from different original grid) and one with 'r100x50'. -context("Transform test target grid: lon and lat = 'all'") - #--------------------------------------------------------------- # cdo is used to verify the data values # Test 1: original grid 'r360x180' diff --git a/tests/testthat/test-Start-transform-border.R b/tests/testthat/test-Start-transform-border.R index 90b48b658d2dd2b1556c953e8e6f24b518ba3184..9b3cc6a6828a40f0f99577486a383a44a730e054 100644 --- a/tests/testthat/test-Start-transform-border.R +++ b/tests/testthat/test-Start-transform-border.R @@ -1,4 +1,3 @@ -context("Transform: check with cdo") ############################################## # This unit test checks different border situations: normal regional that doesn't touch the borders, diff --git a/tests/testthat/test-Start-transform-lat-Sort-all.R b/tests/testthat/test-Start-transform-lat-Sort-all.R index 3852da98971dd6910cc1e08557bec160545bb4a5..d7d895e3a3a66e9aff7f3f771c2c299ba1295d94 100644 --- a/tests/testthat/test-Start-transform-lat-Sort-all.R +++ b/tests/testthat/test-Start-transform-lat-Sort-all.R @@ -4,8 +4,6 @@ # The test contains three calls: lat_reorder = Sort(), no lat_reorder, and lat_reorder = Sort(decreasing = T). # Note that the original latitude is descending [90:-90]. cdo result is ascending [-90:90]. -context("Transform and lat_reorder test: 'all'") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-transform-lat-Sort-indices.R b/tests/testthat/test-Start-transform-lat-Sort-indices.R index f72954529551af600264af51d63581583a435928..16daa79309116ef9502a9fdf9988ea43cbff2995 100644 --- a/tests/testthat/test-Start-transform-lat-Sort-indices.R +++ b/tests/testthat/test-Start-transform-lat-Sort-indices.R @@ -9,8 +9,6 @@ #!!!!!!!!!!!!!!!!!!!!!PROBLEM in test 2, indices(640:1)!!!!!!!!!!!!!!!!!!!! #TODO: Add regional test -context("Transform and lat_reorder test: indices") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-transform-lat-Sort-values.R b/tests/testthat/test-Start-transform-lat-Sort-values.R index 03331019aee2412307e151046dc5540c3c70e8e2..b70b637cc140c51c37b5e7ab5514df330d5ec85d 100644 --- a/tests/testthat/test-Start-transform-lat-Sort-values.R +++ b/tests/testthat/test-Start-transform-lat-Sort-values.R @@ -7,8 +7,6 @@ # Each of them contains three calls: lat_reorder = Sort(), no lat_reorder, and lat_reorder = Sort(decreasing = T). # Note that the original latitude is descending [90:-90]. cdo result is ascending [-90:90]. -context("Transform and lat_reorder test: values") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-transform-lon-across_meridian.R b/tests/testthat/test-Start-transform-lon-across_meridian.R index d3c3dfa774f17d826a49cc120524987961a9e135..d07388ea13697deebfacacc3d00c9cb72822a1dd 100644 --- a/tests/testthat/test-Start-transform-lon-across_meridian.R +++ b/tests/testthat/test-Start-transform-lon-across_meridian.R @@ -1,7 +1,5 @@ #if (identical(Sys.getenv("NOT_CRAN"), "")) Sys.setenv(NOT_CRAN='true') -context("Start() transform across_meridian lon order check") - test_that("first test", { repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc" diff --git a/tests/testthat/test-Start-transform-metadata.R b/tests/testthat/test-Start-transform-metadata.R index 62d31da5cb774570dda8369acbcb8c1842e33d8d..227f09dea14bca0dfdeb478fd06b541ba2dd416f 100644 --- a/tests/testthat/test-Start-transform-metadata.R +++ b/tests/testthat/test-Start-transform-metadata.R @@ -1,4 +1,3 @@ -context("Start() transform metadata check") # Ensure returns_vars = NULL or 'dat' have the same metadata test_that("1. Sort() and CircularSort(0, 360)", { diff --git a/tests/testthat/test-Start-transform-three-selectors.R b/tests/testthat/test-Start-transform-three-selectors.R index 500168e789afb0bde4847398616b0fc5a3bc828b..95e7c2b88ecdb53f7ddf8d6c0b6f2ce36f57a7d3 100644 --- a/tests/testthat/test-Start-transform-three-selectors.R +++ b/tests/testthat/test-Start-transform-three-selectors.R @@ -8,8 +8,6 @@ # Note that the original latitude is descending [90:-90]. -context("Transform: three selector forms") - #--------------------------------------------------------------- # cdo is used to verify the data values library(easyNCDF) diff --git a/tests/testthat/test-Start-two_dats.R b/tests/testthat/test-Start-two_dats.R index e2fef3b098b34c842b4e234b3f9b6e8354f856eb..46b57d84d29f6fe357f9246a241a940257b89076 100644 --- a/tests/testthat/test-Start-two_dats.R +++ b/tests/testthat/test-Start-two_dats.R @@ -1,5 +1,4 @@ # ex1_8 -context("Start() two dats and two vars in one call") test_that("1. ex1_8, case 1", { diff --git a/tests/testthat/test-Start-values_list_vector.R b/tests/testthat/test-Start-values_list_vector.R index a84530f9cbb6400b2aa2798ba563104c075eae1f..1a6288be8d6f98df37326d33a4908253df1cabac 100644 --- a/tests/testthat/test-Start-values_list_vector.R +++ b/tests/testthat/test-Start-values_list_vector.R @@ -4,7 +4,6 @@ # 3. transform, indices reversed # 4. no transform, indices reversed -context("List of values and vector of values") #----------------------------------------------------------------- # To get lat and lon vectors