cond_returnlevel_map {SpatialModelsZAMG} | R Documentation |
this function creates a map of Austria with conditional return levels
cond_returnlevel_map(covariables, cond_rl, q, sd_or_swe, plottitle = NULL, save_name = NULL, save_dir = getwd(), printPlot = TRUE)
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 ( |
plottitle |
a character string defining the title of the plot. |
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. |
printPlot |
logical value; if |
a map of Austria with the conditional return levels
cond_returnlevels
, cond_returnlevel_plot
, returnlevel_map
# 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)