NCL Website header
NCL Home > Documentation > Functions > General applied math, Statistics


Calculates statistics needed for the Taylor Diagram: pattern_correlation, ratio and bias.

Available in version 6.5.0 and later.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

	function taylor_stats (
		t [*][*] : numeric,  
		r [*][*] : numeric,  
		w        : numeric,  
		opt  [1] : integer   

	return_val [3] or [9] :  float or double



Test array. The array is expected to be (nominally) shaped as (ny,nx) or (nlat,mlon).


Reference array. This must be the same size, shape and ordering as (t).


A scalar, or array containing the spatial weights to be used.

  • if w[1] (eg, 1.0) then all (t) and (r) values will get the same weight. The effect is no spatial weighting.
  • if w[*], then the t and t the arrays are rectilinear.
  • if w[*][*], then the t and r the arrays are curvilinear.


Integer flag indicating which values should be returned. In each case, the return is a one-dimensional array:

  • iopt=0: (/pattern_correlation,ratio, bias/)
  • iopt=1: (/pattern_correlation,ratio, bias, tmean, rmean, tvar, rvar, rmse /)
    • tmean, rmean: area weighted means
    • tvar, rvar: area weighted variances
    • rmse: area weighted mean root-mean-square error grid-point differences


For the classic Taylor Diagram (Karl, 2005), the pertinent statistics are the weighted centered pattern correlation(s) (pattern_cor) and the ratio(s) of the normalized root-mean-square (RMS) differences between 'test' dataset(s) and 'reference' dataset(s). An additional bias statistic, may be added to the classic Taylor Diagram. The pattern_corrrelations and ratios are calculated as described in the references. The bias is calculated as follows:

   bias = (mean_test - mean_reference)/mean_reference)*100    ; bias [%]
Taylor diagram examples 7b and 8 show the bias being plotted.


   Taylor, K.E. (2001):  Summarizing multiple aspects of model performance in a single diagram
   JGR, vol 106, no. D7, 7183-7192, April 16, 2001.

   Taylor, K.E. (2005):  Taylor Diagram Primer 
   A brief 4-page overview which summarizes the important aspects of these useful plots.

See Also

pattern_cor, wgt_areaave, wgt_areaave2, wgt_arearmse, wgt_arearmse2


See: Taylor diagram examples 7 and 8. These illustrate handling multiple variables and cases.

Example 1: Let X(nlat,mlon) and R(nlat,mlon) represent (say) climatologies and be on rectilinear grids.

      ;w = 1.0             ; scalar     ==> no weighting
       w = gwt             ; gw(nlat)   ==> gaussian weights
      ;w = clat            ; clat(nlat) ==> cos(rad*lat) 

       tay_stat = taylor_stats(X, R, w, 0)  ; tay_stat(3)
       tay_stat = taylor_stats(X, R, w, 1)  ; tay_stat(8)

Example 2: Let X(nlat,mlon) and R(nlat,mlon) represent (say) an ensemble member and a reference field on curvilinear grid.

      ;w = 1.0             ; scalar          ==> no weighting
       w = area            ; area(nlat,mlon) 
      ;w = clat            ; clat(nlat,mlon) ==> cos(rad*lat2d) 

       tay_stat = taylor_stats(X, R, w, 0)  ; tay_stat(3)
       tay_stat = taylor_stats(X, R, w, 1)  ; tay_stat(8)