StartR sometimes returns different latitudes for different variables
Hi @vagudets,
I'm opening this issue to let you know that I found a bug in Start
: sometimes it returns a different number of latitudes for different variables. It only happens depending on what latitudes you ask for. For instance, the code below shows three cases (asking for lat_min = -22, -21.7 and -21.3). For the first two cases, both tasmin and prlr data have the same dimensions. However, for the third case, tasmin has one more latitude than prlr.
library(startR)
## Case 1
lon_min <- 28
lon_max <- 40
lat_max <- -5
lat_min <- -22
tasmin1 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f24h/$var$_$year$$month$.nc'),
var = 'tasmin', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
pr1 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f1h/$var$_$year$$month$.nc'),
var = 'prlr', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
"
> print(dim(tasmin1))
dat var lon lat year month
1 1 121 171 3 1
> print(dim(pr1))
dat var lon lat year month
1 1 121 171 3 1
"
## Case 2
lat_min <- -21.7
tasmin2 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f24h/$var$_$year$$month$.nc'),
var = 'tasmin', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
pr2 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f1h/$var$_$year$$month$.nc'),
var = 'prlr', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
"
> print(dim(tasmin2))
dat var lon lat year month
1 1 121 167 3 1
> print(dim(pr2))
dat var lon lat year month
1 1 121 167 3 1
"
## Case 3
lat_min <- -21.3
tasmin3 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f24h/$var$_$year$$month$.nc'),
var = 'tasmin', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
pr3 <- startR::Start(dat = paste0('/esarchive/recon/ecmwf/era5land/monthly_mean/$var$_f1h/$var$_$year$$month$.nc'),
var = 'prlr', lon = values(list(lon_min,lon_max)), lat = values(list(lat_min,lat_max)),
year = paste0(2003:2005), month = '01',
return_vars = list(lat = NULL, lon = NULL), lon_var = 'lon', lat_var = 'lat',
lat_reorder = Sort(decreasing = FALSE), lon_reorder = CircularSort(-180,180),
num_procs = 4, retrieve = TRUE)
"
> print(dim(tasmin3))
dat var lon lat year month
1 1 121 164 3 1
> print(dim(pr3))
dat var lon lat year month
1 1 121 163 3 1
"
I don't know what could be happening. For me it's not urgent because I have checks to ensure that different variables have the same coordinates, but I'm opening this issue to keep track of it.
Best regards,
Carlos @nperez
This is the session information (on Nord3v2):
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.4 (Ootpa)
Matrix products: default
BLAS/LAPACK: /.statelite/tmpfs/gpfs/projects/bsc32/software/suselinux/11/software/OpenBLAS/0.3.7-GCC-8.3.0/lib/libopenblas_sandybridgep-r0.3.7.so
locale:
[1] LC_CTYPE=C LC_NUMERIC=C
[3] LC_TIME=es_ES.UTF-8 LC_COLLATE=C
[5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] startR_2.4.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.13 multiApply_2.1.4 bigmemory.sri_0.1.3
[4] parallelly_1.31.0 maps_3.4.2 doParallel_1.0.17
[7] NbClust_3.0 foreach_1.5.2 pbapply_1.5-0
[10] bigmemory_4.5.36 plyr_1.8.9 globals_0.14.0
[13] tools_4.1.2 parallel_4.1.2 easyNCDF_0.1.2
[16] SpecsVerification_0.5-3 iterators_1.0.14 abind_1.4-5
[19] digest_0.6.34 mapproj_1.2.8 ClimProjDiags_0.3.3
[22] codetools_0.2-18 PCICt_0.5-4.1 ncdf4_1.22
[25] compiler_4.1.2 future_1.24.0 easyVerification_0.4.4
[28] s2dv_2.1.0 listenv_0.8.0