doQuantileMapping: Performs a quantile mapping bias correction

View source: R/doQuantileMapping.R

doQuantileMappingR Documentation

Performs a quantile mapping bias correction

Description

Bias correction for climate model output with observations using the package qmap by Lukas Gudmundsson.

Usage

doQuantileMapping(hist_obs, hist_sim, fut_sim)

Arguments

hist_obs

Tibble with historical observations for 1 or more stations. The tibble must contain the columns Date (class: Date), Basin (class: chr) and Ta OR Pr (class: num) whereby Ta contains temperatures in deg C and Pr precipitation in mm.

hist_sim

Tibble with simulations of historical time series for the region of interest. The tibble must contain the columns Date (class: Date), Model (class: chr) and Ta OR Pr (class: num) whereby Ta contains temperatures in deg C and Pr precipitation in mm. Model specifies the climate model.

fut_sim

Tibble with simulations of future climate in the region of interest. The tibble must contain the columns Date (class: Date), Model (class: chr) for the climate model, Scenario (class: chr) for the CC scenario and Ta OR Pr (class: num) whereby Ta contains temperatures in deg C and Pr precipitation in mm.

Details

It is assumed that the observations used for bias correction fit into one single tile of the climate model output.
Temperatures are transformed to deg K.

Value

NULL for failure.

See Also

Other Pre-processing: convert2HYY(), gen_HRU_Climate_CSV_RSMinerve(), gen_basinElevationBands(), loadTabularData(), plotNormDevHYY()

Examples

hist_obs <- tibble::tribble(~Date, ~Basin, ~Pr,
                            "1979-01-01", "K_eb1", 0.1,
                            "1979-01-01", "K_eb2", 0.2,
                            "1979-01-01", "K_eb3", 0.3,
                            "1979-01-02", "K_eb1", 0.4,
                            "1979-01-02", "K_eb2", 0.5,
                            "1979-01-02", "K_eb3", 0.6) |>
  dplyr::mutate(Date = as.Date(Date))
hist_sim <- hist_obs |>
  dplyr::filter(Basin == "K_eb1") |>
  dplyr::select(-Basin) |>
  dplyr::mutate(Pr = Pr + 1, Model = "A")
hist_sim <- hist_sim |>
  dplyr::add_row(hist_sim |>
                   dplyr::mutate(Pr = Pr + 2, Model = "B"))
fut_sim <- hist_sim |>
  dplyr::mutate(Scenario = "a") |>
  dplyr::add_row(hist_sim |>
                   dplyr::mutate(Pr = Pr + 1, Scenario = "b"))
fut_sim <- fut_sim |>
  dplyr::add_row(fut_sim |>
                   dplyr::mutate(Date = as.Date(Date) + 2))

results <- doQuantileMapping(hist_obs, hist_sim, fut_sim)
mapped_hist_sim <- results[[1]]
mapped_fut_sim <- results[[2]]

hydrosolutions/riversCentralAsia documentation built on Feb. 7, 2023, 4:50 p.m.