CST_Analogs: Subset() returns errors
Hi @erifarov
(1) There is a bug in CST_Analogs.R. At line855 (and the similar parts in other if conditions), which(names(dim(obslocal)) == 'time')
should be which(names(dim(obslocal$data)) == 'time')
since obslocal
is a list. It didn't return error with the old Subset(), but now it shows an error
Error in Subset(obslocal$data, along = which(names(dim(obslocal)) == "time"), : Parameter 'indices' should be a list.
Note that the error message is not precise so I need to improve it, but it's not the main concern in this issue. The problem can be reproduced by example 8 in Analogs().
(2) Aside from the "new" error message, this Subset() part didn't work with the previous Subset(). Because along
is empty, Subset() returned the same array without subsetting it. So the output has dimensions nAnalogs
like input time
. It may be a mistake.
(3) Another problem is the documentation of @'return
. Both CST_Analogs() and Analogs() don't explain well the expected outputs.
(4) Related issue: #98 (closed)
Please let me know if you need my help on this issue. There is no deadline but it's preferable to solve this issue and have a new release on CRAN soon, so we can have the ClimProjDiags release.
Cheers,
An-Chi
Ps., to use new Subset(), you can source it from gitlab. But since it is used internally in Analogs() and related functions, you need to source these functions (i.e., not use CSTools::Analogs) so they know to use the local Subset() version.