# PDAF_diag_ensstats

This page documents the routine `PDAF_diag_ensstats`

of PDAF, which was introduced with PDAF V1.12.

This routine computes the higher-order ensemble statistics (skewness and kurtosis).

Inputs are the ensemble array and the state vector about which the statistics are computed (usually the ensemble mean). In addition, the index of the element has to be specified for which the statistics are computed. If this is 0, the mean statistics over all elements are computed. The definition used for kurtosis follows that used by Lawson and Hansen, Mon. Wea. Rev. 132 (2004) 1966.

The routine can be called in the pre/poststep routine of PDAF both before and after the analysis step to compute the ensemble statistics.

The interface is the following:

SUBROUTINE PDAF_diag_ensstats(dim, dim_ens, element, & state, ens, skewness, kurtosis, status)

with the following arguments:

`dim`

:`integer, intent(in)`

Size of state vector`dim_ens`

:`integer, intent(in)`

Ensemble size`element`

:`integer, intent(in)`

Element of state vector for which the histogram is computed. If`element=0`

, the histogram is computed over the whole state vector`state`

:`real, intent(in), dimension(dim)`

State vector`ens`

:`real, intent(in), dimension(dim, dim_ens)`

State ensemble`skewness`

:`real, intent(out)`

Skewness (third moment) of the ensemble distribution`kurtosis`

:`real, intent(out)`

Kurtosis (fourth moment) of the ensemble distribution`status`

:`integer, intent(out)`

Status flag

An example of using `PDAF_diag_ensstats`

can be found in the Lorenz-96 model example (see testsuite/src/lorenz96/compute_truermse.F90).