Hi @nperez
s2dverification has a function ArrayToNetCDF() for CDORemap(), but it is highly similar to easyNCDF::ArrayToNc, so I substituted ArrayToNetCDF() with easyNCDF::ArrayToNc. I checked the two functions, easyNCDF::ArrayToNc has a few improvement compared to ArrayToNetCDF(). I ran the following script and the result seems fine (though not exactly the same.)
The downside is that s2dv has one more dependency on easyNCDF. Please let me know your opinion, thanks!
library(startR)
data <- Start(dat = "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc",
var = 'tas',
sdate = '20170101',
ensemble = indices(1),
time = indices(1),
latitude ='all',
longitude = 'all',
return_vars = list(time = 'sdate', longitude = NULL, latitude = NULL),
retrieve = T)
lon <- as.vector(attr(data, 'Variables')$common$longitude)
lat <- as.vector(attr(data, 'Variables')$common$latitude)
source('~/s2dv/R/CDORemap.R') # use easyNCDF::ArraytoNc
res_new <- CDORemap(data, lon, lat, 'bil', TRUE)
res_old <- s2dverification::CDORemap(data, lon, lat, 'bil', TRUE) # 'con' has the same result
all.equal(res_new,res_old)
[1] "Component “data_array”: Mean relative difference: 2.582252e-08"
Cheers,
An-Chi