Issue with loading latitude data points with Sort(decreasing = TRUE)
Hi @aho,
As mentioned I am getting an error when trying to load Berkeley Earth temperature data when reordering the latitudes by: Sort(decreasing = TRUE)
.
After looking further into this issue with Carlos we found that the problem is due to the class of the lat.min
and lat.max
parameters.
This is the StartR call that I am doing:
lon.min <- 0
lon.max <- 359.9
lat.min <- -90
lat.max <- 90
obs <- startR::Start(dat = '/esarchive/obs/berkeleyearth/berkeleyearth/monthly_mean/$var$$var_dir$/$var$_$file_date$.nc',
var = 'tas',
var_dir = "/",
var_dir_depends = 'var',
file_date = array(c('201401', '201501', '201601'), c(sday = 1, sweek = 1, syear = 3, time = 1)),
lon = values(list(lon.min, lon.max)),
lat = values(list(lat.min, lat.max)),
lat_reorder = Sort(decreasing = TRUE),
lon_reorder = CircularSort(0,360),
metadata_dims = 'var',
synonims = list(lon = c('lon', 'longitude'),
lat = c('lat', 'latitude')),
return_vars = list(lat = 'dat',
lon = 'dat',
time = 'file_date'),
split_multiselected_dims = TRUE,
retrieve = TRUE)
This is an example that I have created which works correctly, where the parameter lat.min
and lat.max
are numeric
.
However, the development I am doing is for the SUNSET suite, in which the parameters lat.min
and lat.max
are integer
.
lat.min <- as.integer(lat.min)
lat.max <- as.integer(lat.max)
When defining these parameters as integers, it results in an error:
* Exploring files... This will take a variable amount of time depending on the issued request and the performance of the file
* server...
Error in startR::Start(dat = "/esarchive/obs/berkeleyearth/berkeleyearth/monthly_mean/$var$$var_dir$/$var$_$file_date$.nc", :
The selectors of lat are out of range [-89.5, 89.5].`
The class of lon.min
and lon.max
have no impact.
Also, when I set lat_reorder = Sort()
the data loads correctly even when lat.min
and lat.max
are integers.
It seems like it could be an issue with the Sort function. Let me know if you need any more information.
Thanks,
Nadia