# [ncl-talk] Area averaging not being done in patter_cor function.

Dennis Shea shea at ucar.edu
Fri Apr 15 07:47:43 MDT 2016

```I guess I do not understand the issue..

x(nlat,lon) and y(nlat,mlon) and weights, wgt(nlat,mlon). Assorted pattern
correlations are computed via

wgt = 1.0
ra  = *pattern_cor*(x, y, wgt, 0)    ; no weighting, centered

[1] If (say) you have 100 points all weighted 1.0: sumWGT=100

[2] sum(x*WGT) = sum(x);  (nlat,mlon)

[3] xAvgArea = sum(x)/sumWGT ==> overall average for (say) 100 points

so no ... "if my weight is 1 it is simply the sum of the array not the area
average"

It is the overall average ... not the "sum if the array"

===
Maybe I am misunderstanding the issue.

On Fri, Apr 15, 2016 at 4:44 AM, Shilpa Malviya <shilpamalviya123 at gmail.com>
wrote:

> Hi,
>
> When we call pattern_cor function it then calls pattern_cor2 function to
> compute the pattern correlation. I n case of centered correlation area
> averaging is done , the code is as below
>
>       sumWGT   = sum(WGT)
>       xAvgArea = sum(x*WGT)/sumWGT      ; weighted area average
>       yAvgArea = sum(y*WGT)/sumWGT
>
>       xAnom    = x - xAvgArea           ; anomalies
>       yAnom    = y - yAvgArea
>
> if my weight is 1 it is simply the sum of the array not the area
> average.This may lead to wrong results.
>
> Is it because of this that when I perform centered averaging I get values
> of the order of 0.6 and when uncentered then 0.9.
>
> Regards,
> Shilpa Malviya
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160415/2c52c8bc/attachment.html
```