Weird behaviour of Histo2Hindcast when calling non-existing time!
Hi @vagudets (I'm sorry Victoria, I'm actually not sure I should tag you for s2dv!),
I recently used s2dv::Histo2Hindcast
but calling for a year that was not in the dataset.
To be more precised, I load this file: /esarchive/scratch/Earth/acarreri/Obs_diags/recon/ecmwf/oras5/somxl030/somxl030_eq5S5N_recon_oras5_199001-201812.nc
using startR (I know, probably not the most efficient way...)
and then ask to modify the data so that I have sdate
and time
dimensions:
dates_to_use <- paste0(as.character(c(seq(1989,2014))), '0501')
start_obs <- 199001
date_init_obs <- paste0(sort(unique(gsub('-', '', sapply(as.character(start_obs), substr, 1, 7)))),'01')
nleadt <- 8 # dim(data_exp)['time']
# data_obs_call comes from the StartR load
data_obs_tmp <- s2dv::InsertDim(drop(data_obs_call), 1, 1, 'sdate')
data_obs <- s2dv::Histo2Hindcast(data_obs_tmp, date_init_obs, dates_to_use, nleadt, sdate_dim = "sdate", ftime_dim = "time")
# data_obs with dimensions: (sdate, time, lon) = (286,8,166)
So as you can notice, the start_obs
is after the first year I want (1989). But rather than giving me NaN for the first 'sdate' of the output data_obs
, I have values for the first 2 times of the first sdate
: data_obs[1,1,]
and data_obs[1,2,]
and then NaN values (for data_obs[1,3->8,]
) as I should have as well for the first two timesteps. The values of the first two timestep are actually the values of data_obs_tmp
(before modification of the dimensions by Histo2Hindcast
). Then, for the second sdate
, I have the correct values (and indeed they exist in the input dataset).
I hope I'm more or less clear but the point is that I should have NaN as well for these 2 first timestep of the sdate that doesn't exist in the input dataset.
PS: my StartR load:
file_obs <- '/esarchive/scratch/Earth/acarreri/Obs_diags/recon/ecmwf/oras5/somxl030/somxl030_eq5S5N_recon_oras5_199001-201812.nc'
vari_obs <- 'somxl030'
lon_min <- 120
lon_max <- 285
data_obs_call <- startR::Start(dat = file_obs,
var = vari_obs,
time = 'all',
lon = values(list(lon_min, lon_max)),
return_vars = list(lon=NULL),
num_procs = 1,
retrieve = T)