-
Notifications
You must be signed in to change notification settings - Fork 59
Working with a moving window (introducing seasonality)
miturbide edited this page Jun 20, 2018
·
18 revisions
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 (or group of days) 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 calibration moving window and the target days (doy) by means of the argument window
.
# precipitation
data(VALUE_Iberia_pr)
y <- VALUE_Iberia_pr
data(NCEP_Iberia_pr)
x <- gridArithmetics(NCEP_Iberia_pr, 86400, operator = "*")
# NO window
cal <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
wet.threshold = 0.1)
# Window: calibration window of 30 days to correct each 15 day time step
cal.win <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
window = c(30, 15),
wet.threshold = 0.1)
# NO window
quickDiagnostics(y, x, cal, type = "daily", location = c(-2.0392, 43.3075))
# Window
quickDiagnostics(y, x, cal.win, type = "daily", location = c(-2.0392, 43.3075))
Compare the resulting time-series; NO-window (blue) vs Window (green):
# time series plotting for Igueldo station
Igueldo.cal <- subsetGrid(cal, station.id = "000234")
Igueldo.cal.win <- subsetGrid(cal.win, station.id = "000234")
Ig.coords <- getCoordinates(Igueldo.cal)
temporalPlot(Igueldo.cal, Igueldo.cal.win, cols = c("blue", "green"), x.axis = "index")
print(sessionInfo(package = c("transformeR", "downscaleR")))
## R version 3.4.3 (2017-11-30)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 14.04.5 LTS
##
## Matrix products: default
## BLAS: /usr/lib/libblas/libblas.so.3.0
## LAPACK: /usr/lib/lapack/liblapack.so.3.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=es_ES.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## character(0)
##
## other attached packages:
## [1] transformeR_1.3.3 downscaleR_3.0.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.15 compiler_3.4.3 highr_0.6
## [4] methods_3.4.3 bitops_1.0-6 iterators_1.0.8
## [7] utils_3.4.3 tools_3.4.3 grDevices_3.4.3
## [10] deepnet_0.2 digest_0.6.13 dotCall64_0.9-5.2
## [13] evd_2.3-2 gtable_0.2.0 evaluate_0.10.1
## [16] lattice_0.20-35 Matrix_1.2-7.1 foreach_1.4.3
## [19] yaml_2.1.16 parallel_3.4.3 spam_2.1-2
## [22] akima_0.6-2 gridExtra_2.2.1 stringr_1.2.0
## [25] knitr_1.18 raster_2.6-7 gridGraphics_0.2
## [28] graphics_3.4.3 datasets_3.4.3 stats_3.4.3
## [31] fields_9.6 maps_3.2.0 rprojroot_1.3-2
## [34] grid_3.4.3 glmnet_2.0-13 base_3.4.3
## [37] rmarkdown_1.8 sp_1.2-7 magrittr_1.5
## [40] backports_1.1.2 codetools_0.2-15 htmltools_0.3.6
## [43] MASS_7.3-44 abind_1.4-5 stringi_1.1.5
## [46] RCurl_1.95-4.10 RcppEigen_0.3.3.3.1
downscaleR - Santander MetGroup (Univ. Cantabria - CSIC)