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

Jothi Ganesh Shanmuga Sundaram joshanmugasundaram at mix.wvu.edu
Thu Feb 11 20:19:25 MST 2016


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","r")
p = f->rf(:,{10:30},{60:81})            ; Define precipitation variable

; Calculate spearman correlation
cor =spcorr(p,sst)


Thanks
Jothi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160211/a73923fa/attachment.html 


More information about the ncl-talk mailing list