closestdist_gcms {chooseGCM} | R Documentation |
Distance between General Circulation Models (GCMs)
Description
This function compares future climate projections from multiple General Circulation Models (GCMs) based on their similarity in terms of bioclimatic variables. It computes distance metrics between GCMs and identifies subsets of GCMs that are similar to the global set.
Usage
closestdist_gcms(
s,
var_names = c("bio_1", "bio_12"),
study_area = NULL,
scale = TRUE,
k = NULL,
method = "euclidean",
minimize_difference = TRUE,
max_difference = NULL
)
Arguments
s |
A list of stacks of General Circulation Models (GCMs). |
var_names |
Character. A vector with names of the bioclimatic variables to compare, or 'all' to include all available variables. |
study_area |
An Extent object, or any object from which an Extent object can be extracted. Defines the study area for cropping and masking the rasters. |
scale |
Logical. Whether to apply centering and scaling to the data. Default is |
k |
Numeric. The number of GCMs to include in the subset. If |
method |
The distance method to use. Default is "euclidean". Possible values are: "euclidean",
"maximum", "manhattan", "canberra", "binary", "minkowski", "pearson", "spearman", or "kendall". See |
minimize_difference |
Logical. If |
max_difference |
Numeric. A distance threshold to stop searching for the optimal subset.
If |
Details
The minimize_difference
option searches for the best value of k
by progressively
adding GCMs to the subset. The function monitors the mean distance between the subset of GCMs and
the global mean distance, stopping when the distance begins to increase.
The max_difference
option sets a maximum distance difference. If the mean distance between
the subset GCMs exceeds this threshold, the function stops searching and returns the current subset.
Value
A set of GCMs that have a mean distance closer to the global mean distance of all GCMs provided in s
.
Author(s)
Luíz Fernando Esser (luizesser@gmail.com) https://luizfesser.wordpress.com
See Also
Examples
var_names <- c("bio_1", "bio_12")
s <- import_gcms(system.file("extdata", package = "chooseGCM"), var_names = var_names)
study_area <- terra::ext(c(-80, -30, -50, 10)) |> terra::vect(crs="epsg:4326")
closestdist_gcms(s, var_names, study_area, method = "euclidean")