as.s2dv_cube.Rd 2.48 KB
Newer Older
nperez's avatar
nperez committed
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as.s2dv_cube.R
\name{as.s2dv_cube}
\alias{as.s2dv_cube}
\title{Conversion of 'startR_array' or 'list' objects to 's2dv_cube'}
\usage{
as.s2dv_cube(object, remove_attrs_coords = TRUE, remove_null = TRUE)
nperez's avatar
nperez committed
}
\arguments{
\item{object}{An object of class 'startR_array' generated from function 
\code{Start} from startR package or a list output from function \code{Load} 
from s2dv package.}

\item{remove_attrs_coords}{A logical value indicating whether to remove 
the attributes of the coordinates (TRUE) or not (FALSE) when the data is 
loaded from Start(). It is TRUE by default.}

\item{remove_null}{A logical value indicating whether to remove the elements 
that are NULL (TRUE) or not (FALSE) of the output object. It is TRUE by 
default.}
nperez's avatar
nperez committed
}
\value{
The function returns an 's2dv_cube' object to be easily used with 
functions \code{CST} from CSTools and CSIndicators packages. The structure 
is the following:\cr\cr
\item{data}{
 Array with named dimensions.
}
\item{dims}{
 Named vector of the data dimensions.
}
\item{coords}{
 Named list with elements of the coordinates corresponding to 
 the dimensions of the data parameter. 
}
\item{attrs}{
 Named list with elements: Dates, Variable, Datasets, source_files, when and load_parameters.
}
nperez's avatar
nperez committed
}
\description{
This function converts data loaded using startR package or s2dv 
Load function into a 's2dv_cube' object.
nperez's avatar
nperez committed
}
\examples{
\dontrun{
library(startR)
nperez's avatar
nperez committed
repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc'
data <- Start(dat = repos,
             var = 'tas',
             sdate = c('20170101', '20180101'),
             ensemble = indices(1:20),
             time = 'all',
             latitude = 'all',
             longitude = indices(1:40),
             return_vars = list(latitude = 'dat', longitude = 'dat', time = 'sdate'),
             retrieve = TRUE)
data <- as.s2dv_cube(data)
class(data)
startDates <- c('20001101', '20011101', '20021101',
                '20031101', '20041101', '20051101')
data <- Load(var = 'tas', exp = 'system5c3s', 
            nmember = 15, sdates = startDates,
            leadtimemax = 3, latmin = 27, latmax = 48,
            lonmin = -12, lonmax = 40, output = 'lonlat')
data <- as.s2dv_cube(data)
class(data)
}
}
nperez's avatar
nperez committed
\seealso{
\code{\link{s2dv_cube}}, \code{\link[s2dv]{Load}}, 
\code{\link[startR]{Start}} and \code{\link{CST_Load}}
nperez's avatar
nperez committed
\author{
Perez-Zanon Nuria, \email{nuria.perez@bsc.es}

Nicolau Manubens, \email{nicolau.manubens@bsc.es}
}