Changes between Version 5 and Version 6 of udg/ecoms/RPackage/examples/bias
 Timestamp:
 May 15, 2015 2:49:43 PM (7 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

udg/ecoms/RPackage/examples/bias
v5 v6 1 1 = Example 3. Calculating the bias of an ensemble forecast 2 2 3 In this example we will calculate the bias of the multimember forecast loaded 4 [http://meteo.unican.es/trac/wiki/EcomsUdg/RPackage/Examples/continentalSelection in the previous example]. 3 In this example we will calculate the bias of the multimember forecast used in the [https://meteo.unican.es/trac/wiki/udg/ecoms/RPackage/examples/continentalSelection in the previous example], but this time considering the monthly aggregated data, which dramatically reduces the size of the data loaded. 5 4 6 We first load the reference observations for the spatiotemporal domain previously chosen: 5 First of all, we load the same data as in the previous example, but using a monthly aggregation. To this aim, first a daily aggregation is specified (`time = DD`, aggr.m = `min`), and then the aggregation function for the daily data is specified to obtain the monthly aggregation via the `aggr.m` argument: 6 7 7 8 8 {{{ 9 9 #!text/R 10 ex2.obs < loadECOMS(dataset = "WFDEI", var = "tasmin", lonLim = c(15,35), latLim = c(32, 75), season = c(12,1,2), years = 2001:2010) 11 print(object.size(ex2.obs), units = "Mb") # 60.6 Mb 10 ex3.cfs < loadECOMS(dataset = "CFSv2_seasonal", 11 var = "tasmin", 12 members = 1:2, 13 lonLim = c(15,35), 14 latLim = c(32, 75), 15 season = c(12,1,2), 16 years = 1991:2000, 17 leadMonth = 3, 18 time = "DD", 19 aggr.d = "min", 20 aggr.m = "mean") 12 21 }}} 22 23 Some information messages will appear onscreen indicating the steps: 24 25 {{{ 26 [20150515 14:18:08] Defining homogeneization parameters for variable "tasmin" 27 [20150515 14:18:09] Defining geolocation parameters 28 [20150515 14:18:09] Defining initialization time parameters 29 NOTE: Daily aggregation will be computed from 6hourly data 30 NOTE: Daily data will be monthly aggregated 31 [20150515 14:18:12] Retrieving data subset ... 32 [20150515 14:24:31] Done 33 }}} 34 35 36 Note the difference in size of the dailyaggregated data of the [https://meteo.unican.es/trac/wiki/udg/ecoms/RPackage/examples/continentalSelection in the previous example] (35.1 Mb) as compared to the new monthlyaggregated data size (1.2 Mb): 37 38 {{{#!text/R 39 print(object.size(ex3.cfs), units = "Mb") 40 }}} 41 42 We the load the reference observations (WFDEI dataset) for the spatiotemporal domain previously chosen, using the same monthly aggregation (note that in this case the [http://meteo.unican.es/trac/wiki/udg/ecoms/dataserver/listofvariables original data are daily], so there is no need to specify a daily aggregation): 43 44 {{{#!text/R 45 ex3.obs < loadECOMS(dataset = "WFDEI", 46 var = "tasmin", 47 lonLim = c(15,35), 48 latLim = c(32, 75), 49 season = c(12,1,2), 50 years = 1991:2000, 51 aggr.m = "mean") 52 }}} 53 {{{ 54 [20150515 14:31:16] Defining homogeneization parameters for variable "tasmin" 55 [20150515 14:31:16] Defining geolocation parameters 56 [20150515 14:31:16] Defining time selection parameters 57 NOTE: Daily data will be monthly aggregated 58 [20150515 14:31:17] Retrieving data subset ... 59 [20150515 14:31:39] Done 60 }}} 61 62 13 63 14 64 This is the map of the observed mean minimum surface temperature observed for DJF 20012010: … … 16 66 {{{ 17 67 #!text/R 18 plotMeanField(ex 2.obs)68 plotMeanField(ex3.obs) 19 69 }}} 20 21 22 [[Image(image20140902182518.png)]] 70 [[Image(image20150515143320.png)]] 23 71 24 72 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: … … 26 74 {{{ 27 75 #!text/R 28 obs.regridded < interpGridData(gridData = ex2.obs, new.grid = getGrid(ex2), method = "bilinear") 76 obs.regridded < interpGridData(gridData = ex2.obs, 77 new.grid = getGrid(ex2), 78 method = "bilinear") 29 79 }}} 80 30 81 31 82 Note the warnings reminding us that the extent of the input grid is wider than that from CFS. However, in this case we can safely ignore this warnings, since all the land areas we are interest in are within the CFS domain. 32 83 33 84 {{{ 85 [20150515 14:34:58] Performing bilinear interpolation... may take a while 86 [20150515 14:34:58] Done 34 87 Warning messages: 35 1: In interpGridData(gridData = ex 2.obs, new.grid = getGrid(ex2), method = "bilinear"):88 1: In interpGridData(gridData = ex3.obs, new.grid = getGrid(ex3.cfs), : 36 89 The new longitudes are outside the data extent 37 2: In interpGridData(gridData = ex 2.obs, new.grid = getGrid(ex2), method = "bilinear"):90 2: In interpGridData(gridData = ex3.obs, new.grid = getGrid(ex3.cfs), : 38 91 The new latitudes are outside the data extent 39 92 }}} … … 46 99 47 100 48 [[Image(image201 40902182614.png)]]101 [[Image(image20150515143628.png)]] 49 102 50 103 51 Now that both model data and observations are in the same grid, we can compute the bias. First, we calculate the mean of WFDEI, which is the reference against which to compute the biases:104 After regridding, both model data and observations are in the same grid. We can compute the bias. First, we calculate the mean of WFDEI, which is the reference against which to compute the biases: 52 105 53 106 {{{ … … 62 115 # Now we compute the difference agains each of the multimember spatial means: 63 116 require(fields) 64 n.members < dim(ex 2$Data)[1]117 n.members < dim(ex3.cfs$Data)[1] 65 118 par(mfrow = c(1,2)) 66 119 for (i in 1:n.members) { … … 74 127 }}} 75 128 76 [[Image(image20140902182715.png)]]77 129 130 [[Image(image20150515144801.png)]] 131