From bd26386c61182d8db9a7e927ab8994ead8e1f036 Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 20 Aug 2020 18:15:52 +0200 Subject: [PATCH 1/3] Print the cdo version --- R/Utils.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/Utils.R b/R/Utils.R index 44600181..a98bebc7 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -207,6 +207,8 @@ stop("Error: CDO libraries not available") } cdo_version <- as.numeric_version(strsplit(suppressWarnings(system2("cdo", args = '-V', stderr = TRUE))[[1]], ' ')[[1]][5]) +print('cdo_version') +print(cdo_version) } # If the variable to load is 2-d, we need to determine whether: # - interpolation is needed -- GitLab From 0368c01e15a8be9f77de94854777123b704301c8 Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 20 Aug 2020 18:27:01 +0200 Subject: [PATCH 2/3] Consider characters in cdo version --- R/Utils.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/Utils.R b/R/Utils.R index a98bebc7..a8721b74 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -206,7 +206,9 @@ 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 <- 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]]) print('cdo_version') print(cdo_version) } -- GitLab From 4d5bde0b483e6a00346561c37643213440d0026c Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 20 Aug 2020 18:38:45 +0200 Subject: [PATCH 3/3] substract the first 5 characters of cdo version --- R/Utils.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/Utils.R b/R/Utils.R index a8721b74..b1240f24 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -206,11 +206,7 @@ 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]]) -print('cdo_version') -print(cdo_version) + cdo_version <- as.numeric_version(substr(strsplit(suppressWarnings(system2("cdo", args = '-V', stderr = TRUE))[[1]], ' ')[[1]][5], 1, 5)) } # If the variable to load is 2-d, we need to determine whether: # - interpolation is needed -- GitLab