Changes between Version 5 and Version 6 of udg/ecoms/RPackage/biascorrection


Ignore:
Timestamp:
Mar 30, 2015 11:15:24 AM (7 years ago)
Author:
gutierjm
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • udg/ecoms/RPackage/biascorrection

    v5 v6  
    1 = Multi-variable bias correction of seasonal forecast =
     1= Bias correction of seasonal forecasting data =
    22
    3 Taking into account the users' needs, in the following example a calibration of all the variables available, and needed by the users, in the ECOMS-UDG data server.
     3The seasonal forecasting data obtained from the `ecomsUDG.Raccess` package can be easily bias corrected (and downscaled) using the  [https://github.com/SantanderMetGroup/downscaleR downscaleR package] (see a description of the [https://github.com/SantanderMetGroup/downscaleR/wiki/Bias-Correction-and-Model-Output-Statistics-(MOS) bias correction functions]). This package has been developed in the framework of the SPECS and EUPORIAS projects  for bias correction and downscaling of daily climate model outputs (with special focus in seasonal forecasting).
    44
     5The following panels show an illustrative use of `ECOMS-UDG` and `downscaleR` to obtain the bias corrected series of mean temperature for the period DJFMAM  (one-month lead time; i.e. with the initializations from November) over Europe. WFDEI is used as reference.
    56
    6 Since the [http://www.r-project.org/ R] language has been adopted for some key tasks in the EUPORIAS and SPECS projects (including the development of comprehensive validation and statistical-downscaling packages), the `ecomsUDG.Raccess` is envisaged as a user-friendly, R-based interface to the ECOMS User Data Gateway, enabling [http://meteo.unican.es/trac/wiki/udg/ecoms/RPackage/authentication authentication] and remote access to the different datasets (seasonal forecasting, observations, reanalysis) currently available. Moreover, `ecomsUDG.Raccess` implements data homogenization (a single vocabulary) and time filtering/aggregation functionality.
    7 
    8 The `ecomsUDG.Raccess` package relies on the `rJava` package as an interface to the powerful capabilities of the [http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp Unidata's netCDF Java library].
    9 
    10 
    11 
    12 {{{#!comment
    13   * [wiki:./Functions Defined Functions]
    14  }}}
    15 
    16 The following panels show an illustrative use of ECOMS-UDG to obtain the minimum DJF temperature DJF bias for System4 hindcast (one-month lead time) over Europe. WFDEI is used as reference.
     7Note that, in order to facilitate the use of the resulting bias corrected data in different impact applications, the resulting bias corrected data can be easily exported to netcdf format.
    178||= R code =||= Output =||
    189{{{#!td
     
    6556}}}
    6657
    67 # Creating a nc-file with the bias-corrected data:
    68 # The function grid2NetCDF builds a nc4-file using a downscaleR object, in this case the surface pressure bias corrected with the qq-map method. The resulting NetCDF is available in the link:
    69 # http://www.meteo.unican.es/work/datasets/psAdjust_System4_1_2_12_6_qqmap_WFDEI_2001_2010.nc4
     58The '''netcdf4 file''' resulting from this example can be downloaded here: http://www.meteo.unican.es/work/datasets/tas_qqmap_System4_WFDEI_2001_2010.nc4
    7059
     60In order to preserve the inter member variability of seasonal forecasts, the bias correction methods should be jointly calibrated using the different ensemble members (considering the CDF of the joined series for the correction). This is the procedure followed by the `biasCorrection` function when using the option '''`multi.member=TRUE`'''. Note that `multi.member=FALSE` will independently calibrate each member and, therefore, inter-member variability will be destroyed.
    7161
     62Moreover, in order to take into account the model drift (the change of the model bias as a function of the lead time), the bias correction methods are applied considering the lead month of the predictions as an extra dimension. This is implemented in the `biasCorrection` function by considering a moving time window (one month in the above example: '''`window = 30`''', in days). The default recommended value is one-month (window=30), although some tests are being conducted in order to determine the optimum window to correct the available seasonal forecasts (further information will follow).
    7263
    73 First of all, the quantile-quantile mapping and the WFDEI data set are considered to calibrate the seven months corresponding to the initialization of November for the period 2001-2010 in an European domain. For the sake of the simplicity, only one member has been considered in this example.
     64= Multi-variable bias correction  =
     65
     66Since a number of variables are typically required in impact applications (in particular in EUPORIAS WP23 and WP31;  [https://meteo.unican.es/trac/wiki/udg/ecoms/dataserver/listofvariables available variables]), we recommend two alternative bias correction methodologies for these tasks: a) the ISI-MIP methodology, b) qqmap bias correction.
     67
     68In order to facilitate this task (multi-variable bias correction), an script has been prepared to correct the following variables:
     69`ps`,`wss`,`huss`,`tas`,`tasmax`,`tasmin`,`tp`,`rsds`,`rlds` (the above codes correspond to the standard names used in `loadECOMS` and `downscaleR` packages). The example below applies the qqmap technique (considering the WFDEI observations) to the 15 members of the System4 dataset, for the six-month series (DJFMAM) corresponding to the November initialization for the period 2001-2010 in an European domain. The resulting bias corrected series are stored in a separate netcdf file.
    7470
    7571{{{
    7672#!text/R
     73# Packages and login
    7774library(downscaleR)
    7875library(ecomsUDG.Raccess)
    7976library(ncdf4) # Only needed to write NetCDF
    8077loginECOMS_UDG(username = "username", password = "password")
    81 # Seasonal forecast parameters:
     78
     79# Seasonal forecast parameters
    8280dataset <- "System4_seasonal_15"
    8381season <- c(12,1:5)
    8482leadMonth <- 1
    85 members <- 1:2
     83members <- 1:15
    8684lonLim <- c(-15,35)
    8785latLim <- c(32, 75)
     
    8987time <- "DD"
    9088
    91 # Bias correction parameters:
     89# Bias correction parameters
    9290interpolationMethod <- "nearest" # Both observation and forecast should be define on the same grid. Options: "nearest" and "bilinear"
    9391method <- "qqmap"
     
    9795}}}
    9896
    99 It is important to note that some variables are derived from others (e.g. wss is estimated from the two wind components). For this reason, in order to reduce the memory requirements of the loading process, we have defined an "advisable order", which is used in this example. It is also advisable to remove non-necesary variables.
    10097
    101 qqmap (with wet/dry frequency adjustment for precipitation)
    10298
    10399{{{
    104100#!text/R
    105 # Advisable Order: taking into account the nature (raw/derived) of the target variables we suggest the following order.
     101# Script to bias correct and store (as netcdf file) the data
    106102variables <- c("ps","wss","huss","tas","tasmax","tasmin","tp","rsds","rlds")
    107103for (v in 1:length(variables)){
     
    125121   # Exporting to netcdf4
    126122   fileName <- paste(var[v],"System4_WFDEI.nc4",sep = "_")
    127    grid2NetCDF(prd.bc, NetCDFOutFile = fileName,
     123   grid2NetCDF(prd, NetCDFOutFile = fileName,
    128124                  missval = 1e20,
    129125                  prec = "float")