# iris.analysis.stats¶

Statistical operations between cubes.

In this module:

iris.analysis.stats.pearsonr(cube_a, cube_b, corr_coords=None, weights=None, mdtol=1.0, common_mask=False)

Calculate the Pearson’s r correlation coefficient over specified dimensions.

Args:

• cube_a, cube_b (cubes):
Cubes between which the correlation will be calculated. The cubes should either be the same shape and have the same dimension coordinates or one cube should be broadcastable to the other.
• corr_coords (str or list of str):
The cube coordinate name(s) over which to calculate correlations. If no names are provided then correlation will be calculated over all common cube dimensions.
• weights (numpy.ndarray, optional):
Weights array of same shape as (the smaller of) cube_a and cube_b. Note that latitude/longitude area weights can be calculated using iris.analysis.cartography.area_weights().
• mdtol (float, optional):
Tolerance of missing data. The missing data fraction is calculated based on the number of grid cells masked in both cube_a and cube_b. If this fraction exceed mdtol, the returned value in the corresponding cell is masked. mdtol=0 means no missing data is tolerated while mdtol=1 means the resulting element will be masked if and only if all contributing elements are masked in cube_a or cube_b. Defaults to 1.