Changes between Version 5 and Version 6 of udg/ecoms/RPackage/examples/bias


Ignore:
Timestamp:
May 15, 2015 2:49:43 PM (7 years ago)
Author:
juaco
Comment:

--

Legend:

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

    v5 v6  
    11= Example 3. Calculating the bias of an ensemble forecast
    22
    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].
     3In 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.
    54
    6 We first load the reference observations for the spatio-temporal domain previously chosen:
     5First 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
    77
    88{{{
    99#!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
     10ex3.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")
    1221}}}
     22
     23Some information messages will appear on-screen indicating the steps:
     24
     25{{{
     26[2015-05-15 14:18:08] Defining homogeneization parameters for variable "tasmin"
     27[2015-05-15 14:18:09] Defining geo-location parameters
     28[2015-05-15 14:18:09] Defining initialization time parameters
     29NOTE: Daily aggregation will be computed from 6-hourly data
     30NOTE: Daily data will be monthly aggregated
     31[2015-05-15 14:18:12] Retrieving data subset ...
     32[2015-05-15 14:24:31] Done
     33}}}
     34
     35
     36Note the difference in size of the daily-aggregated 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 monthly-aggregated data size (1.2 Mb):
     37
     38{{{#!text/R
     39print(object.size(ex3.cfs), units = "Mb")
     40}}}
     41
     42We the load the reference observations (WFDEI dataset) for the spatio-temporal 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
     45ex3.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[2015-05-15 14:31:16] Defining homogeneization parameters for variable "tasmin"
     55[2015-05-15 14:31:16] Defining geo-location parameters
     56[2015-05-15 14:31:16] Defining time selection parameters
     57NOTE: Daily data will be monthly aggregated
     58[2015-05-15 14:31:17] Retrieving data subset ...
     59[2015-05-15 14:31:39] Done
     60}}}
     61
     62
    1363
    1464This is the map of the observed mean minimum surface temperature observed for DJF 2001-2010:
     
    1666{{{
    1767#!text/R
    18 plotMeanField(ex2.obs)
     68plotMeanField(ex3.obs)
    1969}}}
    20 
    21 
    22 [[Image(image-20140902-182518.png)]]
     70[[Image(image-20150515-143320.png)]]
    2371
    2472Note 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:
     
    2674{{{
    2775#!text/R
    28 obs.regridded <- interpGridData(gridData = ex2.obs, new.grid = getGrid(ex2), method = "bilinear")
     76obs.regridded <- interpGridData(gridData = ex2.obs,
     77                                new.grid = getGrid(ex2),
     78                                method = "bilinear")
    2979}}}
     80
    3081
    3182Note 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.
    3283
    3384{{{
     85[2015-05-15 14:34:58] Performing bilinear interpolation... may take a while
     86[2015-05-15 14:34:58] Done
    3487Warning messages:
    35 1: In interpGridData(gridData = ex2.obs, new.grid = getGrid(ex2), method = "bilinear") :
     881: In interpGridData(gridData = ex3.obs, new.grid = getGrid(ex3.cfs), :
    3689  The new longitudes are outside the data extent
    37 2: In interpGridData(gridData = ex2.obs, new.grid = getGrid(ex2), method = "bilinear") :
     902: In interpGridData(gridData = ex3.obs, new.grid = getGrid(ex3.cfs), :
    3891  The new latitudes are outside the data extent
    3992}}}
     
    4699
    47100
    48 [[Image(image-20140902-182614.png)]]
     101[[Image(image-20150515-143628.png)]]
    49102
    50103
    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:
     104After 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:
    52105
    53106{{{
     
    62115# Now we compute the difference agains each of the multimember spatial means:
    63116require(fields)
    64 n.members <- dim(ex2$Data)[1]
     117n.members <- dim(ex3.cfs$Data)[1]
    65118par(mfrow = c(1,2))
    66119for (i in 1:n.members) {
     
    74127}}}
    75128
    76 [[Image(image-20140902-182715.png)]]
    77129
     130[[Image(image-20150515-144801.png)]]
     131