pattern correlation: is exemple in function escorc correct ?

From: Ileana Blade <ileanablade_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 17 2010 - 10:22:56 MST

Sorry if this has been posted but I searched the archives and didn't
find anything. I am having trouble with exemple 8 in function escorc
to compute weighted pattern correlations.

===============

Example 8
To obtain the weighted pattern correlations between two grids (grid1
and grid2) of dimension (time,lat,lon) where ntim is the number of
different grids.

Let wgt(lat) be the gaussian weights or the cosine-of-latitude.

      wNew = ndtooned(conform(grid1, wgt, 2) )
      r = new ( ntim, typeof(grid1) )

      do nt=0,ntim-1
        r(nt) =
escorc(ndtooned(grid1(nt,:,:))*wNew,ndtooned(grid2(nt,:,:))*wNew)
      end do
====================

But this will weigh the correlation with cos(lat) x cos(lat) instead
of simply cos(lat).

Besides, there is no way that function escorc can properly compute the
weighted area average (when computing the anomalies) since the weights
are not passed as weights but as part of the variable to be correlated.

Interestingly the solution provided for 2D fields, in post http://www.ncl.ucar.edu/Support/talk_archives/2008/0133.html
is correct, I think. The mean, the covariance and standard deviations
are all weighted by cos(lat), but this requires several steps and not
just one call to the correlation function escorc.

I could be wrong but function scorr in GRADS (which computes weighted
spatial correlations) agrees with me.

===================
> wgt = cos(rad*XLAT) ; wgt[*][*]
>
>
> xAvgArea = x*wgt/sum(wgt) ; weighted area average
> yAvgArea = y*wgt/sum(wgt) **
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml
>
>
> xAnom = x - xAvgArea ; anomalies
> yAnom = y - yAvgArea
>
> covxy = *sum*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/
sum.shtml>(xAnom*yAnom*wg
> t) ; weighted anomaly covariance
>
> r = covxy/( *sqrt*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/
sqrt.shtml>(*sum*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/
sum.shtml>(wgt*xAnom^2))
> **sqrt* <http://www.ncl.ucar.edu/Document/Functions/Built-in/sqrt.shtml
>(*sum*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/
sum.shtml>(wgt*yAnom^2))

-----------------------------------

  Ileana Bladé

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 17 10:23:19 2010

This archive was generated by hypermail 2.1.8 : Mon Dec 06 2010 - 09:18:10 MST