as.s2dv_cube(): lat and lon attributes of startR_array
Hi @nperez
I found an issue of as.s2dv_cube() when the object is "startR_array". At [line 122-123]
(https://earth.bsc.es/gitlab/external/cstools/-/blob/master/R/as.s2dv_cube.R#L122-123), the longitude and latitude have to be under $dat1. If they're under $common, the output doesn't have $lon and $lat. And the next line, vars
should be the variable (e.g., "tas") but it becomes "lat" or "lon" if they're under $common.
result$lon <- attributes(object)$Variables$dat1$longitude
result$lat <- attributes(object)$Variables$dat1$latitude
vars <- which(names(attributes(object)$Variables$common) != 'time')
Do you think it's worth improving it? I found this problem in auto-s2s decadal loading script, but I can also modify the script to avoid this bug.
Best,
An-Chi