Error reading the calendar when using synonims
I'm getting the following error when trying to read data with Start() using a synonym for the time dimension:
Error in if (calendar == "standard") calendar <- "gregorian": argument is of length zero
This is the simplified code I am using:
not_working <- Start(dataset = '/esarchive/exp/ecearth/a1ua/cmorfiles/DCPP/EC-Earth-Consortium/EC-Earth3/dcppA-hindcast/$member$/Omon/$var$/gr/v20190713/$var$_Omon_EC-Earth3_dcppA-hindcast_s$sdate$-$member$_gr_$fyear$.nc',
var = 'tos',
sdate = paste0(1960:1965),
fmonth = c(1:122),
lat = 'all',
lon = 'all',
fyear = 'all',
member = 'all',
fyear_depends = 'sdate',
fmonth_across = 'fyear',
merge_across_dims = TRUE,
synonims = list(fmonth = c('fmonth','time')),
return_vars = list(lat = 'dataset', lon = 'dataset'),
num_procs = 1, retrieve = FALSE)
The same code without the synonym works (using time
instead of fmonth
):
working <- Start(dataset = '/esarchive/exp/ecearth/a1ua/cmorfiles/DCPP/EC-Earth-Consortium/EC-Earth3/dcppA-hindcast/$member$/Omon/$var$/gr/v20190713/$var$_Omon_EC-Earth3_dcppA-hindcast_s$sdate$-$member$_gr_$fyear$.nc',
var = 'tos',
sdate = paste0(1960:1965),
time = c(1:122),
lat = 'all',
lon = 'all',
fyear = 'all',
member = 'all',
fyear_depends = 'sdate',
time_across = 'fyear',
merge_across_dims = TRUE,
# synonims = list(fmonth = c('fmonth','time')),
return_vars = list(lat = 'dataset', lon = 'dataset'),
num_procs = 1, retrieve = FALSE)
The error jumps in the line 202
of the NcDataReader.R
(https://earth.bsc.es/gitlab/es/startR/-/blob/master/R/NcDataReader.R). I think it is because it tries to get the attributes of the time
dimension, but there is not any dimension named time
because of the use of the synonym. Could you please take a look?
Thank you very much,
Carlos