From 5ba2c2ff0258ea4f2fb19ccf5b45402b1a205fe0 Mon Sep 17 00:00:00 2001 From: nperez Date: Fri, 25 Oct 2019 15:49:49 +0200 Subject: [PATCH 1/8] Change function name --- NAMESPACE | 1 + R/CST_SaveExp.R | 180 +++++++++++++++++++++++++++++++++++++++++++++ man/CST_SaveExp.Rd | 32 ++++++++ 3 files changed, 213 insertions(+) create mode 100644 R/CST_SaveExp.R create mode 100644 man/CST_SaveExp.Rd diff --git a/NAMESPACE b/NAMESPACE index ef0bfd71..50fa68c6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(CST_MultivarRMSE) export(CST_RFSlope) export(CST_RFWeights) export(CST_RainFARM) +export(CST_SaveExp) export(PlotCombinedMap) export(PlotForecastPDF) export(PlotMostLikelyQuantileMap) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R new file mode 100644 index 00000000..1cada6ca --- /dev/null +++ b/R/CST_SaveExp.R @@ -0,0 +1,180 @@ +#'Save CSTools objects of class 's2dv_cube' containig experiment or oberved data in NCDF format +#' +#'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} +#' +#'@description This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Loa} function. +#' +#'@param data an object of class \code{s2dv_cube}. +#'@param destination a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data". +#' +#'@seealso \code{\link[easyNCDF]{ArrayToNc}}, \code{\link{SaveNC}} and \code{\link{CST_Load}} +#' +#'@import s2dverification +#'@import ncdf4 +#' +#'@examples +#'\dontrun{ +#'library(CSTools) +#'data <- lonlat_data$exp +#'destination <- "./path/" +#'CST_SaveExp(data = data, destination = destination) +#'} +#' +#'@export +CST_SaveExp <- function(data, destination = "./CST_Data") { + if (!is.character(destination) & length(destination) > 1) { + stop("Parameter 'destination' must be a character string of one element ", + "indicating the name of the file (including the folder if needed) ", + "where the data will be saved.") + } + if (!inherits(data, 's2dv_cube')) { + stop("Parameter 'data' must be of the class 's2dv_cube', ", + "as output by CSTools::CST_Load.") + } +dimname <- names(dim(data$data)) + if (any(dimname == "time")) { + dimname[which(dimname == "time")] <- "ftime" + names(dim(data$data))[which(dimname == "time")] <- "ftime" + } + if (any(dimname == "memb")) { + dimname[which(dimname == "memb")] <- "member" + names(dim(data$data))[which(dimname == "memb")] <- "member" + } + if (is.null(dimname)) { + stop("Element 'data' in parameter 'data' must have named dimensions.") + } +sdate_pos <- which(dimname == "sdate") + + if (length(sdate_pos) == 0) { + stop("Element 'data' in parameter 'data' hasn't 'sdate' dimension.") + } else if (length(sdate_pos) > 1) { + stop("Element 'data' in parameter 'data' has more than one 'sdate'", + " dimension.") + } +n_sdates <- dim(data$data)[sdate_pos] # number of files to create + +dataset_pos <- which(dimname == "dataset") +dims <- dim(data$data) + if (length(dataset_pos) == 0) { + warning("Element 'data' in parameter 'data' hasn't 'dataset' dimension.", + "All data is stored in the same 'dataset' folder.") + data$data <- InsertDim(var = data$data, posdim = 1, lendim = 1) + dim(data$data)[1] <- "dataset" + dimname <- c("dataset", dimname) + dataset_pos = 1 + } else if (length(dataset_pos) > 1) { + stop("Element 'data' in parameter 'data' has more than one 'dataset'", + " dimension.") + } +n_datasets <- dim(data$data)[dataset_pos] # number of folder by dataset + +# dataset names: +datasets <- names(data$Datasets) + if (n_datasets > length(datasets)) { + warning("Dimension 'dataset' in element 'data' from parameter 'data' ", + "is greater than those listed in element 'Datasets' and the ", + "first element is reused.") + datasets <- c(datasets, rep(datasets[1], n_datasets - length(datasets))) + } else if (n_datasets < length(datasets)) { + warning("Dimension 'dataset' in element 'data' from parameter 'data', ", + "is smaller than those listed in element 'Datasets' and only the", + " first element will be used.") + datasets <- datasets[1 : n_datasets] + } +# var names: +var_name <- data$Variable$varName + if (length(var_name) != 1) { + stop("One variable name must be included in element 'Variable$varName' ", + "of parameter 'data'.") + } + if (!is.character(var_name)) { + stop("Element 'Variable$varName' of parameter 'data' ", + "must be a character string.") + } + +# 1) create paths DONE +# 2) create folders DONE +# 3) select data DONE +# 4) create files +known_dim_names <- c("lat", "latitude", "lon", "longitude", "time", "ftime", + "sdate", "dataset", "nlevel", "levels") +dims_var <- NULL +list_pos <- 1 + + if (any(dimname == 'longitude') | any(dimname == 'lon')) { + dim_lon <- ncdim_def(name = 'lon', units = 'degrees', + vals = as.vector(data$lon), longname = 'longitude') + dims_var[[list_pos]] <- dim_lon + list_pos <- list_pos + 1 + } + if (any(dimname == 'latitude') | any(dimname == 'lat')) { + dim_lat <- ncdim_def(name = 'lat', units = 'degrees_north', + vals = as.vector(data$lat), longname = 'latitude') + dims_var[[list_pos]] <- dim_lat + list_pos <- list_pos + 1 + } + + if (any(!(dimname %in% known_dim_names))) { + dims_member <- dimname[!(dimname %in% known_dim_names)] + if (length(dims_member) > 1) { + stop("Ask for saving realizations or further dimensions to the mantainer.") + } else { + dim_memb <- ncdim_def(name = 'ensemble', units = "adim", + vals = 1 : dim(data$data)[which(dimname == 'member')], + longname = 'ensemble', create_dimvar = TRUE) + dims_var[[list_pos]] <- dim_memb + list_pos <- list_pos + 1 + } + } + + # Lead-time depends on the start date + nlt <- length(data$Dates$start)/n_sdates + + if (any(dimname == 'level') | any(dimname =='level')) { + stop("Ask for saving 3Dim fields to the mantainer.") + } + + for (i in 1 : n_datasets) { + path <- file.path(destination, datasets[i], var_name) + + dir.create(path, recursive = TRUE) + startdate <- gsub("-", "", data$Datasets[[i]]$InitializationDates[[1]]) + file_name <- paste0(var_name, "_", startdate, ".nc") + full_filename <- file.path(path, file_name) + + data_dataset <- Subset(data$data, along = which(dimname == 'dataset'), indices = i) + standard_order <- c("lon", "lat", "member", "ftime") + change_names <- c("lon", "lat", "ensemble", "ftime") + for (j in 1 : n_sdates) { + n_data <- s2dverification::Subset(data_dataset, along = which(dimname == 'sdate'), + indices = j, drop = TRUE) + pos_standard_order <- match( standard_order, names(dim(n_data))) + + n_data <- aperm(n_data, pos_standard_order) + + names(dim(n_data)) <- change_names + + # Lead-time depends on the start date + # The correct time should be selected from $Dates$start + time_values <- as.Date(substr(data$Dates$start[(j * nlt - nlt + 1):(j * nlt)], 1, 10)) + + if (any(dimname == 'time') | any(dimname == 'ftime')) { + dim_time <- ncdim_def(name = 'time', units = 'days since 1970-01-01', + vals = as.numeric(time_values), + longname = 'time', unlim = TRUE) + if (i == 1 & j == 1) { + dims_var[[list_pos]] <- dim_time + list_pos <- list_pos + 1 + } + } + + datanc <- ncvar_def(name = var_name, units = attributes(data$Variable)$units, + dim = dims_var, missval = -99999) + file_nc <- nc_create(full_filename[j], datanc) + ncvar_put(file_nc, datanc, n_data) + ncatt_put(file_nc, datanc, 'coordinates', attr(data$lon, 'cdo_grid_name')) + ncatt_put(file_nc, datanc, 'projection', attr(data$lon, 'projection')) + nc_close(file_nc) + } + } +} diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd new file mode 100644 index 00000000..32377eaa --- /dev/null +++ b/man/CST_SaveExp.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/CST_SaveExp.R +\name{CST_SaveExp} +\alias{CST_SaveExp} +\title{Save CSTools objects of class 's2dv_cube' containig experiment or oberved data in NCDF format} +\usage{ +CST_SaveExp(data, destination = "./CST_Data") +} +\arguments{ +\item{data}{an object of class \code{s2dv_cube}.} + +\item{destination}{a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data".} +} +\description{ +This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Loa} function. +} +\examples{ +\dontrun{ +library(CSTools) +data <- lonlat_data$exp +destination <- "./path/" +CST_SaveExp(data = data, destination = destination) +} + +} +\author{ +Perez-Zanon Nuria, \email{nuria.perez@bsc.es} +} +\seealso{ +\code{\link[easyNCDF]{ArrayToNc}}, \code{\link{SaveNC}} and \code{\link{CST_Load}} +} + -- GitLab From bfdf119faa50d2eab3de5081be9bf3624b8dd7d3 Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 28 Oct 2019 10:01:56 +0100 Subject: [PATCH 2/8] Correction to work with as.s2dv_cube --- NAMESPACE | 1 + R/CST_SaveExp.R | 54 ++++++++++++++++++++++++++++++++++------------ man/CST_SaveExp.Rd | 2 +- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 50fa68c6..0258b8f3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -15,6 +15,7 @@ export(PlotForecastPDF) export(PlotMostLikelyQuantileMap) export(RFSlope) export(RainFARM) +import(abind) import(ggplot2) import(multiApply) import(ncdf4) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index 1cada6ca..d206f5d4 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -7,10 +7,11 @@ #'@param data an object of class \code{s2dv_cube}. #'@param destination a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data". #' -#'@seealso \code{\link[easyNCDF]{ArrayToNc}}, \code{\link{SaveNC}} and \code{\link{CST_Load}} +#'@seealso \code{\link{CST_Load}} #' #'@import s2dverification #'@import ncdf4 +#'@import abind #' #'@examples #'\dontrun{ @@ -40,6 +41,20 @@ dimname <- names(dim(data$data)) dimname[which(dimname == "memb")] <- "member" names(dim(data$data))[which(dimname == "memb")] <- "member" } + if (any(dimname == "ensemble")) { + dimname[which(dimname == "ensemble")] <- "member" + names(dim(data$data))[which(dimname == "ensemble")] <- "member" + } + if (any(dimname == "longitude")) { + dimname[which(dimname == "longitude")] <- "lon" + names(dim(data$data))[which(dimname == "longitude")] <- "lon" + } + if (any(dimname == "latitude")) { + dimname[which(dimname == "latitude")] <- "lat" + names(dim(data$data))[which(dimname == "latitude")] <- "lat" + } +names(dim(data$data)) <- dimname + if (is.null(dimname)) { stop("Element 'data' in parameter 'data' must have named dimensions.") } @@ -53,13 +68,13 @@ sdate_pos <- which(dimname == "sdate") } n_sdates <- dim(data$data)[sdate_pos] # number of files to create -dataset_pos <- which(dimname == "dataset") +dataset_pos <- which(dimname == "dataset" | dimname == "dat") dims <- dim(data$data) if (length(dataset_pos) == 0) { warning("Element 'data' in parameter 'data' hasn't 'dataset' dimension.", "All data is stored in the same 'dataset' folder.") data$data <- InsertDim(var = data$data, posdim = 1, lendim = 1) - dim(data$data)[1] <- "dataset" + names(dim(data$data))[1] <- "dataset" dimname <- c("dataset", dimname) dataset_pos = 1 } else if (length(dataset_pos) > 1) { @@ -67,7 +82,6 @@ dims <- dim(data$data) " dimension.") } n_datasets <- dim(data$data)[dataset_pos] # number of folder by dataset - # dataset names: datasets <- names(data$Datasets) if (n_datasets > length(datasets)) { @@ -82,6 +96,13 @@ datasets <- names(data$Datasets) datasets <- datasets[1 : n_datasets] } # var names: + if ('var' %in% dimname) { + var_pos <- which(dimname == 'var') + if (dims[var_pos] == 1) { + data$data <- adrop(data$data, drop = var_pos) + dimname <- names(dim(data$data)) + } + } var_name <- data$Variable$varName if (length(var_name) != 1) { stop("One variable name must be included in element 'Variable$varName' ", @@ -96,8 +117,8 @@ var_name <- data$Variable$varName # 2) create folders DONE # 3) select data DONE # 4) create files -known_dim_names <- c("lat", "latitude", "lon", "longitude", "time", "ftime", - "sdate", "dataset", "nlevel", "levels") +known_dim_names <- c("var", "lat", "latitude", "lon", "longitude", "time", "ftime", + "sdate", "dataset", "dat", "nlevel", "levels") dims_var <- NULL list_pos <- 1 @@ -113,7 +134,6 @@ list_pos <- 1 dims_var[[list_pos]] <- dim_lat list_pos <- list_pos + 1 } - if (any(!(dimname %in% known_dim_names))) { dims_member <- dimname[!(dimname %in% known_dim_names)] if (length(dims_member) > 1) { @@ -136,7 +156,6 @@ list_pos <- 1 for (i in 1 : n_datasets) { path <- file.path(destination, datasets[i], var_name) - dir.create(path, recursive = TRUE) startdate <- gsub("-", "", data$Datasets[[i]]$InitializationDates[[1]]) file_name <- paste0(var_name, "_", startdate, ".nc") @@ -146,17 +165,18 @@ list_pos <- 1 standard_order <- c("lon", "lat", "member", "ftime") change_names <- c("lon", "lat", "ensemble", "ftime") for (j in 1 : n_sdates) { - n_data <- s2dverification::Subset(data_dataset, along = which(dimname == 'sdate'), - indices = j, drop = TRUE) + n_data <- s2dverification::Subset(data_dataset, + along = which(dimname == 'sdate'), + indices = j, drop = TRUE) pos_standard_order <- match( standard_order, names(dim(n_data))) - n_data <- aperm(n_data, pos_standard_order) names(dim(n_data)) <- change_names # Lead-time depends on the start date # The correct time should be selected from $Dates$start - time_values <- as.Date(substr(data$Dates$start[(j * nlt - nlt + 1):(j * nlt)], 1, 10)) + time_values <- as.Date(substr(data$Dates$start[(j * nlt - nlt + 1):(j * nlt)], + 1, 10)) if (any(dimname == 'time') | any(dimname == 'ftime')) { dim_time <- ncdim_def(name = 'time', units = 'days since 1970-01-01', @@ -167,8 +187,14 @@ list_pos <- 1 list_pos <- list_pos + 1 } } - - datanc <- ncvar_def(name = var_name, units = attributes(data$Variable)$units, + if (!is.character(attributes(data$Variable)$units)) { + units = attributes(data$Variable)$variable$units + } else { + units = attributes(data$Variable)$units + } + + datanc <- ncvar_def(name = var_name, + units = units, dim = dims_var, missval = -99999) file_nc <- nc_create(full_filename[j], datanc) ncvar_put(file_nc, datanc, n_data) diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd index 32377eaa..397494b1 100644 --- a/man/CST_SaveExp.Rd +++ b/man/CST_SaveExp.Rd @@ -27,6 +27,6 @@ CST_SaveExp(data = data, destination = destination) Perez-Zanon Nuria, \email{nuria.perez@bsc.es} } \seealso{ -\code{\link[easyNCDF]{ArrayToNc}}, \code{\link{SaveNC}} and \code{\link{CST_Load}} +\code{\link{CST_Load}} } -- GitLab From db2267733c8a61860ff2fc46243b664cdd0e84d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filippo=20Cal=C3=AC=20Quaglia?= Date: Tue, 29 Oct 2019 21:32:46 +0100 Subject: [PATCH 3/8] Minor updates CST_SaveExp.R --- R/CST_SaveExp.R | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index d206f5d4..b07eb85b 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -2,7 +2,7 @@ #' #'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} #' -#'@description This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Loa} function. +#'@description This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Load} function. #' #'@param data an object of class \code{s2dv_cube}. #'@param destination a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data". @@ -113,10 +113,6 @@ var_name <- data$Variable$varName "must be a character string.") } -# 1) create paths DONE -# 2) create folders DONE -# 3) select data DONE -# 4) create files known_dim_names <- c("var", "lat", "latitude", "lon", "longitude", "time", "ftime", "sdate", "dataset", "dat", "nlevel", "levels") dims_var <- NULL @@ -150,7 +146,7 @@ list_pos <- 1 # Lead-time depends on the start date nlt <- length(data$Dates$start)/n_sdates - if (any(dimname == 'level') | any(dimname =='level')) { + if (any(dimname == 'level') { stop("Ask for saving 3Dim fields to the mantainer.") } -- GitLab From 860fb3e5726a99871881d9c92c864bc876691048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filippo=20Cal=C3=AC=20Quaglia?= Date: Tue, 29 Oct 2019 21:34:44 +0100 Subject: [PATCH 4/8] Update CST_SaveExp.R --- R/CST_SaveExp.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index b07eb85b..51ad6ef4 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -146,7 +146,7 @@ list_pos <- 1 # Lead-time depends on the start date nlt <- length(data$Dates$start)/n_sdates - if (any(dimname == 'level') { + if (any(dimname == 'level')) { stop("Ask for saving 3Dim fields to the mantainer.") } -- GitLab From 77c6082ced15c67670cbc1f05991c3d5b7ef76d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filippo=20Cal=C3=AC=20Quaglia?= Date: Wed, 30 Oct 2019 10:21:01 +0100 Subject: [PATCH 5/8] minor formatting --- R/CST_SaveExp.R | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index 51ad6ef4..bd729965 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -1,11 +1,18 @@ -#'Save CSTools objects of class 's2dv_cube' containig experiment or oberved data in NCDF format +#'Save CSTools objects of class 's2dv_cube' containig experiments or oberved +#'data in NCDF format #' #'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} #' -#'@description This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Load} function. +#'@description This function allows to divide and save a object of class +#''s2dv_cube' into a NetCDF file, allowing to reload the saved data using +#'\code{CST_Load} function. #' #'@param data an object of class \code{s2dv_cube}. -#'@param destination a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data". +#'@param destination a character string containing the directory name in which +#'to save the data. NetCDF file for each starting date are saved into the +#'folder tree: destination/experiment/variable/. By default the function +#'creates and saves the data into the folder "CST_Data" in the working +#'directory. #' #'@seealso \code{\link{CST_Load}} #' @@ -71,7 +78,7 @@ n_sdates <- dim(data$data)[sdate_pos] # number of files to create dataset_pos <- which(dimname == "dataset" | dimname == "dat") dims <- dim(data$data) if (length(dataset_pos) == 0) { - warning("Element 'data' in parameter 'data' hasn't 'dataset' dimension.", + warning("Element 'data' in parameter 'data' hasn't 'dataset' dimension. ", "All data is stored in the same 'dataset' folder.") data$data <- InsertDim(var = data$data, posdim = 1, lendim = 1) names(dim(data$data))[1] <- "dataset" @@ -113,8 +120,8 @@ var_name <- data$Variable$varName "must be a character string.") } -known_dim_names <- c("var", "lat", "latitude", "lon", "longitude", "time", "ftime", - "sdate", "dataset", "dat", "nlevel", "levels") +known_dim_names <- c("var", "lat", "latitude", "lon", "longitude", "time", + "ftime", "sdate", "dataset", "dat", "nlevel", "levels") dims_var <- NULL list_pos <- 1 @@ -167,7 +174,7 @@ list_pos <- 1 pos_standard_order <- match( standard_order, names(dim(n_data))) n_data <- aperm(n_data, pos_standard_order) - names(dim(n_data)) <- change_names + names(dim(n_data)) <- change_names # Lead-time depends on the start date # The correct time should be selected from $Dates$start @@ -188,7 +195,6 @@ list_pos <- 1 } else { units = attributes(data$Variable)$units } - datanc <- ncvar_def(name = var_name, units = units, dim = dims_var, missval = -99999) -- GitLab From bedb7dc042abcd92d1542e4a6807959c6c72ca9f Mon Sep 17 00:00:00 2001 From: nperez Date: Wed, 30 Oct 2019 15:48:52 +0100 Subject: [PATCH 6/8] as.s2dv and s2dv added to seealso doc section --- R/CST_SaveExp.R | 2 +- man/CST_SaveExp.Rd | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index bd729965..7ba6ac82 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -14,7 +14,7 @@ #'creates and saves the data into the folder "CST_Data" in the working #'directory. #' -#'@seealso \code{\link{CST_Load}} +#'@seealso \code{\link{CST_Load}}, \code{\link{as.s2dv_cube}} and \code{\link{s2dv_cube}} #' #'@import s2dverification #'@import ncdf4 diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd index 397494b1..d891208b 100644 --- a/man/CST_SaveExp.Rd +++ b/man/CST_SaveExp.Rd @@ -2,17 +2,24 @@ % Please edit documentation in R/CST_SaveExp.R \name{CST_SaveExp} \alias{CST_SaveExp} -\title{Save CSTools objects of class 's2dv_cube' containig experiment or oberved data in NCDF format} +\title{Save CSTools objects of class 's2dv_cube' containig experiments or oberved +data in NCDF format} \usage{ CST_SaveExp(data, destination = "./CST_Data") } \arguments{ \item{data}{an object of class \code{s2dv_cube}.} -\item{destination}{a character string containing the directory name in which to save the data diveded in separte folders for each experiment and variable and in separate NetCDF files for each start date. By default the function creates folders in the working directory called "CST_Data".} +\item{destination}{a character string containing the directory name in which +to save the data. NetCDF file for each starting date are saved into the +folder tree: destination/experiment/variable/. By default the function +creates and saves the data into the folder "CST_Data" in the working +directory.} } \description{ -This function allows to divide and save a object of class 's2dv_cube' in a NetCDF files to allow be reloaded using \code{CST_Loa} function. +This function allows to divide and save a object of class +'s2dv_cube' into a NetCDF file, allowing to reload the saved data using +\code{CST_Load} function. } \examples{ \dontrun{ @@ -27,6 +34,6 @@ CST_SaveExp(data = data, destination = destination) Perez-Zanon Nuria, \email{nuria.perez@bsc.es} } \seealso{ -\code{\link{CST_Load}} +\code{\link{CST_Load}}, \code{\link{as.s2dv_cube}} and \code{\link{s2dv_cube}} } -- GitLab From d8e29ae588464075682609dfb1e6414299fe3c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filippo=20Cal=C3=AC=20Quaglia?= Date: Wed, 30 Oct 2019 16:03:51 +0100 Subject: [PATCH 7/8] Update CST_SaveExp.R --- R/CST_SaveExp.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index 7ba6ac82..1b3b4b10 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -1,5 +1,5 @@ -#'Save CSTools objects of class 's2dv_cube' containig experiments or oberved -#'data in NCDF format +#'Save CSTools objects of class 's2dv_cube' containing experiments or observed +#'data in NetCDF format #' #'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} #' -- GitLab From ee9274bb44c0855eb89ac5f9b525f2d62609ede5 Mon Sep 17 00:00:00 2001 From: nperez Date: Thu, 14 Nov 2019 16:22:54 +0100 Subject: [PATCH 8/8] automatically documentation update with devtools --- man/CST_SaveExp.Rd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd index d891208b..17537205 100644 --- a/man/CST_SaveExp.Rd +++ b/man/CST_SaveExp.Rd @@ -2,8 +2,8 @@ % Please edit documentation in R/CST_SaveExp.R \name{CST_SaveExp} \alias{CST_SaveExp} -\title{Save CSTools objects of class 's2dv_cube' containig experiments or oberved -data in NCDF format} +\title{Save CSTools objects of class 's2dv_cube' containing experiments or observed +data in NetCDF format} \usage{ CST_SaveExp(data, destination = "./CST_Data") } -- GitLab