pyPDAF.PDAF.diag_diffstats

pyPDAF.PDAF.diag_diffstats(dim_p: int, vec1: np.ndarray, vec2: np.ndarray, verbose: int) np.ndarray

Compare two vectors with Taylor-diagram style statistics.

The routine compares two fields on the filter communicator. A common use is comparing observations with the corresponding observed model or ensemble-mean values. The returned statistics separate pattern agreement from mean offset: correlation and standard deviations describe centered variability, centered RMSD describes shape mismatch after removing the means, while bias and mean absolute deviation measure non-centered differences vec1 - vec2.

Parameters:
  • dim_p (int) – Number of process-local vector entries to compare. PDAF combines the local contributions over the filter communicator.

  • vec1 (ndarray[np.float64, ndim=1]) – First vector. In observation diagnostics this is typically the observation vector y. The array shape is (dim_p,).

  • vec2 (ndarray[np.float64, ndim=1]) – Second vector. In observation diagnostics this is typically the observed ensemble mean Hx. The array shape is (dim_p,).

  • verbose (int) – Verbosity flag. If greater than zero, PDAF prints the statistics.

Returns:

stats – Six-element statistics vector:

stats[0]

Pearson correlation between anomalies of vec1 and vec2. This is the Taylor-diagram correlation.

stats[1]

Centered RMS deviation, i.e. RMS of (vec1 - mean(vec1)) - (vec2 - mean(vec2)).

stats[2]

Bias mean(vec1) - mean(vec2).

stats[3]

Mean absolute deviation mean(abs(vec1 - vec2)).

stats[4]

Standard deviation of vec1.

stats[5]

Standard deviation of vec2.

The correlation and the two standard deviations are the usual quantities shown in Taylor diagrams.

Return type:

ndarray[np.float64, ndim=1]