ADRIA API
Metrics
ADRIA.metrics._absolute_juveniles Method
absolute_juveniles(X::AbstractArray{T,3}, coral_spec::DataFrame, k_area::AbstractVector{T})::AbstractArray{T,2} where {T<:Real}
absolute_juveniles(rs::ResultSet)::AbstractArray{<:Real,2}Juvenile coral cover in m².
Arguments
X: Raw model results for a single scenario. Dimensions (n_timesteps, n_group, n_sizes,
n_locations)
coral_spec: Coral spec DataFramek_area: The coral habitable area.
ADRIA.metrics._absolute_shelter_volume Method
absolute_shelter_volume(X::YAXArray{T,4}, k_area::Vector{T}, inputs::DataFrameRow)::AbstractArray{T} where {T<:Real}
absolute_shelter_volume(X::YAXArray{T,4}, k_area::Vector{T}, inputs::YAXArray)::AbstractArray{T} where {T<:Real}
absolute_shelter_volume(X::YAXArray{T,5}, k_area::Vector{T}, inputs::DataFrame)::AbstractArray{T} where {T<:Real}
absolute_shelter_volume(X::YAXArray{T,5}, k_area::Vector{T}, inputs::YAXArray)::AbstractArray{T} where {T<:Real}
absolute_shelter_volume(rs::ResultSet)Provide indication of shelter volume in volume of cubic meters.
The metric applies log-log linear models developed by Urbina-Barreto et al., [1] which uses colony diameter and planar area (2D metrics) to estimate shelter volume (a 3D metric).
Arguments
X: raw resultsk_area: area in m^2 for each sitemax_cover: maximum possible coral cover for each site (in percentage of loc_area)inputs: DataFrame of scenario inputs
References
- Urbina-Barreto, I., Chiroleu, F., Pinel, R., Fréchon, L., Mahamadaly, V., Elise, S., Kulbicki, M., Quod, J.-P., Dutrieux, E., Garnier, R., Henrich Bruggemann, J., Penin, L., & Adjeroud, M. (2021). Quantifying the shelter capacity of coral reefs using photogrammetric 3D modeling: From colonies to reefscapes. Ecological Indicators, 121, 107151. https://doi.org/10.1016/j.ecolind.2020.107151
ADRIA.metrics._collate_ranked_locs Method
_collate_ranked_locs(data::YAXArray)::Matrix{Int64}Collates number of ranked locations.
sourceADRIA.metrics._collate_ranks Method
_collate_ranks(rs, selected)Collates ranks into seed/fog ranking results into a common structure.
sourceADRIA.metrics._coral_diversity Method
coral_diversity(ce::AbstractArray{T})::AbstractArray{T} where {T}
coral_diversity(rs::ResultSet)::AbstractArray{T} where {T}Calculates coral diversity metric as the Gini-Simpson index. This is calculated from coral evenness (which is the inverse Simpson's index, 1/D) as 1 - 1/evenness, which is equivalent to 1 - D.
Arguments
ce: Coral evenness (inverse Simpson's index).rs: A ResultSet object.
ADRIA.metrics._coral_evenness Method
coral_evenness(r_taxa_cover::AbstractArray{T})::AbstractArray{T} where {T<:Real}
coral_evenness(rs::ResultSet)::AbstractArray{T} where {T}Calculates evenness across functional coral groups in ADRIA as a diversity metric. Inverse Simpsons diversity indicator.
References
- Hill, M. O. (1973).
Diversity and Evenness: A Unifying Notation and Its Consequences. Ecology, 54(2), 427-432. https://doi.org/10.2307/1934352
sourceADRIA.metrics._extract_axes_values Method
Helper method to extract pairs of YAXArray axes (names and their values).
sourceADRIA.metrics._get_ranks Method
_get_ranks(rs::ResultSet, intervention::Int64; kwargs...)Extracts results for a specific intervention (:seed or :fog)
sourceADRIA.metrics._juvenile_indicator Method
juvenile_indicator(X::AbstractArray{T}, coral_spec::DataFrame, k_area::Vector{Float64})::AbstractArray{T,2} where {T<:Real}
juvenile_indicator(rs::ResultSet)::AbstractArray{<:Real,2}Indicator for juvenile density (0 - 1), where 1 indicates the maximum theoretical density for juveniles have been achieved.
Arguments
X: Raw model results for a single scenario. Dimensions (n_timesteps, n_group, n_sizes,
n_locations).
coral_spec: Coral spec DataFrame.k_area: The coral habitable area.max_juvenile_density: Maximum density of juveniles defaulting to 51.8 juveniles / m²
Notes
Maximum density is 51.8 juveniles / m², where juveniles are defined as < 5cm diameter. See email correspondence from: Dr. A Thompson; to: Dr. K. Anthony Subject: RE: Max density of juvenile corals on the GBR Sent: Friday, 14 October 2022 2:58 PM
sourceADRIA.metrics._max_juvenile_area Function
_max_juvenile_area(coral_params::DataFrame, max_juv_density::Float64=51.8)Calculate the maximum possible area that can be covered by juveniles for a given m².
sourceADRIA.metrics._reef_biodiversity_condition_index Method
_reef_biodiviersity_condition_index(rs::ResultSet)ADRIA.metrics._reef_condition_index Method
reef_condition_index(ltmp_cover::AbstractArray, sv::AbstractArray, juves::AbstractArray,)::AbstractArray
reef_condition_index(ltmp_cover::AbstractArray, juves::AbstractArray, sv::AbstractArray, rubble::AbstractArray)::AbstractArray
reef_condition_index(rs::ResultSet)::AbstractArray{<:Real}
reef_condition_index(rs::ResultSet, rubble::AbstractArray)::AbstractArray{<:Real}Estimates a Reef Condition Index (RCI) using either the 3-metric version using relative cover, juveniles, shelter volume or the 4-metric versions with rubble added.
The RCI is a single value that indicates the condition of a reef.
Notes
Juveniles are made relative to maximum observed juvenile density (15.0/m²) See table 1 in reference 1.
Arguments
ltmp_cover: LTMP coral cover across all groupsjuves: Abundance of coral juveniles < 5 cm diametersv: Shelter volume based on coral sizes and abundancesrubble: Cover of rubble (optional)rs: A ResultSet object.
Returns
YAXArray[timesteps ⋅ locations ⋅ scenarios]
References
- Ryan F. Heneghan, Gabriela Scheufele, Yves-Marie Bozec et al. A framework to inform economic valuation of non-use benefits from coral-reef intervention efforts, 02 October 2025, PREPRINT (Version 1) available at Research Square [https://doi.org/10.21203/rs.3.rs-7644150/v1]
ADRIA.metrics._reef_fish_index Method
reef_fish_index(rc::AbstractArray)
reef_fish_index(rs::ResultSet)The Reef Fish Index (RFI) estimates fish biomass from relative coral cover.
A linear regression (developed by Dr. R. Heneghan, Queensland University of Technology) is used to indicate the relationship between coral cover and fish biomass. The regression was developed with digitized data from Figures 4a and 6b in Graham & Nash (2013; see [1]).
Values are provided ∈ [0, 1], where 1 indicates maximum fish biomass.
Note: Coral cover here is relative to coral habitable area (
Arguments
rc: Relative cover
Returns
YAXArray[timesteps ⋅ locations ⋅ scenarios], values in kg/km²
References
- Graham, N.A.J., Nash, K.L., 2013.
The importance of structural complexity in coral reef ecosystems. Coral Reefs 32, 315–326. https://doi.org/10.1007/s00338-012-0984-y
sourceADRIA.metrics._reef_tourism_index Method
reef_tourism_index(rc::AbstractArray{<:Real,3}, sv::AbstractArray{<:Real,3}, juves::AbstractArray{<:Real,3}, cots::AbstractArray{<:Real,3}, rubble::AbstractArray{<:Real,3})::AbstractArray
reef_tourism_index(rc::AbstractArray{<:Real,3}, ce::AbstractArray{<:Real,3}, sv::AbstractArray{<:Real,3}, juves::AbstractArray{<:Real,3})::AbstractArray
reef_tourism_index(rs::ResultSet, cots::YAXArray, rubble::YAXArray)::AbstractArray
reef_tourism_index(rs::ResultSet)::AbstractArrayEstimate tourism index.
This metric is a variation of the Reef Condition Index, but weighted by metrics known to be of importance to tourists. This version uses 5 metrics: relative cover, shelter volume, juvenile abundance, CoTS, and rubble.
Arguments
rs: ResultSetcots: Outbreak status of Crown-of-Thorns Starfishrubble: Cover of rubble
ADRIA.metrics._relative_cover Method
relative_cover(X::AbstractArray{<:Real}, loc_area::AbstractVector{<:Real})::AbstractArray{<:Real}
relative_cover(rs::ResultSet)::AbstractArray{<:Real}Indicate coral cover relative to available hard substrate (
Arguments
X: Matrix with dimensions (n_timesteps, n_functional_groups * n_size_classes,
n_locations) of raw model results (coral cover relative to available space)
Returns
Coral cover [0 - 1], relative to available
ADRIA.metrics._relative_juveniles Method
relative_juveniles(X::AbstractArray{T,3}, coral_spec::DataFrame)::AbstractArray{T,2} where {T<:Real}
relative_juveniles(rs::ResultSet)::AbstractArray{<:Real,2}Juvenile coral cover relative to the location's area.
Arguments
X: Raw model results for a single scenario. Dimensions (n_timesteps, n_group, n_sizes,
n_locations)
coral_spec: Coral spec DataFrame
ADRIA.metrics._relative_loc_taxa_cover Method
relative_loc_taxa_cover(X::AbstractArray{T}, k_area::Vector{T}, n_groups::Int64)::AbstractArray{T,3} where {T<:Real}Arguments
X: Raw model results for a single scenario. Dimensions (n_timesteps, n_group, n_sizes,
n_locations)
k_area: The coral habitable area.n_groups: Number of function coral groups.
Returns
Coral cover, grouped by taxa for the given scenario, for each timestep and location, relative to location k area.
sourceADRIA.metrics._relative_shelter_volume Method
relative_shelter_volume(X::AbstractArray{T,4}, k_area::Vector{T}, inputs::DataFrameRow)::AbstractArray{T} where {T<:Real}
relative_shelter_volume(X::AbstractArray{T,4}, k_area::Vector{T}, inputs::YAXArray)::AbstractArray{T} where {T<:Real}
relative_shelter_volume(X::AbstractArray{T,5}, k_area::Vector{T}, inputs::DataFrame)::AbstractArray{T} where {T<:Real}
relative_shelter_volume(X::AbstractArray{T,5}, k_area::Vector{T}, inputs::YAXArray)::AbstractArray{T} where {T<:Real}
relative_shelter_volume(rs::ResultSet)Provide indication of shelter volume relative to theoretical maximum volume for the area covered by coral.
The metric applies log-log linear models developed by Urbina-Barreto et al., [1] which uses colony diameter and planar area (2D metrics) to estimate shelter volume (a 3D metric).
where
Arguments
X: raw resultsk_area: area in m^2 for each sitescens: DataFrame of scenario inputs
Returns
Shelter volume relative to a theoretical maximum volume for the available
References
- Urbina-Barreto, I., Chiroleu, F., Pinel, R., Fréchon, L., Mahamadaly, V., Elise, S.,
Kulbicki, M., Quod, J.-P., Dutrieux, E., Garnier, R., Henrich Bruggemann, J., Penin, L., & Adjeroud, M. (2021). Quantifying the shelter capacity of coral reefs using photogrammetric 3D modeling: From colonies to reefscapes. Ecological Indicators, 121, 107151. https://doi.org/10.1016/j.ecolind.2020.107151
sourceADRIA.metrics._relative_taxa_cover Method
relative_taxa_cover(X::AbstractArray{<:Real}, k_area::Vector{<:Real}, n_groups::Int64)::AbstractArray{<:Real,2}
relative_taxa_cover(rs::ResultSet)::AbstractArray{<:Real,2}Relative coral cover grouped by groups summed up across all locations.
Arguments
X: Raw model results for a single scenario. Dimensions (n_timesteps, n_group, n_sizes,
n_locations).
k_area: The coral habitable area.n_groups: Number of function coral groups.
Returns
Coral cover, grouped by taxa for the given scenario, summed up across all locations, relative to total k area.
sourceADRIA.metrics._scenario_absolute_juveniles Method
scenario_absolute_juveniles(data::YAXArray, coral_spec::DataFrame, k_area::AbstractVector{<:Real}; kwargs...)::AbstractArray{<:Real}
scenario_absolute_juveniles(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean absolute juvenile population for each scenario for the entire domain.
Arguments
aj: Raw data for a single scenario.k_area: K_area.rs: Resultset.
ADRIA.metrics._scenario_asv Method
scenario_asv(sv::YAXArray; kwargs...)::AbstractArray{<:Real}
scenario_asv(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean absolute shelter volumes for each scenario for the entire domain.
Arguments
asv: Absolute shelter volume.rs: Resultset.
ADRIA.metrics._scenario_evenness Method
scenario_evenness(ev::YAXArray; kwargs...)::AbstractArray{<:Real}
scenario_evenness(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean coral evenness for each scenario for the entire domain.
sourceADRIA.metrics._scenario_juvenile_indicator Method
scenario_juvenile_indicator(data::YAXArray, coral_spec::DataFrame, k_area::AbstractVector{<:Real}; kwargs...)::AbstractArray{<:Real}
scenario_juvenile_indicator(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Determine juvenile indicator ∈ [0, 1], where 1 indicates maximum mean juvenile density (51.8) has been achieved.
Arguments
ji: Juvenile Indicator for each location.rs: Resultset.
ADRIA.metrics._scenario_rci Method
scenario_rci(rci::YAXArray, tac::YAXArray; kwargs...)
scenario_rci(rci::YAXArray, rubble::YAXArray; kwargs...)
scenario_rci(rs::ResultSet; kwargs...)Extract the total populated area of locations with Reef Condition Index of "Good" or higher for each scenario for the entire domain.
sourceADRIA.metrics._scenario_relative_cover Method
scenario_relative_cover(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean relative coral cover for each scenario for the entire domain.
sourceADRIA.metrics._scenario_relative_juveniles Method
scenario_relative_juveniles(X::YAXArray{<:Real,3}, coral_spec::DataFrame, k_area::AbstractVector{<:Real}; kwargs...)::AbstractArray{<:Real}
scenario_relative_juveniles(rs::ResultSet; kwargs...)::YAXArrayCalculate the mean relative juvenile population for each scenario for the entire domain.
Arguments
X: Raw data for a single scenario.rs: Resultset.coral_spec: Coral spec DataFrame.k_area: K_area.
Examples
num_scens = 2^5
scens = ADRIA.sample(dom, num_scens)
_coral_spec = ADRIA.to_coral_spec(scens[1,:])
_k_area = loc_k_area(dom)
# X contains raw coral cover results for a single scenario
ADRIA.metrics.scenario_relative_juveniles(X, _coral_spec, _k_area)ADRIA.metrics._scenario_rfi Method
scenario_rfi(rfi::YAXArray; kwargs...) scenario_rfi(rs::ResultSet; kwargs...)
Calculate the mean Reef Fish Index (RFI) for each scenario for the entire domain.
sourceADRIA.metrics._scenario_rsv Method
scenario_rsv(sv::YAXArray; kwargs...)::AbstractArray{<:Real}
scenario_rsv(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean relative shelter volumes for each scenario for the entire domain.
sourceADRIA.metrics._scenario_rti Method
scenario_rti(rs::ResultSet, cots::YAXArray, rubble::YAXArray; kwargs...)
scenario_rti(rs::ResultSet; kwargs)Calculate the mean Reef Tourism Index (RTI) for each scenario for the entire domain.
sourceADRIA.metrics._scenario_total_cover Method
scenario_total_cover(rs::ResultSet; kwargs...)::AbstractArray{<:Real}Calculate the mean absolute coral for each scenario for the entire domain.
Arguments
tac: Total absolute coverrs: ResultSet
ADRIA.metrics._summarize_inner Method
Barrier function: Val{NA}/Val{NK} allow Julia to specialize on ndims at compile time, eliminating per-iteration dynamic dispatch on view/metric calls.
sourceADRIA.metrics._total_absolute_cover Method
total_absolute_cover(relative_cover::AbstractArray{<:Real}, k_area::Vector{<:Real})::AbstractArray{<:Real}
total_absolute_cover(rs::ResultSet)::AbstractArray{<:Real}The Total Absolute Coral Cover. Sum of proportional area taken up by all corals, multiplied by the location area.
Arguments
relative_cover: Array with relative_coverk_area: Proportional area, with locations following the same order as given indicated inrelative_cover.
Returns
Absolute coral cover for a given location in m².
sourceADRIA.metrics.axes_units Method
axes_units(axes_names::Union{Vector{Symbol},Tuple})::TupleGet units for each metric axis.
sourceADRIA.metrics.call_metric Method
call_metric(metric::Union{Function,Metric}, data::YAXArray, args...; kwargs...)Convenience method that slices the data in the specified manner.
Arguments
metric: Function, the metric function to apply to "raw" data.data: YAXArray, data to pass intometricargs: Additional positional arguments to pass intometrickwargs: Additional keyword arguments to pass intoslice_resultsdims: dummy keyword argument, not used but defined to allow use with other methods
ADRIA.metrics.dims Method
dims(m::Metric)::TupleGet dimension names for a given outcome/metric.
sourceADRIA.metrics.dominates Method
dominates(x::Vector{<:Real}, y::Vector{<:Real})::VectorAdapted from: https://discourse.julialang.org/t/fast-optimized-non-dominated-sorting-algorithms/86793/7
Original function name is dominates2()
ADRIA.metrics.ensemble_loc_difference Method
ensemble_loc_difference(outcome::YAXArray{T,3}, scens::DataFrame; agg_metric::Union{Function,AbstractFloat}=median, diff_target=:guided, conf::Float64=0.95, rng::AbstractRNG=Random.GLOBAL_RNG)::YAXArray where {T}Mean bootstrapped difference (counterfactual - target) between some outcome aggregated for each location.
Arguments
outcome: Metric outcome with dimensions (:timesteps, :locations, :scenarios).scens: Scenarios DataFrame.agg_metric: Metric used to aggregate scenarios when comparing between counterfactual and
target. If it is an AbstractFloat between 0 and 1, it uses the agg_metric-th quantile. Defaults to median.
diff_target: Target group of scenarios to compare with. Valid options are:guidedand
:unguided. Defaults to :guided
conf: Percentile used for the confidence interval. Defaults to 0.95.rng: Pseudorandom number generator.
Example
# Load domain
dom = ADRIA.load_domain(path_to_domain, "<RCP>")
# Create scenarios
num_scens = 2^6
scens = ADRIA.sample(dom, num_scens)
# Run model
rs = ADRIA.run_scenarios(dom, scens, "45")
# Calculate difference to the counterfactual for given metric
_relative_cover = metrics.relative_cover(rs)
# Compute difference between guided and counterfactual using the 0.6-th quantile
gd_res = metrics.ensemble_loc_difference(r_cover, scens; agg_metric=0.6)
# Compute difference between unguided and counterfactual using the median
ug_res = metrics.ensemble_loc_difference(r_cover, scens; diff_target=:unguided)
# Plot maps of difference to the counterfactual
ADRIA.viz.map(rs, gd_res[summary=At(:agg_value)]; diverging=true)
ADRIA.viz.map(rs, ug_res[summary=At(:agg_value)]; diverging=true)Returns
Vector with bootstrapped difference (counterfactual - guided) for each location.
sourceADRIA.metrics.fill_axes_metadata! Method
fill_axes_metadata!(outcomes::YAXArray)::NothingFill outcomes axes metadata.
sourceADRIA.metrics.fill_metadata! Method
fill_metadata!(outcomes::YAXArray{T,N,A}, metric::Metric)::YAXArray{T,N,A} where {T,N,A}
fill_metadata!(outcomes::YAXArray{T,N,A}, metadata::Dict{Symbol,Any})::YAXArray{T,N,A} where {T,N,A}Fill outcomes YAXArray metadata (properties attribute).
Arguments
outcomes: YAXArray datacube of metric outcomes.metric: ADRIA.metrics.Metric object.metadata: Dict to be used to fill outcomes metrics metadata.
ADRIA.metrics.fog_ranks Method
fog_ranks(rs::ResultSet; kwargs...)Arguments
rs : ResultSet
kwargs : named dimensions to slice across
Returns
YAXArray[timesteps, sites, scenarios]
Example
ADRIA.metrics.fog_ranks(rs; timesteps=1:10, scenarios=3:5)ADRIA.metrics.loc_trajectory Method
loc_trajectory(metric, data::YAXArray{D,T,N,A})::YAXArray where {D,T,N,A}Alias for summarize(data, [:scenarios], metric). Collate trajectory for each location, applying metric across values for all scenarios.
Examples
using Statistics
rs = ADRIA.load_results("some results")
tac = ADRIA.metrics.total_absolute_cover(rs)
# Get median trajectory for each site
ADRIA.metrics.loc_trajectory(median, tac)
#75×216 YAXArray{Float64,2} with dimensions:
# Dim{:timesteps} Categorical{Any} Any[1, 2, …, 74, 75] Unordered,
# Dim{:locations} Categorical{Any} Any[1, 2, …, 215, 216] Unordered
#Total size: 126.56 KB
# Get upper 95% CI for each site
ADRIA.metrics.loc_trajectory(x -> quantile(x, 0.975), tac)
#75×216 YAXArray{Float64,2} with dimensions:
# Dim{:timesteps} Categorical{Any} Any[1, 2, …, 74, 75] Unordered,
# Dim{:locations} Categorical{Any} Any[1, 2, …, 215, 216] Unordered
#Total size: 126.56 KBArguments
metric : Any function (nominally from the Statistics package) to be applied to
datadata : Data set to apply metric to
Returns
2D array of
ADRIA.metrics.metadata Method
metadata(outcomes::YAXArray)::Dict{Symbol,Any}Helper function to extract metadata from YAXArrays.
sourceADRIA.metrics.metric_label Method
metric_label(m::Metric)::String
metric_label(f::Function, unit::String)Return name of metric in the format: "Title Case [Unit]", suitable for use as a label.
Example
m_label = metric_label(scenario_total_cover)
# "Scenario Total Cover [m²]"ADRIA.metrics.n_fog_locations Method
n_fog_locations(rs::ResultSet; kwargs...)::Matrix{Int64}Determine the number of locations fogged at each time step, for each scenario.
Returns
YAXArray[timesteps ⋅ scenarios] indicating the number of locations fogged at each time step.
sourceADRIA.metrics.n_seed_locations Method
n_seed_locations(rs::ResultSet; kwargs...)::Matrix{Int64}Determine the number of locations seeded at each time step, for each scenario.
Returns
YAXArray[timesteps ⋅ scenarios] indicating the number of locations seeded at each time step.
sourceADRIA.metrics.nds Function
nds(X::AbstractArray{<:Real}, dist::Int64=0)::Vector{Vector{<:Int}}Naive n-dimensional non-dominated sorting.
Adapted from: https://discourse.julialang.org/t/fast-optimized-non-dominated-sorting-algorithms/86793/7
Original function name is nds4()
Arguments
X : outcomes, where rows are scenarios and columns are metric results. dist : distance from front, where 0 is on the frontier.
Returns
Vector of Vectors with row indices for each dist from frontier, where 0 is on the frontier.
ADRIA.metrics.per_loc Method
per_loc(metric, data::YAXArray{D,T,N,A})::YAXArray where {D,T,N,A}Alias for summarize(data, [:scenarios, :timesteps], metric). Get metric results applied to the location-level at indicated time (or across timesteps).
Arguments
metric : Any function (nominally from the Statistics package) to be applied to
datadata : Data set to apply metric to
timesteps : timesteps to apply
metricacross
Returns
Named Vector of
ADRIA.metrics.scenario_outcomes Method
scenario_outcomes(rs::ResultSet, metrics::Vector{Metric})::YAXArrayGet outcomes for a given list of metrics and a result set.
Arguments
rs: ResultSetmetrics: Vector of scenario Metrics (the ones that start withscenario_)
Returns
YAXArray with (:timesteps, :scenarios, :outcomes)
Examples
metrics::Vector{ADRIA.metrics.Metric} = [
ADRIA.metrics.scenario_total_cover,
ADRIA.metrics.scenario_asv,
ADRIA.metrics.scenario_absolute_juveniles,
]
# 3-dimensional Array of outcomes
outcomes = ADRIA.metrics.scenario_outcomes(rs, metrics)ADRIA.metrics.scenario_trajectory Method
scenario_trajectory(data::AbstractArray; metric=mean)::YAXArray{<:Real}Produce scenario trajectories using the provided metric/aggregation function.
Arguments
data: Results to aggregatemetric: Function or Callable used to summarize data
Returns
Matrix[timesteps ⋅ scenarios]
sourceADRIA.metrics.seed_ranks Method
seed_ranks(rs::ResultSet; kwargs...)Arguments
rs : ResultSet
kwargs : named dimensions to slice across
Returns
YAXArray[timesteps, sites, scenarios]
Example
ADRIA.metrics.seed_ranks(rs; timesteps=1:10, scenarios=3:5)ADRIA.metrics.slice_results Method
slice_results(data::YAXArray; timesteps=(:), species=(:), locations=(:), scenarios=(:))Slice data as indicated. Dimensions not found in target data are ignored.
sourceADRIA.metrics.summarize Method
summarize(data::YAXArray{<:Real}, alongs_axis::Vector{Symbol}, metric::Function)::YAXArray{<:Real}
summarize(data::YAXArray{<:Real}, alongs_axis::Vector{Symbol}, metric::Function, timesteps::Union{UnitRange,Vector{Int64},BitVector})::YAXArray{<:Real}Apply summary metric along some axis of a data set across some or all timesteps.
Arguments
data: Data set to apply metric to.alongs_axis: which axis will be replaced with (😃 when slicing.metric: Any function (nominally from the Statistics package) to be applied todata.timesteps: timesteps to applymetricacross.
Returns
YAXArray with summary metric for the remaining axis.
sourceADRIA.metrics.summarize_absolute_shelter_volume Method
summarize_absolute_shelter_volume(sv::YAXArray; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}
summarize_absolute_shelter_volume(rs::ResultSet, kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Calculate summarized coral evenness.
sourceADRIA.metrics.summarize_coral_evenness Method
summarize_coral_evenness(raw::YAXArray; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}
summarize_coral_evenness(rs::ResultSet, kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Calculate summarized coral evenness.
sourceADRIA.metrics.summarize_raw Method
summarize_raw(data::YAXArray; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Summarize raw data, aggregating the specified dimensions (e.g., timesteps, scenarios, etc.) and collapsing given dims.
ADRIA.metrics.summarize_relative_cover Method
summarize_relative_cover(rc::YAXArray; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}
summarize_relative_cover(rs::ResultSet, kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Calculate summarized relative cover.
sourceADRIA.metrics.summarize_relative_shelter_volume Method
summarize_relative_shelter_volume(sv::YAXArray; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}
summarize_relative_shelter_volume(rs::ResultSet, kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Calculate summarized coral evenness.
sourceADRIA.metrics.summarize_total_cover Method
summarize_total_cover(raw::YAXArray, areas::AbstractArray{<:Real}; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}
summarize_total_cover(rs::ResultSet; kwargs...)::Dict{Symbol,AbstractArray{<:Real}}Calculate summarized total absolute cover.
sourceADRIA.metrics.to_string Method
to_string(m::Metric)::StringGet name of metric as a string.
sourceADRIA.metrics.to_symbol Method
to_symbol(m::Metric)::StringGet name of metric as a symbol.
sourceADRIA.metrics.top_N_sites Method
top_N_sites(rs::ResultSet; N::Int64; metric::relative_cover)
top_N_sites(data::AbstractArray{Real}, N::Int64; stat=mean)Return the top N sites according to the provided metric (defaulting to mean of relative_cover).
Arguments
rs : ResultSet
N : Number of best performing sites to be selected
metric : Metric to use to order sites from best to worst, must take ResultSet as input
stat : Summary statistic to use for comparison (default: mean)
Returns
YAXArray[:scenarios, :locations], where locations indicates order of location ranking.
Example
ADRIA.metrics.top_N_sites(rs, 5)
ADRIA.metrics.top_N_sites(rs, 5; metric=ADRIA.metric.relative_cover)
ADRIA.metrics.top_N_sites(rs, 5; metric=ADRIA.metric.relative_cover, stat=median)ADRIA.metrics.top_n_seeded_sites Method
top_n_seeded_sites(rs::ResultSet, n::Int64; kwargs...)Get the top n seeded sites over time by their unique location id. Lower rank values are better (e.g., 1 = first choice)
Arguments
rs : ResultSet
n :
nlocations to retrievekwargs : dimensions to slice across
Returns
YAXArray[locations, [loc_id, loc_name, rank], scenarios]
sourceADRIA.metrics.trajectory_heatmap Method
trajectory_heatmap(data::YAXArray)::HeatMapEstimate heatmap of trajectories from a 2D dataset.
Arguments
- data : An N*D matrix where N is time steps and D is the scenario outcome for the given timestep in N
Returns
OnlineStats.HeatMap
sourceADRIA.metrics.trajectory_heatmap_data Method
trajectory_heatmap_data(data::YAXArray)::Tuple{Vector{Float64},Vector{Float64},Matrix{Int64}}Estimate heatmap of trajectories from a 2D dataset.
Arguments
- data : An N*D matrix where N is time steps and D is the scenario outcome for the given timestep in N
Returns
Tuple of xedges, yedges, and bi-dimensional histogram matrix
sourceBase.ndims Method
ndims(m::Metric)::Int64Infer the number of dimensions for a given outcome/metric.
sourceADRIA.metrics.Metric Method
(f::Metric)(raw, args...; kwargs...)
(f::Metric)(rs::ResultSet, args...; kwargs...)Makes Metric types callable with arbitrary arguments that are passed to associated function.
sourcePerformance indicators
ADRIA.performance.environmental_diversity Method
environmental_diversity(ms, inputs_i)Obtain an indication of environmental factor diversity for a scenario set. Higher values indicate a greater of mix of environmental conditions were experienced between scenarios.
This is referred to as
Arguments
ms : model spec
inputs_i : inputs used for scenarios of interest
ADRIA.performance.gmd Method
gmd(vals::AbstractVector{<:Real})::Float64
gmd(vals::AbstractMatrix{<:Real})Gini's Mean Difference.
The absolute mean of all pairwise distances between elements in a given set.
References
La Haye, R., & Zizler, P. (2019). The Gini mean difference and variance. METRON, 77(1), 43-52. https://doi.org/10.1007/s40300-019-00149-2
Yitzhaki, S. (2003). Gini's Mean difference: A superior measure of variability for non-normal distributions. Metron - International Journal of Statistics, LXI(2), 285-316. https://ideas.repec.org/a/mtn/ancoec/030208.html
Kashif, M., Aslam, M., Al-Marshadi, A. H., & Jun, C.-H. (2016). Capability Indices for Non-Normal Distribution Using Gini's Mean Difference as Measure of Variability. IEEE Access, 4, 7322-7330. https://doi.org/10.1109/ACCESS.2016.2620241
ADRIA.performance.intervention_diversity Method
intervention_diversity(ms, inputs_i)Obtain an indication of intervention diversity for a scenario. Higher values indicate a greater of mix of interventions options were applied.
This is referred to as
Arguments
ms : model spec
inputs_i : inputs used for scenarios of interest
ADRIA.performance.intervention_effort Method
intervention_effort(ms, inputs_i)Obtain an indication of intervention effort for each scenario and intervention type. This is referred to as
Arguments
ms : model spec
inputs_i : inputs used for scenarios of interest
Returns
Matrix of s * 8, where s is the number of scenarios and columns are: N_seed_TA, N_seed_CA, N_seed_CNA, N_seed_SM, N_seed_LM, fogging, SRM, seed_years, shade_years, fog_years
ADRIA.performance.normalize Method
normalize(vals::AbstractArray{<:Real})Normalize values using feature scaling such that values are bound between 0 and 1, where 1 is equivalent to the maximum value found.
sourceADRIA.performance.probability Method
probability(vals::AbstractArray{<:Real})Calculate probability of individual trajectories, given a scenario ensemble
ADRIA.performance.temporal_variability Method
temporal_variability(x::AbstractVector{<:Real})
temporal_variability(x::AbstractArray{<:Real, 2})
temporal_variability(x::AbstractArray{<:Real}, func_or_data...)The V meta-metric.
As a meta-metric, it can be applied to any combination of metrics (including itself), assuming
Examples
# Apply V to a time series
julia> temporal_variability(rand(50))
# Apply V to an ensemble of time series
julia> x = rand(50, 200)
julia> temporal_variability(x)
# Create and apply a modified V metric to an ensemble of time series.
# Where the argument is an array and not a function, the data is used directly
# and so it is assumed all matrices are of the same size and shape.
julia> temporal_variability(x, temporal_variabilty, temporal_variability(P(x)))
julia> temporal_variability(x, temporal_variabilty, P(x), D(x), E(x))Sensitivity
ADRIAanalysis.sensitivity._category_bins Method
_category_bins(foi_spec::DataFrame)::Int64Get number of bins for categorical variables.
Arguments
foi_spec: Model specification for factors of interest
Returns
Number of bins relevant to the factor of interest
sourceADRIAanalysis.sensitivity._create_seq_store Method
_create_seq_store(model_spec::DataFrame, unordered_cat::Vector{Symbol}, S::Int64)::Dict{Symbol,Vector{Float64}}Get stored bin sequences for each factor type.
Arguments
model_spec: Model specification, as extracted byADRIA.model_spec(domain)or from aResultSetunordered_cat: Factors considered for sensitivity analysis of unordered categorical type.S: Number of bins.
Returns
A dictionary containing bin sequences for each factor
sourceADRIAanalysis.sensitivity._foi_data_stores Method
_foi_data_stores(
seq_store::Dict{Symbol,Vector{Float64}},
m_spec::DataFrame,
unordered_cat::Vector{Symbol};
second_dim::NamedTuple
)::DatasetGenerate data stores of correct size for each factor of interest.
Arguments
seq_store: Dictionary for storing bin sequences (created by_create_seq_store)m_spec: Model specificationunordered_cat: List of unordered categorical variables.second_dim: second storage dimension (e.g. (CI=["mean","lower","upper"], ))
Returns
Dataset containing storage for sensitivity ranges for each factor.
sourceADRIAanalysis.sensitivity._get_cat_quantile Method
_get_cat_quantile(foi_spec::DataFrame, factor_name::Symbol, steps::Vector{Float64})::Vector{Float64}Get quantiles for a given categorical variable.
Arguments
foi_spec: Model specification for factors of interestfactor_name: Contains true where the factor is categorical and false otherwisesteps: Number of steps for defining bins
Returns
Quantile for a categorical factor.
sourceADRIAanalysis.sensitivity._get_factor_quantile Method
_get_factor_quantile(seq_store::Dict{Symbol,Vector{Float64}}, foi_spec::DataFrame, fact_t::Symbol)Checks the type of the factor to calculate its quantile.
Arguments
seq_store: storage containing bin sequences for factors consideredfoi_spec: Model specification for factors of interestX_f: Scenario dataframe for factor of interestfactor_name: Contains true where the factor is categorical and false otherwise
Returns
Quantile for factor fact_t, given bin sequences in seq_store
ADRIAanalysis.sensitivity._get_factor_spec Method
_get_factor_spec(model_spec::DataFrame, factors::Vector{Symbol})::DataFrameGet model spec for specified factors.
Arguments
model_spec: Model specification, as extracted byADRIA.model_spec(domain)or from aResultSetfactors: Factors considered for sensitivity analysis
ADRIAanalysis.sensitivity._map_outcomes Method
_map_outcomes(y::AbstractVecOrMat{<:Real}, rule::Union{BitVector,Vector{Int64}})::Union{BitVector,Vector{Int64}}
_map_outcomes(y::AbstractVecOrMat{<:Real}, rule::Function)::Vector{Int64}Apply rule to create mapping between
Note
Where the rule is a vector indicating true/false, the y argument is ignored. The function accepts the y argument simply to maintain compatibility so the same method name can be applied.
Arguments
y: Model outputs/outcomesrule: BitVector, or Function that returns a BitVector, indicating outcomes that meet some desired threshold/behavior.
ADRIAanalysis.sensitivity.convergence Method
convergence(X::DataFrame, y::YAXArray, target_factors::Vector{Symbol}; n_steps::Int64=10)::YAXArray
convergence(rs::ResultSet, X::DataFrame, y::YAXArray, components::Vector{String}; n_steps::Int64=10)::YAXArrayCalculates the PAWN sensitivity index for an increasing number of scenarios where the maximum is the total number of scenarios in scens. Number of scenario subsets determined by N_steps. Can be calculated for individual factors or aggregated over factors for specified model components.
Arguments
rs: Result set (only needed if aggregating over model components).X: Model inputsy: Model outputstarget_factors: Names of target factors represented by columns inX.components: Names of model components to aggregate over (e.g. [:Intervention, :Criteria]).n_steps: Number of steps to cut the total number of scenarios into.
Returns
YAXArray, of min, lower bound, mean, median, upper bound, max, std, and cv summary statistics for an increasing number of scenarios.
sourceADRIAanalysis.sensitivity.ks_statistic Method
ks_statistic(ks)Calculate the Kolmogorov-Smirnov test statistic.
sourceADRIAanalysis.sensitivity.outcome_map Method
outcome_map(p::YAXArray, X_q::AbstractArray, X_f::AbstractArray, y::AbstractVecOrMat{<:Real}, behave::BitVector; n_boot::Int64=100, conf::Float64=0.95)::YAXArray
outcome_map(X::DataFrame, y::AbstractVecOrMat{<:Real}, rule::Union{Function,BitVector,Vector{Int64}}, target_factors::Vector{Symbol}, model_spec::DataFrame; S::Int64=10, n_boot::Int64=100, conf::Float64=0.95)::Dataset
outcome_map(X::DataFrame, y::AbstractVecOrMat{<:Real}, rule::Union{Function,BitVector,Vector{Int64}}, target_factor::Symbol, model_spec::DataFrame; S::Int64=20, n_boot::Int64=100, conf::Float64=0.95)::YAXArray
outcome_map(X::DataFrame, y::AbstractVector{T}, rule::Union{Function,BitVector,Vector{Int64}}; S::Int64=20, n_boot::Int64=100, conf::Float64=0.95)::Dataset where {T<:Real}
outcome_map(rs::ResultSet, y::AbstractVector{T}, rule::Union{Function,BitVector,Vector{Int64}}, target_factors::Vector{Symbol}; S::Int64=20, n_boot::Int64=100, conf::Float64=0.95)::Dataset where {T<:Real}
outcome_map(rs::ResultSet, y::AbstractVector{T}, rule::Union{Function,BitVector,Vector{Int64}}, target_factor::Symbol; S::Int64=20, n_boot::Int64=100, conf::Float64=0.95)::YAXArray where {T<:Real}
outcome_map(rs::ResultSet, y::AbstractVector{T}, rule::Union{Function,BitVector,Vector{Int64}}; S::Int64=20, n_boot::Int64=100, conf::Float64=0.95)::Dataset where {T<:Real}Map normalized outcomes (defined by rule) to factor values discretized into S bins.
Produces a matrix indicating the range of (normalized) outcomes across factor space for each dimension (the model inputs). This is similar to a Regional Sensitivity Analysis, except that the model outputs are examined directly as opposed to a measure of sensitivity.
Note:
yis normalized on a per-column basis prior to the analysisEmpty areas of factor space (those that do not have any desired outcomes) will be assigned
NaN
Arguments
X: scenario specificationy: Vector or Matrix of outcomes corresponding to scenarios inXrule: a callable defining a "desirable" scenario outcometarget_factors: list of factors of interest to perform analyses onS: number of slices of factor space. Higher values equate to finer granularityn_boot: number of bootstraps (default: 100)conf: confidence interval (default: 0.95)
Returns
3-dimensional YAXArray, of shape × × 3, where:
is the slices,
is the number of dimensions, with
boostrapped mean (dim 1) and the lower/upper 95% confidence interval (dims 2 and 3).
Examples
# Get metric of interest
mu_tac = vec(mean(ADRIA.metrics.scenario_total_cover(rs), dims=:timesteps))
# Factors of interest
foi = [:SRM, :fogging, :a_adapt]
# Find scenarios where all metrics are above their median
rule = y -> all(y .> 0.5)
# Map input values where to their outcomes
ADRIAanalysis.sensitivity.outcome_map(X, y, rule, foi; S=20, n_boot=100, conf=0.95)ADRIAanalysis.sensitivity.pawn Method
pawn(rs::ResultSet, y::Union{NamedDimsArray,AbstractVector{<:Real}}; S::Int64=10)::NamedDimsArray
pawn(X::AbstractMatrix{<:Real}, y::AbstractVector{<:Real}, factor_names::Vector{String}; S::Int64=10)::NamedDimsArray
pawn(X::DataFrame, y::AbstractVector{<:Real}; S::Int64=10)::NamedDimsArray
pawn(X::NamedDimsArray, y::Union{NamedDimsArray,AbstractVector{<:Real}}; S::Int64=10)::NamedDimsArray
pawn(X::Union{DataFrame,AbstractMatrix{<:Real}}, y::AbstractMatrix{<:Real}; S::Int64=10)::NamedDimsArrayCalculates the PAWN sensitivity index.
The PAWN method (by Pianosi and Wagener) is a moment-independent approach to Global Sensitivity Analysis. Outputs are characterized by their Cumulative Distribution Function (CDF), quantifying the variation in the output distribution after conditioning an input over "slices" (
This implementation applies the Kolmogorov-Smirnov test as the distance measure and returns summary statistics (min, lower bound, mean, median, upper bound, max, std, and cv) over the slices.
Arguments
rs: ResultSetX: Model inputsy: Model outputsfactor_names: Names of each factor represented by columns inXS: Number of slides (default: 10)
Returns
YAXArray, of min, mean, lower bound, median, upper bound, max, std, and cv summary statistics.
Examples
dom = ADRIA.load_domain("example_domain", "<RCP>")
scens = ADRIA.sample(dom, 128)
rs = ADRIA.run_scenarios(dom, scens, "45")
# Get mean coral cover over time and locations
μ_tac = mean(ADRIA.metrics.scenario_total_cover(rs), dims=:timesteps)
ADRIAanalysis.sensitivity.pawn(rs, μ_tac)References
Pianosi, F., Wagener, T., 2018. Distribution-based sensitivity analysis from a generic input-output sample. Environmental Modelling & Software 108, 197-207. https://doi.org/10.1016/j.envsoft.2018.07.019
Baroni, G., Francke, T., 2020. GSA-cvd Combining variance- and distribution-based global sensitivity analysis https://github.com/baronig/GSA-cvd
Puy, A., Lo Piano, S., & Saltelli, A. 2020. A sensitivity analysis of the PAWN sensitivity index. Environmental Modelling & Software, 127, 104679. https://doi.org/10.1016/j.envsoft.2020.104679
https://github.com/SAFEtoolbox/Miscellaneous/blob/main/Review_of_Puy_2020.pdf
Extended help
Pianosi and Wagener have made public their review responding to a critique of their method by Puy et al., (2020). A key criticism by Puy et al. was that the PAWN method is sensitive to its tuning parameters and thus may produce biased results. The tuning parameters referred to are the number of samples (
Puy et al., found that the ratio of
ADRIAanalysis.sensitivity.rsa Method
rsa(X::DataFrame, y::AbstractVector{<:Real}, model_spec::DataFrame; S::Int64=10)::Dataset
rsa(r_s::YAXArray, X_q::AbstractArray, X_i::AbstractArray, y::AbstractVecOrMat{<:Real}, sel::BitVector)::YAXArray
rsa(X::Vector{Float64}, y::AbstractVector{<:Real}, foi_spec::DataFrame; S::Int64=10)::YAXArray
rsa(rs::ResultSet, y::AbstractVector{T}; S::Int64=10)::Dataset where {T<:Real}
rsa(rs::ResultSet, y::AbstractVector{T}, factors::Vector{Symbol}; S::Int64=10)::Dataset where {T<:Real}
rsa(rs::ResultSet, y::AbstractVector{T}, factor::Symbol; S::Int64=10)::YAXArray where {T<:Real}Perform Regional Sensitivity Analysis.
Regional Sensitivity Analysis is a Monte Carlo Filtering approach which aims to identify which (group of) factors drive model outputs within or outside of a specified bound. Outputs which fall inside the bounds are regarded as "behavioral", whereas those outside are "non-behavioral". The distribution of behavioral/non-behavioral subsets are compared for each factor. If the subsets are not similar, then the factor is influential. The sensitivity index is simply the maximum distance between the two distributions, with larger values indicating greater sensitivity.
The implemented approach slices factor space into
RSA can indicate where in factor space model sensitivities may be, and contributes to a Value-of-Information (VoI) analysis.
Increasing the value of
Note: Values of type missing indicate a lack of samples in the region.
Arguments
rs: ResultSetX: scenario specificationy: scenario outcomesmodel_spec: Model specification, as extracted byADRIA.model_spec(domain)or from aResultSetfactors: Specific model factors to examineS: number of bins to slice factor space into (default: 10)
Returns
Dataset
Examples
ADRIAanalysis.sensitivity.rsa(X, y; S=10)References
Pianosi, F., K. Beven, J. Freer, J. W. Hall, J. Rougier, D. B. Stephenson, and T. Wagener. 2016. Sensitivity analysis of environmental models: A systematic review with practical workflow. Environmental Modelling & Software 79:214-232. https://dx.doi.org/10.1016/j.envsoft.2016.02.008
Saltelli, A., M. Ratto, T. Andres, F. Campolongo, J. Cariboni, D. Gatelli, M. Saisana, and S. Tarantola. 2008. Global Sensitivity Analysis: The Primer. Wiley, West Sussex, U.K. https://dx.doi.org/10.1002/9780470725184 Accessible at: http://www.andreasaltelli.eu/file/repository/Primer_Corrected_2022.pdf
ADRIAanalysis.sensitivity.tsa Method
tsa(X::DataFrame, y::AbstractMatrix)::YAXArrayPerform Temporal (or time-varying) Sensitivity Analysis using the PAWN sensitivity index.
The sensitivity index value for time
Examples
rs = ADRIA.load_results("a ResultSet of interest")
# Get scenario outcomes over time (shape: `time × scenarios`)
y_tac = ADRIA.metrics.scenario_total_cover(rs)
# Calculate sensitivity of outcome to factors for each time step
ADRIAanalysis.sensitivity.tsa(rs.inputs, y_tac)Arguments
X: Scenario specificationy: scenario outcomes over time
Returns
YAXArray, of shape × 6 × , where
is the number of dimensions/factors
6 corresponds to the min, mean, median, max, std, and cv of the PAWN indices
is the number of time steps
General API
ADRIA.bin_edges Method
bin_edges()Helper function defining coral colony diameter bin edges. The values are converted from cm to the desired unit. The default target unit is cm.
ADRIA.coral_spec Method
coral_spec()Template for coral parameter values for ADRIA. Includes "vital" bio/ecological parameters, to be filled with sampled or user-specified values.
Any parameter added to the params DataFrame defined here will automatically be made available to the ADRIA model.
Notes: Values for the historical, temporal patterns of degree heating weeks between bleaching years come from [1].
Returns
params: NamedTuple[taxa_names, param_names, params], taxa names, parameter names, and parameter values for each coral taxa, group and size class
References
Lough, J. M., Anderson, K. D., & Hughes, T. P. (2018). Increasing thermal stress for tropical coral reefs: 1871-2017. Scientific Reports, 8(1), 6079. https://doi.org/10.1038/s41598-018-24530-9
Hall, V.R. & Hughes, T.P. 1996. Reproductive strategies of modular organisms: comparative studies of reef-building corals. Ecology, 77: 950 - 963. https://dx.doi.org/10.2307/2265514
Bozec, Y.-M., Rowell, D., Harrison, L., Gaskell, J., Hock, K., Callaghan, D., Gorton, R., Kovacs, E. M., Lyons, M., Mumby, P., & Roelfsema, C. (2021). Baseline mapping to support reef restoration and resilience-based management in the Whitsundays. https://doi.org/10.13140/RG.2.2.26976.20482
Bozec, Y.-M., Hock, K., Mason, R. A. B., Baird, M. E., Castro-Sanguino, C., Condie, S. A., Puotinen, M., Thompson, A., & Mumby, P. J. (2022). Cumulative impacts across Australia's Great Barrier Reef: A mechanistic evaluation. Ecological Monographs, 92(1), e01494. https://doi.org/10.1002/ecm.1494
ADRIA.create_coral_instance Function
create_coral_instance(bounds=(0.9, 1.1); overrides=Dict())Construct a Coral instance with calibrated field values without redefining the struct. Use this instead of create_coral_struct when only an instance (not a struct redefinition) is needed.
ADRIA.create_coral_struct Function
create_coral_struct(bounds=(0.9, 1.1))Generates Coral struct using the default parameter spec.
Example
# Define coral struct with auto-generated parameter ranges
# (default in ADRIA is ± 10%, triangular distribution with peak at 0.5)
create_coral_struct()
coral = Coral()
# Recreate coral spec ± 50% from nominal values
create_coral_struct((0.5, 1.5))
coral = Coral()ADRIA.env_stats Method
env_stats(rs::ResultSet, s_name::String, rcp::String)
env_stats(rs::ResultSet, s_name::String, rcp::String, scenario::Int)
env_stats(rs::ResultSet, s_name::String, stat::String, rcp::String, scenario::Int)Extract statistics for a given environmental layer ("DHW" or "wave")
sourceADRIA.loc_area Method
loc_area(rs::ResultSet)::Vector{Float64}Extract vector of a location's total area in its areal unit (m², km², etc).
sourceADRIA.loc_area Method
loc_area(domain::Domain)::Vector{Float64}Get location area for the given domain.
sourceADRIA.loc_coral_cover Method
loc_coral_cover(C_cover_t::Array{Float64,3})::Vector{Float64}Sum coral cover across all functional groups and size classes of a single timestep for each location.
sourceADRIA.loc_k_area Method
loc_k_area(rs::ResultSet)::Vector{Float64}Extract vector of a location's coral carrying capacity in terms of absolute area.
sourceADRIA.loc_k_area Method
loc_k_area(domain::Domain)::Vector{Float64}Get maximum coral cover area for the given domain in absolute area.
sourceADRIA.loc_recruits_cover Method
loc_recruits_cover(recruits::Matrix{Float64})::Vector{Float64}Absolute cover of recruits on each location.
sourceADRIA.run_scenario Method
run_scenario(domain::Domain, idx::Int64, scenario::Union{AbstractVector,DataFrameRow}, functional_groups::Vector{Vector{FunctionalGroup}}, data_store::NamedTuple)::Nothing
run_scenario(domain::Domain, scenario::Union{AbstractVector,DataFrameRow})::NamedTuple
run_scenario(domain::Domain, scenario::Union{AbstractVector,DataFrameRow}, RCP::String)::NamedTupleRun individual scenarios for a given domain, saving results to a Zarr data store. Results are stored in Zarr format at a pre-configured location. Sets up a new cache if not provided.
Arguments
domain: Simulation domain (may be modified viaswitch_RCPs!).idx: Scenario index, to store results intodata_store.scenario: Parameter row describing the scenario.functional_groups: Preallocated functional group buffers.data_store: Pre-opened store with arrays to write results into.
Returns
Nothing
sourceADRIA.select Method
select(r::ResultSet, op::String)Hacky scenario filtering - to be replaced with more robust approach.
Only supports filtering by single attribute. Should be expanded to support filtering metric results too.
Examples
select(result, "guided .> 0.0")
# Above expands to:
# result.inputs.guided .> 0.0ADRIA.timesteps Method
timesteps(rs::ResultSet)Retrieve the time steps represented in the result set.
Arguments
rs: ResultSet
ADRIA.timesteps Method
timesteps(outcomes::YAXArray)::Vector{Int64}Extract time step labels from a YAXArray. Returns an empty Vector{Int64} if the array has no :timesteps dimension.
ADRIA.ADRIADomain Type
ADRIADomain{Σ,M,I,D,X,Y,Z}Core ADRIA domain. Represents study area.
sourceADRIA.Domain Method
Domain(name::String, rcp::String, timeframe::Vector, location_data_fn::String, location_id_col::String, cluster_id_col::String, init_coral_fn::String, conn_path::String, dhw_fn::String, wave_fn::String, cyclone_mortality_fn::String)::DomainConvenience constructor for Domain.
Arguments
name: Name of domaindpkg_path: location of data packagercp: RCP scenario representedtimeframe: Time steps representedlocation_data_fn: File name of spatial data usedlocation_id_col: Column holding name of reef the location is associated with (non-unique)cluster_id_col: Column holding unique cluster names/idsinit_coral_fn: Name of file holding initial coral cover valuesconn_path: Path to directory holding connectivity datadhw_fn: Filename of DHW data cube in usewave_fn: Filename of wave data cubecyclone_mortality_fn: Filename of cyclone mortality data cube
ADRIA.Domain Method
Barrier function to create Domain struct without specifying Intervention/Criteria/Coral/SimConstant parameters.
sourceADRIA.SimConstants Type
SimConstantsStruct of simulation constants for ADRIA
References
Lough, J. M., Anderson, K. D., & Hughes, T. P. (2018). Increasing thermal stress for tropical coral reefs: 1871-2017. Scientific Reports, 8(1), 6079. https://doi.org/10.1038/s41598-018-24530-9
Hughes, T. P., Kerry, J. T., Baird, A. H., Connolly, S. R., Dietzel, A., Eakin, C. M., Heron, S. F., Hoey, A. S., Hoogenboom, M. O., Liu, G., McWilliam, M. J., Pears, R. J., Pratchett, M. S., Skirving, W. J., Stella, J. S., & Torda, G. (2018). Global warming transforms coral reef assemblages. Nature, 556(7702), 492-496. https://doi.org/10.1038/s41586-018-0041-2
Bozec, Y.-M., Rowell, D., Harrison, L., Gaskell, J., Hock, K., Callaghan, D., Gorton, R., Kovacs, E. M., Lyons, M., Mumby, P., & Roelfsema, C. (2021). Baseline mapping to support reef restoration and resilience-based management in the Whitsundays. https://doi.org/10.13140/RG.2.2.26976.20482
Bozec, Y.-M., Hock, K., Mason, R. A. B., Baird, M. E., Castro-Sanguino, C., Condie, S. A., Puotinen, M., Thompson, A., & Mumby, P. J. (2022). Cumulative impacts across Australia's Great Barrier Reef: A mechanistic evaluation. Ecological Monographs, 92(1), e01494. https://doi.org/10.1002/ecm.1494