Metadata retrieval problem when one dataset does not exist
This issue is related to #66 (closed). The fix in issue 66 corrected the metadata reading when datasets > 1. However, if one dataset does not contain any valid files, the metadata retrieval has problems. Before this fix, Start() can still retrieve the data (with incorrect metadata) and the missing file dataset will be filled with NAs.
repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"
# incorrect path. Therefore repos2 doesn't have any valid files
repos2 <- "/esarchive/exp/ecmwf/system4_m1/monthly_mean/$var$_f2h/$var$_$sdate$.nc" # correct one is _f6h
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
)
Error in loaded_metadata[[loaded_metadata_count]] : subscript out of bounds