Start(): load point data given a series of latitudes and longitudes
I am loading point station data with Start():
lats <- c(51.30760,51.97100,52.10000,54.01486,55.00690,55.19500,51.94355,53.51917,46.95580,53.12750,50.92847,52.16630,53.40360,55.35277,55.11070,62.90566,67.36186)
lons <- c(4.519800,4.926000,-0.416700,6.587639,13.154200,7.158000,1.922200,10.102861,16.652200,0.436100,6.219629,14.122600,6.352800,-7.332018,36.597700,27.653497,26.637833)
data <- Start(
time = 'all',
ensemble = 'all',
sdate = format(ymd(paste0(1993:2016, sprintf('%02d',12), "01")), "%Y%m%d"),
latitude = values(lats),
longitude = values(lons),
var = 'sfcWind',
dat = '/esarchive/exp/ecmwf/system5c3s/monthly_mean/$var$_f6h/$var$_$sdate$.nc',
pattern_dims = 'dat',
synonims = list(latitude=c('lat', 'latitude'),longitude=c('lon', 'longitude')),
return_vars = list(time = NULL,
latitude = 'dat',
longitude = 'dat'),
retrieve = TRUE)
However, Start() rounds the longitudes and latitudes to the unit and then loads these latitudes and longitudes. If some of the latitudes or longitudes are repeated, it only loads them once. Consequently, the lengths of the original latitudes or longitudes (objects lats
and lons
) differ from the lats lons provided by Start(). This is somehow undesirable, especially in those cases when I need to re-build R objects from the Start() output object (the pairs of lats/lons are then mixed so I need to find exactly which index corresponds to each latitude/longitude...).
Ideally, I would like Start() to provide vectors of longitudes and latitudes with the same length as the original ones. I attach a full use case script where I show this issue.
I'm getting by loading the each point separately, so no need to hurry.
Thank you in advance.