Skip to content

NcDataReader(): Wrong time attributes return

The time attribute is not correct in the Start() call below. date_vec = "196011" and "196102" are correct, but the ones in the middle are wrong. The data itself is correct. If the variable is "sic", it is correct.

library(startR)

path_obs <- paste0('/esarchive/obs/ukmo/hadisst_v1.1/monthly_mean/$var$/$var$_$file_date$.nc')
date_vec <- c("196011", "196012", "196101", "196102")

data_obs <- Start(dat = path_obs,
                  var = 'tos',
                  file_date = date_vec[2],
                  latitude = indices(100),
                  longitude = indices(100),
                  synonims = list(longitude = c('lon', 'longitude'),
                                  latitude = c('lat', 'latitude')),
                  return_vars = list(time = c('file_date'),
                                     latitude = NULL, longitude = NULL),
                  retrieve = TRUE)

time_attr <- attr(data_obs, 'Variables')$common$time
Edited by aho