Problem with dates in metadata
I am trying to load the following daily data, and I need the corresponding dates too. I am getting them from the metadata, but the last time steps are not correct.
The EC-Earth is initialised in November, and I want to load the data from January to December (that's why I'm loading time steps 62-426). The dates in the metadata are correct from January to October (it shows the dates correspond to 1961). However, the metadata for the last two months (November and December) is not correct (it shows that it correspond to 1960).
I think it may be related to the merging of dimensions (each file contains data for one forecast year from November to October), so I need to load the Jan-Oct from one file, and Nov-Dec from the following file. The merging of the data works fine, the issue is only in the dates.
library(startR)
data <- startR::Start(dat = '/esarchive/exp/ecearth/a3w5/original_files/cmorfiles/DCPP/EC-Earth-Consortium/EC-Earth3/dcppA-hindcast/$member$/day/$var$/gr/v20210910/$var$_day_EC-Earth3_dcppA-hindcast_s$sdate$-$member$_gr_$fyear$.nc',
var = 'tasmin',
lat = indices(1),
lon = indices(1),
sdate = paste0(1960:1961),
time = 62:426, ## Jan to Dec (initialised in Nov)
fyear = 'all',
member = 'r1i4p1f1',
fyear_depends = 'sdate',
time_across = 'fyear',
merge_across_dims = TRUE,
synonims = list(lat = c('lat','latitude'), lon = c('lon','longitude')),
return_vars = list(lat = NULL, lon = NULL, time = c('sdate')),
lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 1,
retrieve = TRUE)
dates <- attr(data,'Variables')$common[['time']]
dim(dates)
# sdate time
# 2 365
dates[1,]
# [1] "1961-01-01 12:00:00 UTC" "1961-01-02 12:00:00 UTC" "1961-01-03 12:00:00 UTC" "1961-01-04 12:00:00 UTC" "1961-01-05 12:00:00 UTC"
# [6] "1961-01-06 12:00:00 UTC" "1961-01-07 12:00:00 UTC" "1961-01-08 12:00:00 UTC" "1961-01-09 12:00:00 UTC" "1961-01-10 12:00:00 UTC"
# [11] "1961-01-11 12:00:00 UTC" "1961-01-12 12:00:00 UTC" "1961-01-13 12:00:00 UTC" "1961-01-14 12:00:00 UTC" "1961-01-15 12:00:00 UTC"
# ...
# [351] "1960-12-17 12:00:00 UTC" "1960-12-18 12:00:00 UTC" "1960-12-19 12:00:00 UTC" "1960-12-20 12:00:00 UTC" "1960-12-21 12:00:00 UTC"
# [356] "1960-12-22 12:00:00 UTC" "1960-12-23 12:00:00 UTC" "1960-12-24 12:00:00 UTC" "1960-12-25 12:00:00 UTC" "1960-12-26 12:00:00 UTC"
# [361] "1960-12-27 12:00:00 UTC" "1960-12-28 12:00:00 UTC" "1960-12-29 12:00:00 UTC" "1960-12-30 12:00:00 UTC" "1960-12-31 12:00:00 UTC"
Could you please have a look at it? It is a bit messy, so please let me know if you need more information or you prefer to discuss this in a meeting.
Thanks a lot in advance,
Carlos