Skip to content

'probs' not explicitly defined in VizLayout.R call to VizMostLikelyQuantileMap.R

In VizLayout.R, the main data input is passed via the argument data, while VizMostLikelyQuantileMap.R uses probs. Currently, VizLayout.R does not explicitly define the probs argument when calling VizMostLikelyQuantileMap.R.

As @vagudets pointed out, this probably works because probs is the first positional argument in VizMostLIkelyQuantileMap.R, so data is being implicitly assigned to it. See https://earth.bsc.es/gitlab/es/esviz/-/blob/main/R/VizLayout.R#L740:

} else if (fun[[array_number]] %in% 'VizMostLikelyQuantileMap') {
  #TODO: pre-generate colorbar params? like above
  fun_args <- c(fun_args, list(brks = brks, cols = cols))
}

To make this more robust, a possible fix might be:

} else if (fun[[array_number]] %in% 'VizMostLikelyQuantileMap') {
  fun_args[["probs"]] <- fun_args[["data"]]
  fun_args[["data"]] <- NULL  
  fun_args <- c(fun_args, list(brks = brks, cols = cols))
}

However, there might be a better solution, so this should be discussed further.

Best,

Ariadna