Poor error message when time selector is an array with dimension named as one file dim
If time selector is an array and the values are across files, the dimension names cannot be the same as other file dimensions. The following example will work if $sdate$
is changed to other names like $file_date$
OR time_arr
has dimension names like [time, date]
.
The error message is:
Error in Start(dat = repos, var = "tas", sdate = sdates, time = time_arr, : Provided indices out of range for dimension 'time' for dataset 'dat1' (accepted range: 1 to 1).
, which is not clear to the real problem.
sdates <- paste0("20050", 1:6)
time_arr <- array(1:6, dim = c(time = 2, sdate = 3))
repos <- '/esarchive/recon/ecmwf/erainterim/monthly_mean/$var$_f6h/$var$_$sdate$.nc'
data <- Start(dat = repos,
var = 'tas',
sdate = sdates,
time = time_arr, #[time = 12, sdate = 3]
time_across = 'sdate',
merge_across_dims = T,
split_multiselected_dims = T,
lat = values(list(1, 3)),
lat_reorder = Sort(),
lon = values(list(1, 5)),
lon_reorder = CircularSort(-180, 180),
synonims = list(lat = c('lat', 'latitude'),
lon = c('lon', 'longitude')),
return_vars = list(lon = 'dat', lat = 'dat',
time = 'sdate'),
retrieve = FALSE)
But there is another case ex1_13 that the inner dim depends on the file dim. Test this case when making the improvement.