cond_returnlevel_map: Create conditional return level maps for Austria

Description Usage Arguments Value See Also Examples

View source: R/cond_returnlevel_map.R

Description

this function creates a map of Austria with conditional return levels

Usage

1
2
3
cond_returnlevel_map(covariables, cond_rl, q, sd_or_swe,
                     plottitle = NULL, save_name = NULL,
                     save_dir = getwd(), printPlot = TRUE)

Arguments

covariables

a named matrix with the covariables. each row corresponds to one location, columns should include at least lon and lat

cond_rl

a vector with the conditional return level for every location

q

the return period – must be a number greater than 1

sd_or_swe

a character string; you can either chose snow depth ("sd") or snow water equivalent ("swe")

plottitle

a character string defining the title of the plot.
default is plottitle = "sd_or_swe conditional return level map", depending on sd_or_swe. if no plottitle is wanted, use plottitle = ""

save_name

a character string defining the saving name of the map.

save_dir

a character string defining the directory for the map to be saved.
default is the working directory

printPlot

logical value; if TRUE (default), the plot is printed

Value

a map of Austria with the conditional return levels

See Also

cond_returnlevels, cond_returnlevel_plot, returnlevel_map

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# get covariables
lon = get(data(lon.at))
lon = as.vector(t(lon))
lat = get(data(lat.at))
lat = as.vector(t(lat))
alt = get(data(alt.at))
alt = as.vector(t(alt))

x = get(data(sample_grid_data))

mdday    = x$mdday
sd_mmax  = x$mmsd
swe_mmax = x$mmswe

# take only locations of the (Austrian) domain
lon = lon[which(!is.na(mdday))]
lat = lat[which(!is.na(mdday))]
alt = alt[which(!is.na(mdday))]
mdday    = mdday[which(!is.na(mdday))]
sd_mmax  = sd_mmax[which(!is.na(sd_mmax))]
swe_mmax = swe_mmax[which(!is.na(swe_mmax))]

# define matrix 'covariables'
covariables = cbind("lon" = lon, "lat" = lat, "alt" = alt,
                    "mdday" = mdday, "sd_mmax" = sd_mmax,
                    "swe_mmax" = swe_mmax)

# load function output from GEVparameters_from_models
sd_GEVparam  = get(data("sd_GEVparam"))

# load function output from optimizer_biv_hr_model
data("optim_hr")

# define coefficients
sd_coeff  = optim_hr$coefficients$sd_coeff
cor_coeff = optim_hr$coefficients$cor_coeff

# define return period (same as in sd_GEVparam)
q = 100

# calculate return levels
sd_rl  = returnlevels(GEVparam = sd_GEVparam,  q = q)

# sd given sd in ibk
ibk = c("lon" = 11.392778, "lat" = 47.267222, "alt" = 574,
        "mdday" = 6.12, "sd_mmax" = 16.8, "swe_mmax" = 29)
sd_GEVparam_ibk  = GEVparameters_from_models(ibk, sd_coeff)
sd_rl_ibk = returnlevels(GEVparam = sd_GEVparam_ibk, q = q)

cond_rl_ibk =
  cond_returnlevels(locations = covariables,
                    GEVparam = sd_GEVparam, q = q,
                    cond_locations = ibk,
                    cond_GEVparam = sd_GEVparam_ibk,
                    same_var = TRUE, cond_B = sd_rl_ibk,
                    cor_coeff = cor_coeff, model = "hr")

# create conditional return level map
cond_returnlevel_map(covariables = covariables,
                     cond_rl = cond_rl_ibk, q = q,
                     sd_or_swe = "sd", printPlot = TRUE)

SpatialModelsZAMG documentation built on Nov. 11, 2019, 3 p.m.