Issues with regridding in StartR
Hi @nperez ,
I'm loading data and trying to regrid the ERA5 dataset towards the SEAS5 dataset. Also, trying to convert the longitude to make it go from -180 to 180 by doing longitude_reorder = CircularSort(-180,180) with no success.
The jobs crash and give this error: Error in Apply(list(c(6.26667717718021e-10, 4.67152316829811e-10, 5.24122079070821e-10, : Found one or more margin dimensions with the same name and different length in some of the input objects in 'data'. Calls: do.call -> Apply Execution halted
When running the job, it prints the dimensions of exp and obs, and says that SEAS5 have 91 latitude points but ERA5 have 89 points. Is this a problem to do with the latitude bounds?
Please see attached my code below, and thanks a lot for your help!
Load startR
library(startR) library(s2dv) library(multiApply)
ncores <- 8
Define a region
lons.min <- 0 lons.max <- 359.9 lats.min <- -90 lats.max <- 90
Declaration of data sources
years <- 1981:2018
months <- 1:6
var = 'prlr'
retrieve <- FALSE
methods <- c('raw','bias','evmos','mse_min','crps_min','rpc-based')
grid <- '/esarchive/exp/ecmwf/system5c3s/monthly_mean/prlr_s0-24h/prlr_20000501.nc'
#grid <- 'r144x72'
exp <- startR::Start(dat = '/esarchive/exp/ecmwf/system5c3s/monthly_mean/var
s0-24h/var
$year$0101.nc',
var = var,
year = paste0(years),
ensemble = 'all',
# Select the length of the forecast
month = indices(months),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = F),
longitude = values(list(lons.min, lons.max)),
longitude_reorder = CircularSort(0,360),
## transformation
transform = CDORemapper,
transform_extra_cells = 2,
transform_params = list(grid = grid,
method = 'conservative',
crop = FALSE),
transform_vars = c('latitude', 'longitude'),
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('lon', 'longitude'),
month = c('month','time')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
month = c('year')),
retrieve = retrieve)
obs <- startR::Start(dat = '/esarchive/recon/ecmwf/era5/monthly_mean/var
s0-24h/var
year
$month$.nc',
var = var,
year = paste0(years),
month = indices(months),
latitude = values(list(lats.min, lats.max)),
latitude_reorder = Sort(decreasing = F),
longitude = values(list(lons.min, lons.max)),
longitude_reorder = CircularSort(0,360),
## transformation
transform = CDORemapper,
transform_extra_cells = 2,
transform_params = list(grid = grid,
method = 'conservative',
crop = FALSE),
transform_vars = c('latitude', 'longitude'),
synonims = list(latitude = c('lat', 'latitude'),
longitude = c('lon', 'longitude'),
month = c('month','time')),
return_vars = list(latitude = 'dat',
longitude = 'dat',
month = c('year')),
retrieve = retrieve)