Wrong data lonlat_prec
I found the data in CSTools lonlat_prec
is not correct, with one ftime shift. According to the document https://earth.bsc.es/gitlab/external/cstools/-/blob/master/man/lonlat_prec.Rd the data is
This sample data set contains a small cutout of gridded seasonal precipitation forecast data from the Copernicus Climate Change ECMWF-System 5 forecast system, to be used to demonstrate downscaling. Specifically, for the 'pr' (precipitation) variable, for the first 6 forecast ensemble members, daily values, for all 31 days in March following the forecast starting dates in November of years 2010 to 2012, for a small 4x4 pixel cutout in a region in the North-Western Italian Alps (44N-47N, 6E-9E). The data resolution is 1 degree.
I use the CST_Load() call in the document to load the data (the call has several mistakes too; see the correct code below) and compare to lonlat_prec. You can see lonlat_prec
is 1 time step ahead of data_load
(i.e., lonlat_prec
starts on 2nd March). The $Dates
is correct though. I also use Start() to load the data and the result is consistent with data_load
.
infile <- list(path = '/esarchive/exp/ecmwf/system5c3s/daily_mean/$VAR_NAME$_s0-24h/$VAR_NAME$_$START_DATE$.nc')
data_load <- CST_Load('prlr', exp = list(infile), obs = NULL,
sdates = c('20101101', '20111101', '20121101'),
leadtimemin = 121, leadtimemax = 151,
latmin = 44, latmax = 47,
lonmin = 6, lonmax = 9,
nmember = 6,
storefreq = "daily", sampleperiod = 1,
output = "lonlat"
)
lonlat_prec <- CSTools::lonlat_prec
dim(data_load$data)
dataset member sdate ftime lat lon
1 6 3 31 4 4
dim(lonlat_prec$data)
dataset member sdate ftime lat lon
1 6 3 31 4 4
data_load$data[1, 1, 1, , 1, 1]
[1] 1.2009e-08 2.8963e-08 1.0596e-08 3.2496e-08 4.2386e-08 4.9450e-09
[7] 6.0046e-08 9.8900e-09 0.0000e+00 0.0000e+00 9.1835e-08 1.6248e-07
[13] 1.4129e-09 3.4615e-08 2.9670e-08 1.7661e-08 1.6884e-07 2.3453e-07
[19] 1.6036e-07 1.5047e-07 7.4175e-08 1.0384e-07 2.6844e-08 3.1789e-08
[25] 1.3210e-07 8.6890e-08 8.9716e-08 1.7943e-07 3.4615e-08 1.9780e-08
[31] 0.0000e+00
lonlat_prec$data[1, 1, 1, , 1, 1]
[1] 2.8963e-08 1.0596e-08 3.2496e-08 4.2386e-08 4.9450e-09 6.0046e-08
[7] 9.8900e-09 0.0000e+00 0.0000e+00 9.1835e-08 1.6248e-07 1.4129e-09
[13] 3.4615e-08 2.9670e-08 1.7661e-08 1.6884e-07 2.3453e-07 1.6036e-07
[19] 1.5047e-07 7.4175e-08 1.0384e-07 2.6844e-08 3.1789e-08 1.3210e-07
[25] 8.6890e-08 8.9716e-08 1.7943e-07 3.4615e-08 1.9780e-08 0.0000e+00
[31] 0.0000e+00
str(lonlat_prec$Dates$start)
POSIXct[1:93], format: "2011-03-01 00:00:00" "2011-03-02 00:00:00" "2011-03-03 00:00:00" ...
str(data_load$Dates$start)
POSIXct[1:93], format: "2011-03-01" "2011-03-02" "2011-03-03" "2011-03-04" "2011-03-05" ...
This data is used in RainFARM_vignette.Rmd. It is not a big impact on the use case since it is just one time step shift (the leap year already has this impact), but the data is wrong still. I can fix the document and regenerate the data if you think it's worth doing (and maybe help me tag the vignette author if he is still active on CSTools. Thanks!)
Cheers,
An-Chi