Error in PlotCombinedMap
Hi @aho,
When calling the function PlotMostLikelyQuantileMap it appears an error from the function PlotCombinedMap. The code I used is the first example in the documentation:
# Step (0): Load necessary packages and source s2dv and CSTools functions from master
library(maps)
library(graphics)
library(grDevices)
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/PlotEquiMap.R")
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/ColorBar.R")
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/clim.palette.R")
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/Utils.R")
source("https://earth.bsc.es/gitlab/external/cstools/-/raw/master/R/PlotCombinedMap.R")
source("https://earth.bsc.es/gitlab/external/cstools/-/raw/master/R/PlotMostLikelyQuantileMap.R")
source("https://earth.bsc.es/gitlab/external/cstools/-/raw/master/R/zzz.R")
# Step (1): Run the example that calls the function:
# Simple example
x <- array(1:(20 * 10), dim = c(lat = 10, lon = 20)) / 200
a <- x * 0.6
b <- (1 - x) * 0.6
c <- 1 - (a + b)
lons <- seq(0, 359.5, length = 20)
lats <- seq(-89.5, 89.5, length = 10)
PlotMostLikelyQuantileMap(list(a, b, c), lons, lats,
toptitle = 'Most likely tercile map',
bar_titles = paste('% of belonging to', c('a', 'b', 'c')),
brks = 20, width = 12, height = 10)
# Error message:
# Error in res + slightly_tune_val :
# non-numeric argument to binary operator
I think that the error comes from the changes in last developments, I can see the error message appears in this line. Where the code tries to sum a numeric value (res
) with a list (slightly_tune_val
). If I source the version on CRAN it works:
source("https://earth.bsc.es/gitlab/external/cstools/-/raw/v5.0.1/R/PlotCombinedMap.R")
# Simple example
x <- array(1:(20 * 10), dim = c(lat = 10, lon = 20)) / 200
a <- x * 0.6
b <- (1 - x) * 0.6
c <- 1 - (a + b)
lons <- seq(0, 359.5, length = 20)
lats <- seq(-89.5, 89.5, length = 10)
PlotMostLikelyQuantileMap(list(a, b, c), lons, lats,
toptitle = 'Most likely tercile map',
bar_titles = paste('% of belonging to', c('a', 'b', 'c')),
brks = 20, width = 12, height = 10)
Do you think you can take a look on this since you are more familiar with the function?
Best,
Eva