Open catorpar opened 2 years ago
If you want to use biasCorrection, you must use aggr.d or aggr.m, this is a bug.
For me, the version that doesn't give the error when using locations is downscaleR-3.3.2. So you can install it locally until the bug is fixed
We have included a step in biasCorrection to ensure the correspondence of dates between observed and simulated data in the training period. However, this new implementation (in the transformeR package) was not adapted to single station data in its first version... it is now, in the development version of transformeR.
You can install this version as follows:
library(devtools) install_github("SantanderMetGroup/transformeR@devel")
Yes it works now !!! I think a minor change is needed in line 8 in setGridDates.asPOSIXlt if (length(strsplit(ref, "-")[[1]]) == 3) chnage to if (length(strsplit(as.character(ref), "-")[[1]]) == 3)
example
d<-as.POSIXlt(as.Date('2000-1-1')) s<-strsplit(d, "-") Error in strsplit(d, "-") : non-character argument
s<-strsplit(as.character(d), "-")
length(s[[1]])==3 [1] TRUE
Thank you very much for your efforts
Thanks durutti, good point. Line 8 has been updated in the devel branch following your suggestion. Now the function works with date class objects too.
Hello,
I'm trying to conduct a bias correction but I'm getting the following error:
Error in grid$Data[i, , ind.NN.y[k, l], ind.NN.x[k, l]] : incorrect number of dimensions
I used loadeR to upload the observed and GCM datasets, then defined the x, y and newdata variables and run the biasCorrection function as indicated by example, and that's when the error occurs.
`obsdata <- "~/Future Climate Analysis/Observed" Obs <- loadStationData(dataset = obsdata, var="precip", stationID = NULL) gcmdata <- "~Future Climate Analysis/GCM" GCM <- loadStationData(dataset = gcmdata, var="precip", stationID = NULL) ObsTrain <- subsetGrid(Obs,years = 2006:2010, station.id = "26130570") GCMTrain <- subsetGrid(GCM,years = 2006:2010, station.id = "cam_44") GCMTest <- subsetGrid(GCM,years= 2011:2015, station.id = "cam_44") x <- ObsTrain y <- GCMTrain newdata <- GCMTest
biasCorrection(x, y, newdata = newdata, precipitation = TRUE, method = "eqm", window=NULL, wet.threshold = 0.1, join.members = TRUE) ` Attached you can find the files I'm using to complete the bias correction.
GCM.zip Observed.zip
Any help will be greatly appreciate it.
Camilo