Hi @erifarov,
While doing some tests for CST_SaveExp() I found this bug in CST_Subset:
library(CSTools)
exp <- CSTools::lonlat_prec_st
exp_subset <- CST_Subset(exp, along = "ftime", indices = 1:3, drop = F)
exp_subset$dims
# dataset var member sdate ftime lat lon
# 1 1 6 3 3 4 4
exp_subset$coords$ftime
# [1] 1
# attr(,"indices")
# [1] TRUE
As you can see, $coords$ftime
should have values 1, 2, 3
but instead only had one. After investigating a little bit I found out that is is because at line 90: index <- indices[[dimension]]
index becomes unlisted due to the use of [[
and then .subset_with_attrs()
only retrieves the first value of the array.
I have fixed this by changing the line to index <- indices[dimension]
so that index remains a list with only the element dimension
. Please let me know if you have any questions or if you think there is any problem with this fix.
Thanks,
Victòria