Discussion of s2dv_cube object structure
Hi everyone,
Recently, there has been carried a discussion about s2dv_cube object structure due to different reasons. The objective is to standardise its structure to make it more consistent with used dimensions and attributes. And also, to make it more compatible to startR package.
An example of the current s2dv_cube object structure is the following:
> names(dim(exp$data))
[1] "dataset" "member" "sdate" "ftime" "lat" "lon"
> attributes(exp)
$names
[1] "data" "lon" "lat" "Variable"
[5] "Datasets" "Dates" "when" "source_files"
[9] "load_parameters"
$class
[1] "s2dv_cube"
Currently, there are opened issues that are about s2dv_cube object structure. However, it would be a good idea to continue with the discussion in a common place. Here there are some points that were discussed in the meeting and that could be the firsts steps to standardise the s2dv_cube object:
-
Adding the ‘…’ argument in s2dv_cube and as.s2dv_cube functions. With this, we think it could be a solution to issue #90 (closed) opened by @jramon.
-
Match data dimensions with each coordinate dimension. For any coordinate that contains an array which is tied to one or multiple dimensions in $data, the array should have the same dimensions with the same names. For example, imagine we have an an sd2v_cube object named 'obs' with the following dimensions:
-
Match data dimension names with coordinate dimension names.
-
Include all the dimensions in "coordinates" list. For example, if
names(dim(data)): [sdate, time, lat, lon]
,
New s2dv_cube object structure:
Example array of dimensions:
dataset member sdate ftime lat lon
1 15 6 3 22 53
$data: [array with named dimensions]
$dims: [named vector with dimensions]
$coords
# (same elements as dim(data))
$dataset: [named indexes vector of dataset]
$member: [named indexes vector of members]
$sdate: [named vector of character string with sdates]
$ftime: [named indexes vector of ftime]
$lat: [named vector of latitudes]
$lon: [named vector of longitudes]
$attrs
$Variable
$variables [list of all the variables information]
$varName [character string of the variable name from the input argument in Start(): var, vars]
$Datasets [information of Datasets (name, initialization dates, ...)]
$source_files [data path]
$when [date when data has been loaded]
$Dates: [array with named time dimensions with Dates of POSIXct class]
$load_parameters: [input parameters of Load/Start function]
* In CST_* functions, if they need to use the values of lat/lon/Dates/etc., find the name in a pre-defined list. E.g.,
s2dv:::.KnownLonNames() has several possible options for longitude
** When `$Dates` is modified by functions SelectPeriodOnData/Dates() the original dates will be stored as attributes in element `$Dates`.
Everyone interested in this development is invited to this discussion,
@aho, @bsolaraj, @cdelgado, @fbeninca, @lpalma, @nperez
Please, tag people if I missed someone
Cheers,
Eva