Ano gives wrong results when member=ltime
Hi @nperez,
I think there is a bug in Ano in s2d when the dimension length of member equals the length of lead time. I'm running on power9 but I also get the same results on my workstation
Here is a little script that should work. It calculates twice the exact same thing with the difference that in the first example nmemb=nltime=3 and in the second example nmemb=3 and nltime=5.
.libPaths(new = '/gpfs/projects/bsc32/share/R_libs/3.5')
library(s2dverification)
t <- array(rnorm(76),c(1,3,4,3,2,2)) # define array as clim expects: nexp,nmemb,nsdates,nltime,nlon,nlat
c3 <- Clim(t,t,memb=TRUE)$clim_exp # Clim for each member
dim(c3)
dim(Clim(t,t,memb=FALSE)$clim_exp) # dimensions if memb=FALSE
c1 <- InsertDim(c3[,1,,,],1,1) # clim as if memb=FALSE but identical to member 1
dim(c1)
identical(c1[,,,],c3[,1,,,]) # results in TRUE
a3 <- Ano(t,c3) # ano for each member individually
a1 <- Ano(t,c1) # ano for first member
identical(a1[,1,,,,],a3[,1,,,,]) ## RESULTS IN FALSE
T <- array(rnorm(240),c(1,3,4,5,2,2)) # define array as clim expects: nexp,nmemb,nsdates,nltime,nlon,nlat
C3 <- Clim(T,T,memb=TRUE)$clim_exp # Clim for each member
dim(C3)
dim(Clim(T,T,memb=FALSE)$clim_exp) # dimensions if memb=FALSE
C1 <- InsertDim(C3[,1,,,],1,1) # clim as if memb=FALSE but identical to member 1
dim(C1)
identical(C1[,,,],C3[,1,,,]) # results in TRUE
A3 <- Ano(T,C3) # ano for each member individually
A1 <- Ano(T,C1) # ano for first member
identical(A1[,1,,,,],A3[,1,,,,]) ## RESULTS IN TRUE
This could be related to #181 (closed)
Thanks a lot