Skip to content

Analogs function is halted if ncores set to NULL

This is more so a warning than an issue, but I thought it convenient to report:

Using Analogs.R without specifying ncores causes the function to display the following error message when executing line 402:

res.data <- Apply(list(obs_train_interpolated, exp_interpolated, obs_hres), 
                 target_dims = list(c("window", lat_dim, lon_dim), c(lat_dim, lon_dim), 
                 c("window", lat_dim, lon_dim)), 
                 fun = function(tr, te, ob) .analogs(train = tr, test = te, obs_hres = ob, k = nanalogs, 
                 fun_analog = fun_analog), ncores = ncores)$output1

Error in Apply(list(obs_train_interpolated, exp_interpolated, obs_hres),  : 
Output '' doesn't have consistent output length among chunks.
In addition: Warning messages:
...
4: In mclapply(argsList, FUN, mc.preschedule = preschedule, mc.set.seed = set.seed,  :
  scheduled cores 1, 2, 3, 4, 6, 9, 10, 12, 13, 14 did not deliver results, all values of the jobs will be affected
Execution halted

If ncores is rather set to a valid number, then the function runs as expected.

Edited by Javier Corvillo