Skip to contents

Calculate the NatureServe Climate Change Vulnerability Index from the completed inputs.

Usage

calc_vulnerability(spat_df, vuln_df, tax_grp, n_rnds = 1000)

Arguments

spat_df

data.frame of spatial inputs produced by analyze_spatial

vuln_df

data.frame of answers to vulnerability questions. The format must match make_vuln_df.

tax_grp

taxonomic group of the species. Must match one of the options below

n_rnds

number of Monte Carlo repetitions for determining variability when multiple values are given for a factor

Value

A data.frame with 1 row per scenario and columns:

scenario_name

Name identifying the scenario

index

The index value as a string. EV: Extremely Vulnerable, HV: Highly Vulnerable, MV: Moderately Vulnerable, LV: Less Vulnerable, IE: Insufficient Evidence

conf_index

An index of the confidence in the index based on the monte carlo. Options are Low, Moderate, High, Very High or Insufficient Evidence.

mc_results

A data.frame with the b_c_score, d_score, and index for each monte carlo repitition

mig_exp

An index of the migratory exposure. Options are Low, Moderate, High, or "N/A"

d_score

Total score from section D the modelled response to climate change section

b_c_score

Total score from sections B and C the indirect exposure, sensitivity and adaptive capacity sections

vuln_df

Answers to each question plus any comments. Numerical scores correspond to: -1) Unknown, 0) Neutral, 1) Somewhat increase, 2) Increase, 3) Greatly increase. If there are 2 numbers then two boxes were checked and the average of the scores was used in the total score

n_b_factors

Number of factors scored in section B

n_c_factors

Number of factors scored in section C

n_d_factors

Number of factors scored in section D

slr_vuln

Whether the species' vulnerability to sea level rise and dispersal limitations led to an index of EV

Details

Options for tax_grp are Vascular Plant, Nonvascular Plant, Lichen, Invert-Insect, Invert-Mollusk, Invert-Other, Fish, Amphibian, Reptile, Mammal, Bird

Examples

# Setup
library(sf)
base_pth <- system.file("extdata", package = "ccviR")
scn_nms <- c("RCP 4.5", "RCP 8.5") # scenario names

clim_vars <- get_clim_vars(file.path(base_pth, "clim_files/processed"),
                           scenario_names = scn_nms)

spat_res <- analyze_spatial(
  range_poly = read_sf(file.path(base_pth, "rng_poly.shp"), agr = "constant"),
  scale_poly = read_sf(file.path(base_pth, "assess_poly.shp"), agr = "constant"),
  clim_vars_lst = clim_vars,
  hs_rast = terra::rast(c(file.path(base_pth, "rng_chg_45.tif"),
   file.path(base_pth, "rng_chg_85.tif"))),
  hs_rcl = matrix(c(-1, 0, 1, 1, 2, 3), ncol = 2),
  scenario_names = scn_nms
)
#> Checking files
#> Preparing polygon 'Climate Data Extext'
#> Preparing polygon 'Assessment Area'
#> Preparing polygon 'Range'
#> Clipping 'Range' to 'Climate Data Extent'
#> Clipping 'Range' to 'Assessment Area'
#> Assessing local climate exposure
#> Assessing thermal & hydrological niches
#> Assessing modelled range response to climate change
#> Warning: More than 10% of the range change raster does not match the expected values.
#> Is the classification table correct?
#> Finalizing outputs

# vulnerability factor table with score 1 (somewhat increase vulnerability)
# for all factors
vuln <- make_vuln_df("test_species", val1 = 1, mig = 1)

v <- calc_vulnerability(spat_res$spat_table, vuln, "Bird")
#> calculating vulnerability index RCP 4.5
#> finished vulnerability
#> calculating vulnerability index RCP 8.5
#> finished vulnerability

# With protected areas

