bias-correction function

Hi,

I have this code that I took from Calibration and cross validation · SantanderMetGroup/downscaleR Wiki · GitHub, and I tried to run it, it runs very good till the final line it gives me this error, I don't have any idea how could I fix it. I hope some one can help me with that.

Error in arr[, , , ind, ] <- grid[["Data"]] :
number of items to replace is not a multiple of replacement length.

The code is as following:

library(downscaleR)
library(climate4R.datasets)

# precipitation
data(VALUE_Iberia_pr)
y <- VALUE_Iberia_pr
# temperature
data(VALUE_Iberia_tas)
y.t <- VALUE_Iberia_tas

# precipitation
data(NCEP_Iberia_pr)
x <- gridArithmetics(NCEP_Iberia_pr, 86400, operator = "*")

# temperature
data(NCEP_Iberia_tas)
x.t <- NCEP_Iberia_tas

library(visualizeR)
library(sp)
spatialPlot(climatology(x), backdrop.theme = "coastline", 
            sp.layout = list(list(SpatialPoints(getCoordinates(y)), 
                                  pch = 17, col = "black", cex = 1.5)))

cal <- biasCorrection(y = y, x = x, newdata = x, precipitation = TRUE, method = "delta")

This seemed fine when I ran it. Not sure what the error is. Maybe package versions?

Plus the output list of various items.

Thank you Willliaml for the responds, the versions that I am using are:

version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 2.3
year 2023
month 03
day 15
svn rev 83980
language R
version.string R version 4.2.3 (2023-03-15 ucrt)
nickname Shortstop Beagle
packageVersion("downscaleR")
[1] ‘3.3.4’
packageVersion("climate4R.datasets")
[1] ‘0.0.1’

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.