Start(): longitude selecting is wrong when choosing the whole region and using CircularSort()
The new fix in v1.0.0 about longitude/latitude reordering has problems when the selected region is global.
For example, assigning lon.min <- 0
and lon.max <- 360
and using longitude_reorder
(no matter is (0, 360) or (-180, 180)), the returned longitude length is only 1. If without longitude_reorder
, it is correct.
latitude is also selected globally, and lat.min
lat.max
also exceed (-90, 90), but there is no problem with latitude. The bug should lie in CircularSort part.
library(startR)
repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc"
var <- 'tas'
lon.min <- 0
lon.max <- 360
lat.min <- -90
lat.max <- 90
data <- Start(dat = repos,
var = var,
sdate = c('20170101', '20170401'),
ensemble = indices(1:5),
time = indices(1:3),
latitude = values(list(lat.min, lat.max)),
latitude_reorder = Sort(decreasing = T),
longitude = values(list(lon.min, lon.max)),
longitude_reorder = CircularSort(0, 360),
return_vars = list(time = 'sdate',
longitude = NULL,
latitude = NULL),
retrieve = FALSE
)
* Detected dimension sizes:
* dat: 1
* var: 1
* sdate: 2
* ensemble: 5
* time: 3
* latitude: 640
* longitude: 1