SantanderMetGroup/visualizeR

reliabilitycategories error with data on the same grid

durutti opened this issue · 0 comments

Hi,
realiabilitycategories exits with the following error "Error in reliabilityCategories(hindcast = sys5m, obs = obs, labels = c("lower", :
obs and hindcast are not spatially consistent. Consider using function 'interpGrid' from package transformeR
although both hindcast and obs are on the same grid
c(getGrid(obs)$y, getGrid(sys5m)$y)
[1] 37.5 38.4 37.5 38.4

c(getGrid(obs)$x, getGrid(sys5m)$x)
[1] 23.1 24.2 23.1 24.2

!identical(getGrid(obs)$y, getGrid(sys5m)$y)
[1] TRUE
!identical(getGrid(obs)$x, getGrid(sys5m)$x)
[1] TRUE

the above two conditions should be FALSE

I think there is a rounding issue with interpGrid since the same issue occurs using the example datasets

data("tas.cfs")
data("tas.ncep")
require(transformeR)
#' #select spatio-temporal domain
tas.ncep2 <- subsetGrid(tas.ncep, lonLim = c(-10, 35), latLim = c(35,70), years = 1983:2009)
tas.cfs2 <- subsetGrid(tas.cfs, lonLim = c(-10, 35), latLim = c(35,70), years = 1983:2009)
#' #interpolate
tas.cfs2.int <- interpGrid(tas.cfs2, getGrid(tas.ncep2))

rel <- reliabilityCategories(hindcast = tas.cfs2.int, obs = tas.ncep2,
n.bins = 5, n.boot = 10)

Error in reliabilityCategories(hindcast = tas.cfs2.int, obs = tas.ncep2, :
obs and hindcast are not spatially consistent. Consider using function 'interpGrid' from package transformeR

thanx

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] climate4R.datasets_0.0.1 RColorBrewer_1.1-3 wesanderson_0.3.6 fields_13.3 viridis_0.6.2
[6] viridisLite_0.4.0 spam_2.8-0 rgeos_0.5-9 rgdal_1.5-32 gtools_3.9.2.1
[11] sp_1.5-0 loadeR_1.7.2 climate4R.UDG_0.2.3 loadeR.java_1.1.1 rJava_1.0-6
[16] easyVerification_0.4.4 SpecsVerification_0.5-3 visualizeR_1.6.1 downscaleR_3.3.3 transformeR_2.1.5