Changes between Version 12 and Version 13 of udg/ecoms/RPackage/examples/continentalSelection
- Timestamp:
- Sep 2, 2014 5:22:00 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
udg/ecoms/RPackage/examples/continentalSelection
v12 v13 33 33 34 34 35 [[Image(image-20140 617-130616.png)]]35 [[Image(image-20140902-170632.png)]] 36 36 37 It is possible to load now the reference observations for the spatio-temporal domain selected, using the same values in the corresponding arguments: 37 38 We load now the reference observations for the spatio-temporal domain previously chosen: 39 38 40 39 41 {{{ 40 42 #!text/R 41 43 > ex2.obs <- loadECOMS(dataset = "WFDEI", var = "tasmin", lonLim = c(-15,35), latLim = c(32, 75), season = c(12,1,2), years = 2001:2010) 42 [2014-06-17 16:28:13] Defining homogeneization parameters for variable "tasmin" 43 [2014-06-17 16:28:13] Defining geo-location parameters 44 [2014-06-17 16:28:13] Defining time selection parameters 45 [2014-06-17 16:28:32] Done 44 [2014-09-02 17:07:43] Defining homogeneization parameters for variable "tasmin" 45 [2014-09-02 17:07:44] Defining geo-location parameters 46 [2014-09-02 17:07:44] Defining time selection parameters 47 [2014-09-02 17:07:44] Retrieving data subset ... 48 [2014-09-02 17:07:58] Done 46 49 > print(object.size(ex2.obs), units = "Mb") 47 50 60.6 Mb … … 52 55 {{{ 53 56 #!text/R 54 > observed <- apply(ex2.obs$Data, FUN = mean, MARGIN = c(1,2)) 55 > x.obs <- ex2.obs$xyCoords$x 56 > y.obs <- ex2.obs$xyCoords$y 57 > image.plot(x.obs, y.obs, observed, asp = 1, xlab = "", ylab = "", main = "Mean minimum surface temp observed") 58 > world(add=TRUE) 57 > plotMeanField(ex2.obs) 59 58 }}} 60 59 61 [[Image(image-20140 617-163609.png)]]60 [[Image(image-20140902-171138.png)]] 62 61 63 Note that WFDEI provides data for land areas only, and its spatial resolution is much higher that CFS (1º vs 0.5º). In order to compare both datasets, it is first necessary to put them in the same grid (i.e., to interpolate). We use the bilinear interpolation algorithm of package `fields` to this aim, included in the function `interp.surface.grid`:62 Note that WFDEI provides data for land areas only, and its spatial resolution is finer than CFS (1º vs 0.5º). In order to compare both datasets, it is first necessary to put them in the same grid (i.e., to interpolate). We use bilinear interpolation to this aim, using the `downscaleR` function `interpGridData` in combination with the `getGrid` method, useful to recover the parameters defining the grid of a dataset to pass them to the interpolator: 64 63 65 64 {{{ 66 65 #!text/R 67 > obs.regridded <- interp.surface.grid(obj = list(x = x.obs, y = y.obs, z = observed), grid.list = list(x = x, y = y)) 68 > par(mfrow = c(1,2)) 69 > image.plot(member1 - obs.regridded$z, asp = 1, main = "Bias Member 1") 70 > image.plot(member2 - obs.regridded$z, asp = 1, main = "Bias Member 2") 66 > obs.regridded <- interpGridData(gridData = ex2.obs, new.grid = getGrid(ex2), method = "bilinear") 67 > plotMeanField(obs.regridded) 71 68 }}} 72 73 [[Image(image-20140617-170438.png)]]74 69 75 70 … … 79 74 80 75 81 82