Re: correlating two arrays

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 25 Jan 2008 15:46:04 -0700

Erik Noble wrote:
> Dear Dennis.
> Thank you for this.
> If I am not concerned about weight, (i.e. Small region), then I should
> proceed with example 5?
>
Yes
> I notice that example 8 does not use the escorc function at all.
>
True, but I knew I'd be asked questions on areal weighted
pattern correlation, so I put it under escorc so I could
point people to something.
> -Erik
>
> On 1/21/08 7:59 PM, "Dennis Shea" <shea_at_ucar.edu> wrote:
>
>
>> Assuming you want a areal weighted pattern correlation, see Example 8
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/escorc.shtml
>>
>>
>> The "wgt" variable in this example is assumed to be the cos latitude
>>
>> lat(lat)
>> rad = 4.*atan(1.)/180.
>> wgt = cos(rad*lat)
>>
>> Then proceed as in example 8
>> ===============================
>> If the lat/lon arrays are 2D, say, XLAT, XLONG
>>
>>
>> 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))
>> )
>>
>>
>> Erik Noble wrote:
>>
>>> Hi.
>>>
>>> I have two 2D arrays:
>>>
>>>
>>>>> whos Model1
>>>>>
>>>>>
>>> Name Size Bytes Class Attributes
>>>
>>> Model1 30x79 18960 double
>>>
>>>
>>>
>>>>> whos Obs
>>>>>
>>>>>
>>> Name Size Bytes Class Attributes
>>>
>>> Obs 30x79 18960 double
>>>
>>> I want to correlate these two arrays. Which set of NCL functions does this?
>>>
>>>
>>
>>
>
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 25 2008 - 15:46:04 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 28 2008 - 17:01:44 MST