From: Ibraheem Khan <khan18_at_nyahnyahspammersnyahnyah>

Date: Thu, 25 Jun 2009 14:00:44 -0500 (CDT)

Date: Thu, 25 Jun 2009 14:00:44 -0500 (CDT)

Hi David,

I am using following script to calculate the point time series correlation with the time series grid data. But no output is turning up. Can you or anyone look at it to point out anything missing.

Thanks

Script:

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

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

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

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

begin

;**********************************************

; Reading Data and correlation function

;**********************************************

f1 = addfile("6104_01.nc","r")

f2 = addfile("avg_6104_01.nc","r")

x1 = f1->a ;time series grid data

x2 = f2->a ;point time series

print(x1)

print(x2)

st = dim_standardize_Wrap(x2,1)

printVarSummary(st)

c = escorc(x1(lat|:,lon|:,time|:),x2)

copy_VarCoords(x1(0,:,:),c)

printVarSummary(c)

;**********************************************

; create plot

;*********************************************

wks = gsn_open_wks ("x11","cor_prcp_01") ; open ps file

gsn_define_colormap(wks,"radar")

res = True

res_at_gsnDraw = False

res_at_cnFillOn = True

res_at_cnLinesOn = False

res_at_gsnSpreadColors = True

res_at_lbAutoLabelStride = True

res_at_cnLevelselectionMode = "ManualLevels" ; manually set cn levels

res_at_cnMinLevelValF = -1. ; min level

res_at_cnMaxLevelValF = 1. ; max level

res_at_tiMainString = ":F25:Prcp Point Corr"

res_at_gsnLeftString = " "

res_at_tiMainFontHeightF = 0.03

res_at_gsnAddCyclic = False

;printVarSummary(c)

plot = gsn_csm_contour_map_ce(wks,c,res)

end

-Ibraheem

----- Original Message -----

From: "Dave Allured" <dave.allured_at_noaa.gov>

To: ncl-talk_at_ucar.edu

Sent: Wednesday, June 24, 2009 8:58:50 PM GMT -06:00 US/Canada Central

Subject: Re: question

Ibraheem,

Point to grid correlation is easy. At each grid point, just compute

the correlation between the single point time series and the time

series for the grid point. The output from this is a single grid of

correlation numbers. Just plot this field, using any generic

contour plot function from NCL.

How do you define correlation between two unequal regions? There

are various definitions. First you need to have a good mathematical

description of what you want, independent from any programming

considerations.

One definition is a simple cross correlation where single grid

points at matching coordinates are correlated. If the regions are

different sizes, then this makes a plot that is only the size of the

small region, and blank in the remainder of the large region. This

is the third example on the correlation example page:

http://www.ncl.ucar.edu/Applications/corel.shtml

Another definition is to reduce the small region to a single time

series by a method of your choice, such as weighted or unweighted

averaging. Then compute and plot the gridded correlation of the

average time series to the larger region, similar to the single

point case.

Yet another definition is to start at one grid point in the larger

region, and compute independent correlations to each point in the

smaller region. Then combine the resulting correlation numbers to a

single number by your choice of method, such as taking the mean or

median. Repeat over all grid points of the larger region, and once

again you have a single grid of numbers to plot in the usual way.

Once you have decided on the definition, NCL has good matrix

capability to help with the computations.

Dave Allured

CU/CIRES Climate Diagnostics Center (CDC)

http://cires.colorado.edu/science/centers/cdc/

NOAA/ESRL/PSD, Climate Analysis Branch (CAB)

http://www.cdc.noaa.gov/psd1/

Ibraheem Khan wrote:

*> Hi,
*

*>
*

*> I am thinking about drawing a correlation map. The correlation must be between a point value and gridded data. Also a correlation between two unequal gridded datasets (one covering a small region and the other a larger domain). Is it possible to do both correlations?
*

*> Thanks
*

*>
*

*> -Ibraheem
*

*>
*

*>
*

*> _______________________________________________
*

*> ncl-talk mailing list
*

*> List instructions, subscriber options, unsubscribe:
*

*> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
*

_______________________________________________

ncl-talk mailing list

List instructions, subscriber options, unsubscribe:

http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________

ncl-talk mailing list

List instructions, subscriber options, unsubscribe:

http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu Jun 25 2009 - 13:00:44 MDT

*
This archive was generated by hypermail 2.2.0
: Mon Jun 29 2009 - 10:19:05 MDT
*