Start() returns error when transform to coarser grid and the transformed grid number is 1
The error happens when transforming to a coarser grid and the selected range has only 1 value after transformation. The error comes from Selector_Checker()**, which expects the transformed grid values are more than 1.
The example script is as below. The longitude grid number becomes 1 after transformation.
lons.min <- 350
lons.max <- 355
lats.min <- 20
lats.max <- 40
exp <- Start(dat = '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc',
var = 'tas',
sdate = '20000101',
ensemble = indices(1),
time = indices(1),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(),
longitude = values(list(lons.min, lons.max)),
longitude_reorder = CircularSort(0, 360),
transform = CDORemapper,
transform_params = list(grid = 'r100x50',
method = 'con',
crop = c(lons.min, lons.max, lats.min, lats.max)),
transform_vars = c('latitude', 'longitude'),
transform_extra_cells = 2,
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('longitude', 'lon')),
return_vars = list(latitude = NULL,
longitude = NULL,
time = 'sdate'),
retrieve = T)
Error in if (var[1] < var[2]) { : missing value where TRUE/FALSE needed
**The Start() code where error happens is:
sub_array_of_sri <- selector_checker(sub_array_of_selectors, transformed_subset_var,
tolerance = if (aiat) {
tolerance_params[[inner_dim]]
} else {
NULL
})