Obtaining the events metrics
Key metrics
The key metrics for MHWs or MCSs as defined by Hobday et al. are contained in a constant const Metrics which is a dictionary of key-value pairs.
These metrics are calculated from the Events which is passed in as an argument to meanmetrics and annualmetrics.
Obtaining the trend requires the output from annualmetrics.
Calculating the metrics
MarineHeatwaves.meanmetrics — Function
meanmets = meanmetrics(evt, mhw_date)Return the mean of the metrics in each pixel.
MarineHeatwaves.annualmetrics — Function
annualmets = annualmetrics(evt, mhw_date, evst)Compute the metrics for each year in the desired period.
MarineHeatwaves.linreg — Function
a, b, r2, sigma_a, sigma_b, sigma_e = linreg(x,y)Linear regression
y ≈ a + b * x
Multi-dimensional linear regression
y ≈ a + X ba is a scalar and b a vector
y = a + X b + ϵ
Σ ϵ² = (y- (a + X b))^2
y = X beta + ϵ
beta = inv(X*X') * X' * yReturning and viewing the metrics
MarineHeatwaves.mhmetrics — Function
mhcmetrics = mhmetrics(evt::Events, mhwdate, sts_ends)::MHCMetricsReturn the computed metrics - means, annuals and linear regression outputs as MHCMetrics.
MarineHeatwaves.mymetric — Function
mymetric(evt::Events{Vector{T}})::Matrix{T}Return the Events of a single pixel as a matrix
mymetric(evt, "means")::Vector{T}Return all the values of the events of a given metric as a vector.
mymetric(evt, indices, startends, mdate)::MatrixReturn the Events as a matrix to be used as a table (or dataframe).
clima = mymetric(mm::MExtreme, :clim, indices)Return the climatology mean and threshold as input array.
annual_onset = mymetric(mm::MHCMetrics, field, metric, evst, indices)
Args:
field: one of annuals, means, pvalues, coeffs, rsquared...
metric: a single metric or a tuple of metricsReturn a given mean, annual or trend metric.