Step() parameter "use_libraries" is not functional in ByChunks()
The definition of the parameter use_libraries
:
#'@param use_libraries A vector of character string indicating the R library
#' names to be used in 'fun'. The default value is NULL.
The libraries are saved in attributes, and eventually in the attributes of operation in Compute(). However, in ByChunks(), the libraries are not loaded. So the computation at Apply() in ByChunks() fails because functions not found.
# find a data to load by Start()
repos <- '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc'
data <- Start(dat = repos,
var = 'tas',
sdate = c('20170101', '20180101'),
ensemble = indices(1:20),
time = 'all',
latitude = indices(1:4),
longitude = indices(1:4),
return_vars = list(latitude = 'dat', longitude = 'dat', time = 'sdate'),
retrieve = FALSE)
func1 <- function(x) {
object_size(x) # pryr function
}
step1 <- Step(func1, target_dims = c('sdate'),
output_dims = NULL,
use_libraries = 'pryr')
wf1 <- AddStep(data, step1)
res <- Compute(wf1, chunk = list(time = 2))