SantanderMetGroup / downscaleR

An R package for climate data bias correction and downscaling (part of the climate4R bundle)
https://github.com/SantanderMetGroup/climate4R
GNU General Public License v3.0
104 stars 59 forks source link

Error: The dataset is not a field encompassing multiple grid-cells #76

Open tubabucak opened 4 years ago

tubabucak commented 4 years ago

Dear all,

I tried to reproduce the Prudence example with my own data and for beginning I started with only one station (and one grid). As far I understand from help documentation, it is also possible to work with single grid cell. After running downscaleCV it gives:

fold: 1 --> calculating... Error: The dataset is not a field encompassing multiple grid-cells

What could be the reason? I have also attached my station data. Any help is appreciated.

meteo.zip

library(climate4R.UDG) library(climate4R.value) climate4R.UDG::loginUDG(username = "XXXX", password = "XXXX")

vars <- c("psl","tas","ta@500","ta@700", "ta@850", "hus@500","hus@850","z@500")

lon <- c(31,33) names(lon)<- c(min,max) lat <- c(37,39)
names(lat)<- c(min,max)

grid.list5 <- lapply(vars, function(x) { loadGridData(dataset = "ECMWF_ERA-Interim-ESD", var = x, lonLim = lon, latLim = lat, years = 1979:2008) } )

x5 <- makeMultiGrid(grid.list5)

bey <- file.path("XXXXXXXXXX")

y1 <- loadStationData(dataset = bey, var = "precip", lonLim = 31.2, latLim = 37.5, years = 1979:2008)

y_bin <- binaryGrid(y1, condition = "GE", threshold = 1)

folds <- list(1979:1984, 1985:1990, 1991:1996, 1997:2002, 2003:2008)

spatial.pars.M1 <- list(which.combine = vars, v.exp = .95, rot = [FALSE)]

M1cv.bin <- downscaleCV(x = x5, y = y_bin, method = "GLM", family = binomial(link = "logit"), folds = folds, prepareData.args = list(global.vars = NULL, local.predictors = NULL, spatial.predictors = spatial.pars.M1, combined.only = TRUE))