Start(): metadata of the variable is not retrieved properly
According to Start() documentation, the parameter 'metadata_dims':
A vector of character strings with the names of the file dimensions which to return metadata for. As noted in 'file_data_reader', the data reader can optionally return auxiliary data via the attribute 'variables' of the returned array. Start() by default returns the auxiliary data read for only the first file of each source (or data set) in the pattern dimension (see \code{\dots} for info on what the pattern dimension is). However it can be configured to return the metadata for all the files along any set of file dimensions. The parameter 'metadata_dims' allows to configure this level of granularity of the returned metadata.
The problem happens when the data set is more than 1. As mentioned above, the metadata should be read from the first file of each source (data set), but it is only read from the first data set.
repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"
repos2 <- "/esarchive/exp/ecmwf/system4_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"
var <- 'tas'
data <- Start(dat = list(list(name = 'system4_m1', path = repos2),
list(name = 'system5_m1', path = repos)),
var = var,
sdate = '20170101',
ensemble = indices(1),
time = indices(1),
lat = 'all',
lon = 'all',
synonims = list(lat = c('lat', 'latitude'),
lon = c('lon', 'longitude')),
return_vars = list(time = 'sdate',
longitude = 'dat',
latitude = 'dat'),
metadata_dims = 'dat', # it can be omitted since it is automatically specified as 'dat'
retrieve = T
)
str(data)
startR_array [1:2, 1, 1, 1, 1, 1:640, 1:1296] 247 249 247 249 247 ...
- attr(*, "Variables")=List of 3
..$ common :List of 2
.. ..$ time: POSIXct[1:1], format: "2017-02-01"
.. ..$ tas :List of 11
.. .. ..$ prec : chr "float"
.. .. ..$ units : chr "K"
.. .. ..$ dim :List of 4
.. .. .. ..$ :List of 10
.. .. .. .. ..$ name : chr "longitude"
.. .. .. .. ..$ len : int 512
.. .. .. .. ..$ unlim : logi FALSE
.. .. .. .. ..$ group_index : int 1
.. .. .. .. ..$ group_id : int 131072
.. .. .. .. ..$ id : int 2
.. .. .. .. ..$ dimvarid :List of 5
.. .. .. .. .. ..$ id : int 2
.. .. .. .. .. ..$ group_index: int 1
.. .. .. .. .. ..$ group_id : int 131072
.. .. .. .. .. ..$ list_index : num -1
.. .. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. .. ..$ units : chr "degrees_east"
.. .. .. .. ..$ vals : num [1:512(1d)] 0 0.703 1.406 2.109 2.812 ...
.. .. .. .. ..$ create_dimvar: logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. .. ..$ :List of 10
.. .. .. .. ..$ name : chr "latitude"
.. .. .. .. ..
'tas' is listed under $common and has the metadata from the first data set, system4_m1. It should be listed under $system4_m1 and $system5_m1 each.