From ad4e08719481b6de127bf72cea01451e1e77e53a Mon Sep 17 00:00:00 2001 From: nperez Date: Tue, 14 Jul 2020 17:43:26 +0200 Subject: [PATCH 1/3] Fixing dates calendar to work with CDO --- R/CST_SaveExp.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index b98f3668..1bdd4779 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -24,7 +24,7 @@ #'\dontrun{ #'library(CSTools) #'data <- lonlat_data$exp -#'destination <- "./path/" +#'destination <- "./path2/" #'CST_SaveExp(data = data, destination = destination) #'} #' @@ -256,9 +256,10 @@ SaveExp <- function(data, lon, lat, Dataset, var_name, units, startdates, Dates, dim_names <- names(dim(data)) if (any(dim_names != c('longitude', 'latitude', 'member', 'time'))) { data <- Reorder(data, c('longitude', 'latitude', 'member', 'time')) - } - dim_time <- ncdim_def(name = 'time', units = 'days since 1970-01-01', - vals = as.numeric(Dates), + } + differ <- as.numeric((Dates - Dates[1])/3600) + dim_time <- ncdim_def(name = 'time', units = paste('hours since', Dates[1]), + vals = differ, calendar = 'proleptic_gregorian', longname = 'time', unlim = TRUE) list_pos = length(dims_var) + 1 dims_var[[list_pos]] <- dim_time -- GitLab From 79d9ecf7eec8c39b680ff574e1a7eadff499d710 Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 28 Oct 2020 15:29:14 +0100 Subject: [PATCH 2/3] Documentation updated --- NAMESPACE | 1 - man/CST_SaveExp.Rd | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 8908f0ed..983a8926 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -52,7 +52,6 @@ import(rainfarmr) import(s2dverification) import(stats) importFrom(ClimProjDiags,SelBox) -importFrom(ClimProjDiags,Subset) importFrom(RColorBrewer,brewer.pal) importFrom(abind,abind) importFrom(data.table,CJ) diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd index 0e49c119..ddd9164e 100644 --- a/man/CST_SaveExp.Rd +++ b/man/CST_SaveExp.Rd @@ -25,7 +25,7 @@ This function allows to divide and save a object of class \dontrun{ library(CSTools) data <- lonlat_data$exp -destination <- "./path/" +destination <- "./path2/" CST_SaveExp(data = data, destination = destination) } -- GitLab From a7ea6f15c3366d0bfb03f375fedf7dc0729e7607 Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 28 Oct 2020 15:30:18 +0100 Subject: [PATCH 3/3] Updated NEWS --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 7e18054c..92ad49b1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,7 +9,7 @@ - Fixes: + PlotForecastPDF correctly displays terciles labels - + + CST_SaveExp correctly save time units ### CSTools 3.1.0 **Submission date to CRAN: 02-07-2020** -- GitLab