Re: question

From: Ibraheem Khan <khan18_at_nyahnyahspammersnyahnyah>
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.


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"

; Reading Data and correlation function
        f1 = addfile("","r")
        f2 = addfile("","r")
        x1 = f1->a ;time series grid data
        x2 = f2->a ;point time series
        st = dim_standardize_Wrap(x2,1)
        c = escorc(x1(lat|:,lon|:,time|:),x2)

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

  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
  plot = gsn_csm_contour_map_ce(wks,c,res)


----- Original Message -----
From: "Dave Allured" <>
Sent: Wednesday, June 24, 2009 8:58:50 PM GMT -06:00 US/Canada Central
Subject: Re: question


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

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:

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)
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)

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:
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
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