Newer
Older
# This code shows that the number of members could depend on the start date
# and the order of start dates requested.
# See FAQ 10 [The members depends on the start date](https://earth.bsc.es/gitlab/es/startR/-/blob/master/inst/doc/faq.md#10-the-number-of-members-depends-on-the-start-date)
path = '/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc'))
sdates_exp <- c('19991101', '19990901')
data_Nov_Sep <- Start(dat = path_list,
var = 'psl',
member = 'all',
sdate = sdates_exp,
time = indices(1),
latitude = values(list(0, 20)),
longitude = values(list(0, 5)),
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('lon', 'longitude'),
member = c('ensemble', 'realization')),
retrieve = TRUE)
# 51 members
dim(data_Nov_Sep)
# dat var member sdate time latitude longitude
apply(data_Nov_Sep, 4, function(x){sum(is.na(x))})
# 26 missing values for the second start date
sdates_exp <- c('19990901', '19991101')
data_Sep_Nov <- Start(dat = path_list,
var = 'psl',
member = 'all',
sdate = sdates_exp,
time = indices(1),
latitude = values(list(0, 20)),
longitude = values(list(0, 5)),
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('lon', 'longitude'),
member = c('ensemble', 'realization')),
retrieve = TRUE)
# 25 members available
dim(data_Sep_Nov)
# dat var member sdate time latitude longitude
# Any missing value:
apply(data_Sep_Nov, 4, function(x){sum(is.na(x))})
# Use 'largest_dims_length = TRUE' to explore the largest dimension length among all the files.
sdates_exp <- c('19990901', '19991101')
data_Sep_Nov2 <- Start(dat = path_list,
var = 'psl',
member = 'all',
sdate = sdates_exp,
time = indices(1),
latitude = values(list(0, 20)),
latitude_reorder=Sort(),
longitude = values(list(0, 5)),
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('lon', 'longitude'),
member = c('ensemble', 'realization')),
largest_dims_length = T,
retrieve = TRUE)
dim(data_Sep_Nov2)
# dat var member sdate time latitude longitude
# 1 1 51 2 1 71 19
identical(as.vector(data_Sep_Nov2[1, 1, , 2, 1, , ]), as.vector(data_Nov_Sep[1, 1, , 1, 1, , ]))
#[1] TRUE
identical(as.vector(data_Sep_Nov2[1, 1, , 1, 1, , ]), as.vector(data_Nov_Sep[1, 1, , 2, 1, , ]))
#[1] TRUE