From 5e288fae37031fbd000187aeeec492bee610fbd3 Mon Sep 17 00:00:00 2001 From: aho Date: Wed, 15 Mar 2023 17:16:29 +0100 Subject: [PATCH] Fix cdo version check for the version containing non-numeric --- R/CDORemap.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/CDORemap.R b/R/CDORemap.R index 927b107..09a0004 100644 --- a/R/CDORemap.R +++ b/R/CDORemap.R @@ -629,13 +629,14 @@ CDORemap <- function(data_array = NULL, lons, lats, grid, method, if (nchar(Sys.which('cdo')[1]) < 1) { stop("CDO must be installed in order to use the .CDORemap.") } - cdo_version <- as.numeric_version( + cdo_version <- strsplit(suppressWarnings(system2("cdo", args = '-V', stderr = TRUE))[[1]], ' ')[[1]][5] - ) .warning(paste0("CDORemap: Using CDO version ", cdo_version, ".")) + cdo_version <- as.numeric_version(unlist(strsplit(cdo_version, "[A-Za-z]", fixed = FALSE))[[1]]) if ((cdo_version >= as.numeric_version('1.7.0')) && (method == 'con')) { method <- 'ycon' } + # CDO takes arrays of 3 dimensions or 4 if one of them is unlimited. # The unlimited dimension can only be the left-most (right-most in R). # There are no restrictions for the dimension names or variable names. -- GitLab