library(data.table)
library(scenarioIndices)
library(knmitransformer)
library(futile.logger)
flog.threshold(ERROR)

The scenarioIndices package calculates a set of indices that were published in the KNMI'14 Climate scenarios and uses the knmitransformer package for the transformed series. This document provides examples on how to use the function to calculate evaporation, precipitation and temperature indices in different seasonal periods.

Potential Evaporation Makkink

In the KNMI'14 Climate Scenarios brochure the annual and summer potential evaporation sum is presented. For this, the following need to be specified; temperature and radiation data sets, scenario and horizon.

inputTemp <- KnmiRefFile("KNMI14____ref_tg___19810101-20101231_v3.2.txt")
inputRad  <- KnmiRefFile("KNMI14____ref_rsds___19810101-20101231_v3.2.txt")
regions <- MatchRegionsOnStationId(ReadInput("tg", inputTemp)$header[1, -1])
scenario = "GL"  
horizon = 2030
  EvapRelChange <- evmkSumsRelchange(inputTemp=inputTemp, inputRad=inputRad,
                             scenario = scenario,
                             horizon = horizon,
                             regions = regions)

  EvapRelChange

The above table shows the relative change between the evaporation sums for GL 2030 and the reference data/period(1981-2010) for each station (columns) for the the annual change and the 4 seasons, winter, spring, summer, and autumn(rows.)

Precipitation Deficit

To calculate the index for precipitation deficit we must first specify the three input data sets for temperature, radiation and precipitation, and of course the regions for the temprature stations (knmitransformer)

inputTemp <- KnmiRefFile("KNMI14____ref_tg___19810101-20101231_v3.2.txt")
inputRad  <- KnmiRefFile("KNMI14____ref_rsds___19810101-20101231_v3.2.txt")
inputPrec <- KnmiRefFile("KNMI14____ref_rrcentr___19810101-20101231_v3.2.txt")
regions   <- MatchRegionsOnStationId(ReadInput("tg", inputTemp)$header[1, -1])

Then specify the scenario and horizon we would like to calculate the index:

  scenario = "WL"
  horizon = 2050

  precdefic <- PrecipDeficit(inputTemp = inputTemp, inputRad = inputRad,
                           inputPrec = inputPrec, scenario = scenario,
                           horizon = horizon,
                           regions = regions)
head(precdefic)

The second column (WL2050)

Precipitation threshold indices

A set of precipitation threshold indices can be calculated using the following function

 input <- KnmiRefFile("KNMI14____ref_rrcentr___19810101-20101231_v3.2.txt")
 input <- ReadInput("rr", input)
 PrecIndicesRef <- PrecIndicesWrapper(input$obs)
 head(PrecIndicesRef)

This table shows the calculate indices with thresholds: 0.1, 0.5, 10, 20, and 30 mm, for all seasons (year, & 4 seasons) for 104 precipitation stations.

Temperature indices

 input   <- KnmiRefFile("KNMI14____ref_tg___19810101-20101231_v3.2.txt")
 regions <- MatchRegionsOnStationId(ReadInput("tg", input)$header[1, -1])

Using the following wrapper function we can get a table with all related indices for all horizons and scenarios (including reference period) for all 4 seasons and annual values, for all temperature stations.

  tgindices <- TempAvgIndicesWrapper(input, regions = regions)
head(tgindices)

Similar to the previous indices:

input   <- KnmiRefFile("KNMI14____ref_tx___19810101-20101231_v3.2.txt")
regions <- MatchRegionsOnStationId(ReadInput("tx", input)$header[1, -1])
  txindices <- TempMaxIndicesWrapper(input, regions = regions)
head(txindices)

Similar to the previous indices:

input   <- KnmiRefFile("KNMI14____ref_tn___19810101-20101231_v3.2.txt")
regions <- MatchRegionsOnStationId(ReadInput("tn", input)$header[1, -1])
  tnindices <- TempMinIndicesWrapper(input, regions = regions)
head(tnindices)


cphotiadou/scenarioIndices documentation built on May 13, 2019, 10:54 p.m.