Time attribute in wrong format and wrong value when attribute name is not "time"
A bug in the new startR version (2.2.0-1) is shown in the following script. The "leadtimes" attribute has the correct dimension but the value is integer instead of time format. In addition, the values are not all correct.
Regarding the format, it is because startR only recognizes the variable name "time" or its synonims and turns the value into time format after reshaping. Need to find a way to detect different possible variable names. As for the wrong values, I need to check the code.
@vagudets @lpalma for now please use the previous startR version, or use file_dates
instead of dates
at line 107
var <- "rsds"
anlgs <- paste0("/esarchive/oper/VITIGEOSS","/output/cfsv2/weekly_mean/",
var,"/",var,"-vitigeoss-cat","_1999-2018_", "$file_date$.nc")
file_date_array <- array(dim = c(sweek = 9, sday = 3))
file_date_array[, 1] <- c(paste0('04', c('04', '07', '11', '14', '18', '21', '25', '28')), '0502')
file_date_array[, 2] <- c(file_date_array[2:9, 1], '0505')
file_date_array[, 3] <- c(file_date_array[2:9, 2], '0509')
hcst <- Start(dat = anlgs,
var = var,
latitude = 'all',
longitude='all',
member='all',
time='all',
syear='all',
file_date= file_date_array,
longitude_reorder = CircularSort(-180, 180),
latitude_reorder = Sort(),
longitude_var = "longitude",
latitude_var = "latitude",
retrieve = T,
return_vars = list(leadtimes = 'file_date'),
split_multiselected_dims = TRUE,
synonims = list(longitude = c('lon', 'longitude'),
latitude = c('lat', 'latitude'),
syear = c('sdate','syear'),
member = c('ensemble','member')))
time_attr <- attr(hcst, 'Variables')$common$leadtimes
dim(time_attr) #CORRECT
#sweek sday syear time
# 9 3 20 4
time_attr[1] #WRONG. should be time format and the value is not correct
[1] 0
Also a warning:
5: In if (names(array_var_dims) != names(var_dims)) { ... : the condition has length > 1 and only the first element will be used