Fix path in use case ex3_1_SubseasonalECVHindcast.md to resolve 'No data files found' error
Hi @vagudets ,
In the Weekly ECV Subseasonal Hindcast Verification use case, the data is retrieved by running the following code:
library(startR)
ecmwf_path <- paste0('/esarchive/exp/ecmwf/s2s-monthly_ensforhc/',
'weekly_mean/$var$_f24h/$sdate$/$var$_$syear$.nc')
forecast.year <- 2016
# Mondays
sdates.seq.mon <- format(seq(as.Date(paste(forecast.year, 01, 04, sep = '-')),
as.Date(paste(forecast.year, 12, 31, sep='-')),
by = 'weeks'), format = '%Y%m%d')
# Thursdays (Monday+3days)
sdates.seq.thu <- format(seq(as.Date(paste(forecast.year, 01, 04, sep = '-')) + 3,
as.Date(paste(forecast.year, 12, 31, sep = '-')),
by = 'weeks'), format = '%Y%m%d')
# Joint dates in order
sdates.seq <- c(sdates.seq.mon, sdates.seq.thu)
ind <- order(as.Date(sdates.seq, format = '%Y%m%d')) # dates in order
sdates.seq <- sdates.seq[ind]
# Leap years, remove 29th of February:
pos.bis <- which(sdates.seq == paste0(forecast.year,"0229"))
if(length(pos.bis) != 0) sdates.seq <- sdates.seq[-pos.bis]
exp <- Start(dat = ecmwf_path,
var = 'tas',
sdate = sdates.seq,
syear = 'all', # before hdate
time = 'all',
ensemble = "all",
latitude = indices(1:121),
longitude = indices(1:240),
syear_depends = 'sdate',
return_vars = list(latitude = NULL,
longitude = NULL,
time = c('sdate', 'syear')),
num_procs = 16,
retrieve = FALSE)
Which gives this error:
Error in Start(dat = ecmwf_path, var = "tas", sdate = sdates.seq, syear = "all", :
No data files found for any of the specified datasets.
This is because the directory tas_f24h
does not exist in the defined path /esarchive/exp/ecmwf/s2s-monthly_ensforhc/weekly_mean/$var$_f24h/$sdate$/$var$_$syear$.nc
. The only directory that exists for the tas
variable is tas_f6h
, so a solution would be to change the initial path to:
ecmwf_path <- paste0('/esarchive/exp/ecmwf/s2s-monthly_ensforhc/',
'weekly_mean/$var$_f6h/$sdate$/$var$_$syear$.nc')
With this change, Start()
was able to successfully discover the data dimensions, as expected.
(I am using R/4.1.2 in RStudio Server connected to a WS)
Thanks,
Ariadna