## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.align = "center")

## ----positive-shift-code, eval = FALSE----------------------------------------
# positive_shift <- climniche_priority(
#   spatial_fit,
#   exposure = "niche_distance_change",
#   criterion_name = "Current SDM suitability",
#   scope = "current",
#   positive_only = TRUE,
#   exposure_direction = "maximize"
# )

## ----low-displacement-code, eval = FALSE--------------------------------------
# low_displacement <- climniche_priority(
#   spatial_fit,
#   exposure = "climate_change_amount",
#   criterion_name = "Current SDM suitability",
#   scope = "current",
#   positive_only = FALSE,
#   exposure_direction = "minimize"
# )

## ----screening-summary, echo = FALSE------------------------------------------
library(climniche)

case_path <- system.file("extdata/mediterranean_anchovy", package = "climniche")
screening_summary <- read.csv(
  file.path(case_path, "anchovy_climniche_priority_summary.csv")
)
screening_table <- data.frame(
  Profile = screening_summary[["profile"]],
  Exposure = screening_summary[["exposure"]],
  Direction = screening_summary[["exposure_direction"]],
  `Ranked cells` = format(
    screening_summary[["ranked_cells"]],
    big.mark = ","
  ),
  `Pareto fronts` = screening_summary[["pareto_fronts"]],
  `First front` = screening_summary[["first_front_cells"]],
  check.names = FALSE
)
knitr::kable(screening_table, row.names = FALSE)

## ----screening-figure-code, eval = FALSE--------------------------------------
# positive_shift_figure <- plot_climniche_priority(
#   positive_shift,
#   type = "both",
#   map_value = "pareto_depth_score",
#   study_region = mediterranean_boundary,
#   degree_labels = "hemisphere"
# )
# 
# low_displacement_figure <- plot_climniche_priority(
#   low_displacement,
#   type = "both",
#   map_value = "pareto_depth_score",
#   study_region = mediterranean_boundary,
#   degree_labels = "hemisphere"
# )

## ----screening-figure-output, echo = FALSE, out.width = "100%"----------------
knitr::include_graphics("figures/anchovy-climniche-priority.png")

