Changes between Version 13 and Version 14 of udg/ecoms/RPackage/examples/drift


Ignore:
Timestamp:
May 13, 2016 2:57:45 PM (6 years ago)
Author:
juaco
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • udg/ecoms/RPackage/examples/drift

    v13 v14  
    1515                 time = "DD",
    1616                 aggr.d = "mean")
     17
     18## [2016-05-13 14:28:46] Defining homogeneization parameters for variable "tas"
     19## [2016-05-13 14:28:46] Opening dataset...
     20## [2016-05-13 14:28:56] The dataset was successfuly opened
     21## [2016-05-13 14:28:56] Defining geo-location parameters
     22## NOTE: 'leadMonth = 0' selected
     23## [2016-05-13 14:28:57] Defining initialization time parameters
     24## NOTE: Daily aggregation will be computed from 6-hourly data
     25## [2016-05-13 14:28:58] Retrieving data subset ...
     26## [2016-05-13 14:29:04] Done
    1727}}}
    1828
    19 Messages on-screen inform about the loading process. Note that the selection of `leadMonth = 0` will give a NOTE:
     29Messages on-screen inform about the loading process. The selection of `leadMonth = 0` will give a NOTE.
    2030
    21 {{{
    22 [2015-05-15 14:50:46] Defining homogeneization parameters for variable "tas"
    23 NOTE: 'leadMonth = 0' selected
    24 [2015-05-15 14:50:46] Defining geo-location parameters
    25 [2015-05-15 14:50:46] Defining initialization time parameters
    26 NOTE: Daily aggregation will be computed from 6-hourly data
    27 [2015-05-15 14:50:49] Retrieving data subset ...
    28 [2015-05-15 14:50:56] Done
    29 }}}
    3031
    3132{{{#!text/R
    32 downscaleR::plotMeanGrid(ref)
     33library(downscaleR)
     34plotMeanGrid(ref)
    3335title(main = "Lead month 0 forecast of July 2001")
    34 # This is the spatial mean of the reference field
     36# This is the climatology of the reference field
    3537ref.field <- apply(ref$Data, MARGIN = c(3,2), FUN = mean, na.rm = TRUE)
    3638}}}
    3739
    38 [[Image(image-20140903-175339.png)]]
     40[[Image(image-20160513-145707.png)]]
    3941
    4042
    4143Next, we will load the forecast of the target variable recursively for lead month values from 1 to 6 (i.e.: the initializations from January to June). The different objects are arranged in a list:
    42 
    4344
    4445{{{#!text/R
     
    7576names(df) <- c("x","y",paste("LeadMonth_",1:6, sep = ""))
    7677str(df)
    77 'data.frame':   55 obs. of  8 variables:
    78  $ x          : num  -10.31 -9.38 -8.44 -7.5 -6.56 ...
    79  $ y          : num  36.4 36.4 36.4 36.4 36.4 ...
    80  $ LeadMonth_1: num  0.0596 0.1601 0.5955 0.9068 1.2601 ...
    81  $ LeadMonth_2: num  -0.1215 0.0509 0.3622 0.5444 0.6977 ...
    82  $ LeadMonth_3: num  -0.48 -0.359 -0.402 -0.693 -0.967 ...
    83  $ LeadMonth_4: num  0.22303 0.27295 0.23869 0.04764 -0.00855 ...
    84  $ LeadMonth_5: num  -1.212 -0.986 -0.682 -0.587 -0.584 ...
    85  $ LeadMonth_6: num  -1.314 -0.732 -0.32 -0.5 -0.98 ...
     78## 'data.frame':        55 obs. of  8 variables:
     79## $ x          : num  -10.31 -9.38 -8.44 -7.5 -6.56 ...
     80## $ y          : num  36.4 36.4 36.4 36.4 36.4 ...
     81## $ LeadMonth_1: num  0.0596 0.1601 0.5955 0.9068 1.2601 ...
     82## $ LeadMonth_2: num  -0.1215 0.0509 0.3622 0.5444 0.6977 ...
     83## $ LeadMonth_3: num  -0.48 -0.359 -0.402 -0.693 -0.967 ...
     84## $ LeadMonth_4: num  0.22303 0.27295 0.23869 0.04764 -0.00855 ...
     85## $ LeadMonth_5: num  -1.212 -0.986 -0.682 -0.587 -0.584 ...
     86## $ LeadMonth_6: num  -1.314 -0.732 -0.32 -0.5 -0.98 ...
    8687coordinates(df) <- c(1,2)
    8788gridded(df) <- TRUE
    8889class(df)
     90## [1] "SpatialPixelsDataFrame"
     91## attr(,"package")
     92## [1] "sp"
    8993}}}
    9094
    91 Which returns the new spatial object class:
    92 
    93 {{{
    94 [1] "SpatialPixelsDataFrame"
    95 attr(,"package")
    96 [1] "sp"
    97 }}}
    9895
    9996In the next lines we use apply the `spplot` method of package `sp`, generating a lattice-type map. In first place, we will also load a `SpatialLines` dataset remotely stored at Santander Met Group server, in order to represent the coastline in the lattice map generated as a geographical reference:
     
    108105       scales = list(draw = TRUE),
    109106       sp.layout = list(l1))
     107
    110108}}}
    111109
    112 [[Image(image-20150130-185813.png)]]
     110[[Image(image-20160513-145433.png)]]
    113111
    114 The results show how a increasing lead month leads to a negative bias of the forecast, demonstrating that the mean state of a variable of a forecast is not stationary along the runtime dimension.
     112The results show how a varying bias of the forecast depending on the lead time, i.e., the model drift.
    115113
    116114Finally, we display the spatial mean of the anomalies w.r.t. the reference for each lead month considered using a barplot:
     
    122120}}}
    123121
    124 [[Image(image-20140903-181520.png)]]
     122[[Image(image-20160513-145600.png)]]
    125123