spat_res <- analyze_spatial(
  range_poly = read_sf(file.path(base_pth, "rng_poly.shp"), agr = "constant"),
  scale_poly = read_sf(file.path(base_pth, "assess_poly.shp"), agr = "constant"),
  protected_poly = read_sf(file.path(base_pth, "protected_areas.shp")),
  hs_rast = terra::rast(c(file.path(base_pth, "rng_chg_45.tif"),
                          file.path(base_pth, "rng_chg_85.tif"))),
  clim_vars_lst = clim_vars,
  hs_rcl = matrix(c(-1, 0, 1, 1, 2, 3), ncol = 2),
  scenario_names = scn_nms
)
#> Checking files
#> Preparing polygon 'Climate Data Extext'
#> Preparing polygon 'Assessment Area'
#> Preparing polygon 'Range'
#> Clipping 'Range' to 'Climate Data Extent'
#> Clipping 'Range' to 'Assessment Area'
#> Assessing local climate exposure
#> Assessing thermal & hydrological niches
#> Assessing modelled range response to climate change
#> Warning: More than 10% of the range change raster does not match the expected values.
#> Is the classification table correct?
#> Preparing polygon 'Protected Areas'
#> Clipping 'Protected Areas' to 'Assessment Area'
#> Transforming polygon 'Protected Areas'
#> Finalizing outputs

# Fill in vulnerability Questions
vuln <- make_vuln_df("test_species")
vuln$Value1[3:19] <- c(0, 0, 1, 0, -1, -1, -1, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0)

# include a second value to reflect uncertainty and trigger a monte carlo to
# determine confidence
vuln$Value2[3:5] <- c(2, 0, 0)

v <- calc_vulnerability(spat_res$spat_table, vuln, "Bird")
#> calculating vulnerability index RCP 4.5
#> performing monte carlo
#> finished vulnerability
#> calculating vulnerability index RCP 8.5
#> performing monte carlo
#> finished vulnerability
v$vuln_df[[1]] %>% print(n = Inf)
#> # A tibble: 29 × 14
#>    Species      Code  Question  Max_Value is_spatial Value1 Value2 Value3 Value4
#>    <chr>        <chr> <chr>     <chr>     <chr>       <dbl>  <dbl> <lgl>  <lgl> 
#>  1 test_species Z2    "Is the … NA        NA             -1     NA NA     NA    
#>  2 test_species Z3    "Is the … NA        NA             -1     NA NA     NA    
#>  3 test_species B1    "Exposur… 3         0               0      2 NA     NA    
#>  4 test_species B2a   "Natural… 3         0               0      0 NA     NA    
#>  5 test_species B2b   "Anthrop… 3         0               1      0 NA     NA    
#>  6 test_species B3    "Predict… 2         0               0     NA NA     NA    
#>  7 test_species C1    "Dispers… 3         0              -1     NA NA     NA    
#>  8 test_species C2aii "Physiol… 3         1              -1     NA NA     NA    
#>  9 test_species C2bii "Physiol… 3         0               0     NA NA     NA    
#> 10 test_species C2c   "Depende… 2         0               0     NA NA     NA    
#> 11 test_species C2d   "Depende… 3         0               1     NA NA     NA    
#> 12 test_species C3    "Restric… 2         0               0     NA NA     NA    
#> 13 test_species C4a   "Depende… 2         0               0     NA NA     NA    
#> 14 test_species C4b   "Dietary… 2         0               1     NA NA     NA    
#> 15 test_species C4c   "Pollina… 2         0              -1     NA NA     NA    
#> 16 test_species C4d   "Depende… 2         0               0     NA NA     NA    
#> 17 test_species C4e   "Sensiti… 2         0               0     NA NA     NA    
#> 18 test_species C4f   "Sensiti… 2         0              -1     NA NA     NA    
#> 19 test_species C4g   "Forms p… 2         0              -1     NA NA     NA    
#> 20 test_species C5a   "Measure… 2         0              -1     NA NA     NA    
#> 21 test_species C5b   "Occurre… 2         0              -1     NA NA     NA    
#> 22 test_species C5c   "Reprodu… 2         0              -1     NA NA     NA    
#> 23 test_species C6    "Phenolo… 2         0              -1     NA NA     NA    
#> 24 test_species D1    "Documen… 3         0              -1     NA NA     NA    
#> 25 NA           C2ai   NA       NA        NA              1     NA NA     NA    
#> 26 NA           C2bi   NA       NA        NA              2     NA NA     NA    
#> 27 NA           D2     NA       NA        NA              2     NA NA     NA    
#> 28 NA           D3     NA       NA        NA              2     NA NA     NA    
#> 29 NA           D4     NA       NA        NA              1     NA NA     NA    
#> # ℹ 5 more variables: comment <chr>, evidence <chr>, N <int>, exp <dbl>,
#> #   score <dbl>