# Diagnostics

`CryoGrid.Diagnostics.active_layer_thickness`

โ Method`active_layer_thickness(T::AbstractDimArray{<:TempQuantity})`

Computes active layer thickness annually. The active layer thickness is defined here as the maximum thaw depth throughout the calendar year. Assumes `T`

to have dimensions `Ti`

(time) and `Z`

(depth) in any order.

`CryoGrid.Diagnostics.computejac`

โ Method`computejac(tile::Tile, u, p, t)`

Helper function that computes the Jacobian of the given `tile`

at `u`

with parameters `p`

and time `t`

.

`CryoGrid.Diagnostics.integrate`

โ Method`integrate(X::AbstractDimArray, grid::Grid{Edges}; upper_limit=0u"m", lower_limit=10u"m")`

Integrates the quantity `X`

over the given `grid`

, which is assumed to be spatially alligned, i.e. `length(grid) == length(dims(X,Z)) + 1`

and `cells(grid) .โ dims(X,Z)`

are necessary preconditions.

`CryoGrid.Diagnostics.mean_annual_ground_temperature`

โ Method`mean_annual_ground_temperature(T::AbstractDimArray; upper_limit=0u"m", lower_limit=10u"m")`

Computes mean annual ground temperature between `upper_limit`

and `lower_limit`

. Assumes `T`

to have dimensions `Ti`

(time) and `Z`

(depth) in any order.

`CryoGrid.Diagnostics.permafrostbase`

โ Method`permafrostbase(T::AbstractDimArray{<:TempQuantity})`

Computes depth of permafrost base for all years, i.e. the closest depth to the "bottom" at which the maximum annual temperature is strictly `< 0ยฐC`

. Assumes `T`

to have dimensions `Ti`

(time) and `Z`

(depth) in any order.

`CryoGrid.Diagnostics.permafrosttable`

โ Method`permafrosttable(T::AbstractDimArray{<:TempQuantity})`

Computes depth of permafrost table for all years, i.e. the closest depth to the surface at which the maximum annual temperature is strictly less than `Tmelt`

. Assumes `T`

to have dimensions `Ti`

(time) and `Z`

(depth) in any order.

`CryoGrid.Diagnostics.spinup`

โ Method`spinup(setup::Tile, tspan::NTuple{2,DateTime}, p, tol, layername; kwargs...)`

Implements a simple, iterative spin-up procedure. Runs the model specified by `setup`

over `tspan`

until the profile mean up to `maxdepth`

over the whole time span changes only within the given tolerance `tol`

. Returns the `ODESolution`

generated by the final iteration.

`CryoGrid.Diagnostics.thawdepth`

โ Method`thawdepth(T::AbstractDimArray{<:TempQuantity}; Tmelt=0.0u"ยฐC")`

Computes sub-grid thaw depth (a.k.a freezing front) from temperature at all time steps. The sub-grid depth of the zero degree isotherm is determined by linearly interpolating between grid cell temperatures in `T`

. Note that `T`

is assumed to have units ยฐC and dimensions `Ti`

(time) and `Z`

(depth) in any order.

`CryoGrid.Diagnostics.zero_annual_amplitude`

โ Method`zero_annual_amplitude(T::AbstractDimArray{<:TempQuantity}; threshold=0.5u"K")`

Computes annual depth of zero amplitude (where `|max - min| < threshold`

) and returns the result for each year. Assumes `T`

to have dimensions `Ti`

(time) and `Z`

(depth) in any order.