CDORemap: bugs with metadata and cdo remap
As reported by @amanriqu , CDORemap crashes in the following situation due to wrong interpretation of metadata:
mask_path <- '/esnas/exp/ecearth/constant/land_sea_mask_2560x1280.nc'
mask <- NcToArray(mask_path, vars_to_read = 'LSM', drop_var_dim = TRUE)
lats <- NcToArray(mask_path, vars_to_read = 'lat', drop_var_dim = TRUE)
lons <- NcToArray(mask_path, vars_to_read = 'lon', drop_var_dim = TRUE)
new_mask <- CDORemap(mask, lons, lats, europe.MSWEP$source_files[1], 'bilinear')
Ignoring metadata fixes the issue, but another bug appears because CDORemap expects 'lon' and 'lat' dimension names in the remapped file, but the actual names are 'longitude' and 'latitude':
mask_path <- '/esnas/exp/ecearth/constant/land_sea_mask_2560x1280.nc'
mask <- NcToArray(mask_path, vars_to_read = 'LSM', drop_var_dim = TRUE)
attr(mask, 'variables') <- NULL
lats <- NcToArray(mask_path, vars_to_read = 'lat', drop_var_dim = TRUE)
attr(lats, 'variables') <- NULL
lons <- NcToArray(mask_path, vars_to_read = 'lon', drop_var_dim = TRUE)
attr(lons, 'variables') <- NULL
new_mask <- CDORemap(mask, lons, lats, europe.MSWEP$source_files[1], 'bilinear')