[ncl-talk] spearman correlation - combining ascii and gridded netcdf

Jack Ogaja jack.ogaja at gmail.com
Fri Feb 12 03:55:52 MST 2016


The function “spcorr()” require arguments of the same size. From your description, the statements "sst = asciiread("sst",-1,"float") “ and "p = f->rf(:,{10:30},{60:81})” will give you arrays of sizes “d1” and “d1xd2xd3” (or 1-dimensional and 3-dimensional arrays) respectively.

Jack

> On 12 Feb 2016, at 04:19, Jothi Ganesh Shanmuga Sundaram <joshanmugasundaram at mix.wvu.edu> wrote:
> 
> Hello,
> 
> I would like to calculate spearman correlation between a variable in a text file (annual SST time series) with another variable in gridded netcdf file (annual rainfall time series). I want to calculate correlation for every grid in the rainfall data with the same time series of SST in a text file. I try something like below and not successful. Is this possible to do in NCL? Please advice.
> 
> 
> ; text file with SST time series - one column of data, for example annual SST 1981 to 2010, 30 time step - 30 rows in text file
> sst = asciiread("sst",-1,"float") 
> 
> ; gridded netcdf file - annual precipitation over globe for the period 1981-2010. which means every grid will have 30 time step
> f = addfile("rf.nc <http://rf.nc/>","r")                
> p = f->rf(:,{10:30},{60:81})            ; Define precipitation variable
> 
> ; Calculate spearman correlation
> cor =spcorr(p,sst)  
> 
> 
> Thanks
> Jothi
> _______________________________________________
> 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/20160212/9174e05d/attachment.html 


More information about the ncl-talk mailing list