-
Notifications
You must be signed in to change notification settings - Fork 59
Working with a moving window (introducing seasonality)
By default, the whole train period as defined by the user is considered to calibrate the methods. It is also interesting to correct each day of the year (doy) independently by using a moving window centered on each doy to calibrate the correction. Therefore, instead of having one correction function for the whole period , there would be one correction for each doy. The user can specify the length (in days) of the moving window by means of the property CorrectionWindow.
Here, the same data as in the previous worked example is used (3.1. Simple application of the methods)
#observations: precipitation and mean temperature at the Igueldo station
# precipitation
data(VALUE_Igueldo_tp)
y <- VALUE_Igueldo_tp
# temperature
data(VALUE_Igueldo_tas)
y.t <- VALUE_Igueldo_tas
#reanalysis: NCEP reanalysis precipitation and mean temperature for
#the Iberian peninsula
# precipitation
data(NCEP_Iberia_tp)
x <- NCEP_Iberia_tp
# temperature
data(NCEP_Iberia_tas)
x.t <- NCEP_Iberia_tas
###Bias correction
#WITHOUT WINDOW:
#For precipitation
cal <- biasCorrection (y = y, x = x, newdata = x, precipitation = TRUE, method = "eqm")
#For temperature
cal.t <- biasCorrection (y = y.t, x = x.t, newdata = x.t, method = "eqm")
#WITH WINDOW:
#For precipitation
wcal <- biasCorrection (y = y, x = x, newdata = x, precipitation = TRUE, method = "eqm", window = c(30, 5))
#For temperature
wcal.t <- biasCorrection (y = y.t, x = x.t, newdata = x.t, method = "eqm", window = c(30, 5))
Once we have the calibrated simulation for the test period, we can validate the result against the observational reference. Here we show the time series for the first year of the tested period (1991-2000) of the original simulation (red), the calibrated simulation (blue) and the observation (black) and the Pearson correlation r (for temperature) or Spearman correlation rho (for precipitation) and the Root Mean Square Error (RMSE) as accuracy measures for the calibrated simulation. Plots of the quantiles for the tested period are also shown, to better analyze the effect of the applied method:
WITHOUT WINDOW:
quickDiagnostics(y, x, cal, type = "daily", loc = y$xyCoords[1,])
quickDiagnostics(y.t, x.t, cal.t, type = "daily", loc = y$xyCoords[1,])
WITH WINDOW:
quickDiagnostics(y, x, wcal, type = "daily", loc = y$xyCoords[1,])
quickDiagnostics(y.t, x.t, wcal.t, type = "daily", loc = y$xyCoords[1,])
#WITHOUT WINDOW:
#For precipitation
cal <- biasCorrection(y = y, x = x, newdata = x, precipitation = TRUE, method = "gqm")
#WITH WINDOW:
#For precipitation
wcal <- biasCorrection (y = y, x = x, newdata = x, precipitation = TRUE, method = "gqm", window = c(30, 1))
WITHOUT WINDOW:
quickDiagnostics(y, x, cal, type = "daily", loc = y$xyCoords[1,])
WITH WINDOW:
quickDiagnostics(y, x, wcal, type = "daily", loc = y$xyCoords[1,])
print(sessionInfo())
downscaleR - Santander MetGroup (Univ. Cantabria - CSIC)