From 939ee66b0fba079e4a180e78eb95ce5fa6dd4485 Mon Sep 17 00:00:00 2001 From: aho Date: Wed, 30 Sep 2020 15:18:16 +0200 Subject: [PATCH] Retrieve only the number in the cdo version. Exclude the letter part. --- R/Utils.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/Utils.R b/R/Utils.R index 44600181..9dfcaa73 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -206,7 +206,11 @@ if (Sys.which("cdo")[[1]] == "") { stop("Error: CDO libraries not available") } - cdo_version <- as.numeric_version(strsplit(suppressWarnings(system2("cdo", args = '-V', stderr = TRUE))[[1]], ' ')[[1]][5]) + + cdo_version <- strsplit(suppressWarnings(system2("cdo", args = '-V', stderr = TRUE))[[1]], ' ')[[1]][5] + + cdo_version <- as.numeric_version(unlist(strsplit(cdo_version, "[A-Za-z]", fixed = FALSE))[[1]]) + } # If the variable to load is 2-d, we need to determine whether: # - interpolation is needed -- GitLab