The problem happened when longitude was requested globally but also across the circular border. For example,
repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc"
var <- 'tas'
lon.min <- 0
lon.max <- 359.723 # bigger than the real maximum longitude in netCDF file but smaller than 360
lat.min <- -90
lat.max <- 90
data <- Start(dat = repos,
var = var,
sdate = c('20170101', '20170401'),
ensemble = indices(1),
time = indices(1),
latitude = values(list(lat.min, lat.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lon.min, lon.max)),
longitude_reorder = CircularSort(-180, 180),
return_vars = list(time = 'sdate',
longitude = NULL,
latitude = NULL),
retrieve = FALSE
)
The output longitude dimension length should be 1296, while it was 1297. The repetitive value happened in lon = 0. This development fixes this mistake.