Newer
Older
% 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)
\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. Any other object class will not be accepted.}
Eva Rifà
committed
\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.}
The function returns an 's2dv_cube' object to be easily used with
Eva Rifà
committed
functions \code{CST} from CSTools and CSIndicators packages. The object is
mainly a list with the following elements:\cr
\itemize{
\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. If any coordinate is not provided, it
is set as an index vector with the values from 1 to the length of the
corresponding dimension. The attribute 'indices' indicates wether the
coordinate is an index vector (TRUE) or not (FALSE).}
\item{'attrs', named list with elements:
\itemize{
\item{'Dates', array with named temporal dimensions of class 'POSIXct' from
time values in the data.}
\item{'Variable', has the following components:
\itemize{
\item{'varName', with the short name of the loaded variable as specified
in the parameter 'var'.}
\item{'level', with information on the pressure level of the variable.
Is kept to NULL by now.}
}
}
\item{'Datasets', character strings indicating the names of the dataset.}
\item{'source_files', a vector of character strings with complete paths to
all the found files involved in loading the data.}
\item{'when', a time stamp of the date issued by the Start() or Load() call to
obtain the data.}
\item{'load_parameters', it contains the components used in the arguments to
load the data from Start() or Load() functions.}
}
}
This function converts data loaded using startR package or s2dv
Load function into a 's2dv_cube' object.
repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc'
data <- Start(dat = repos,
var = 'tas',
sdate = c('20170101', '20180101'),
latitude = indices(1:5),
longitude = indices(1:5),
return_vars = list(latitude = 'dat', longitude = 'dat', time = 'sdate'),
retrieve = TRUE)
data <- as.s2dv_cube(data)
class(data)
startDates <- c('20001101', '20011101', '20021101',
Eva Rifà
committed
'20031101', '20041101', '20051101')
nmember = 2, sdates = startDates,
leadtimemax = 3, latmin = 10, latmax = 30,
lonmin = -10, lonmax = 10, output = 'lonlat')
data <- as.s2dv_cube(data)
class(data)
}
}
\code{\link{s2dv_cube}}, \code{\link[s2dv]{Load}},
\code{\link[startR]{Start}} and \code{\link{CST_Load}}