CST_RFSlope output to be set as numeric()
Hi @jhardenberg , @nperez
I noticed that when the output of CST_RFSlope is passed directly to CST_RainFARM (as in the following example), the CST_RainFARM function fails with the following error:
slo <- CST_RFSlope(data=ls$exp, time_dim=c("member","sdate", "ftime"))
fs <- CST_RainFARM(data=ls$exp,nf=down_fact, weights=w_clim, slope=slo, kmin=1, nens=nrealiz, verbose=TRUE, time_dim=c("member","sdate", "ftime"), drop_realization=TRUE)
Error in kx^(-(sx + 1)/4) : non-conformable arrays
The problem is the that the spectral slope is not a plain "numeric" object (as CST_RainFARM would expect) but it has dimensions:
dim(slo)
dataset
1
If you manually set the slope to "numeric" it works:
slo <- as.numeric(slo)
s <- CST_RainFARM(data=ls$exp,nf=down_fact, weights=w_clim, slope=slo, kmin=1, nens=nrealiz, verbose=TRUE, time_dim=c("member","sdate", "ftime"), drop_realization=TRUE)
Is there a reason to have a dimension associated to the slope? Otherwise we can think of setting the RFSlope output as numeric by default to improve the compatibility with CST_RainFARM
Cheers,
Silvia