Skip to content

Corr function to work with tos variable

Hi @aho (and @erifarov),

I am using Corr() function with several variables and it works smoothly. However, with tos it fails and it may be due to NAs over land. Output 'corr' doesn't have consistent output length among chunks.

I have a sample data under /esarchive/scracth/nperez

The code to reproduce the problem is

data <- readRDS("failingCorr.RDS")
res <- s2dv::Corr(data$exp, data$obs, dat_dim = NULL, 
                           time_dim = 'syear', 
                           method = 'pearson', 
                           memb_dim = 'ensemble',
                           memb = F,
                           conf = F,
                           pval = F,
                           sign = T,
                           alpha = 0.05) #Fails
res <- s2dv::Corr(data$exp, data$obs, dat_dim = NULL, 
                           time_dim = 'syear', 
                           method = 'pearson', 
                           memb_dim = 'ensemble',
                           memb = T,
                           conf = F,
                           pval = F,
                           sign = T,
                           alpha = 0.05) #Works

The result from 1 multiApply loop differs from the previous ones:

List of 2
 $ corr: num 0.226
 $ sign: logi [1, 1] FALSE
NULL
List of 2
 $ corr: logi [1, 1] NA
 $ sign: logi [1, 1] FALSE
NULL

So, for now, I have just converted the rescorr to a vector `rescorr <- as.vector(res$corr)` and the function works.

It may be worth it to have a deeper look, but for now I wanted to report the issue.

Cheers,

Núria

Edited by Nuria Pérez-Zanón