function correlations = computeCorrelationsFromSST2(X,Y,data)

dimX = size(data,1);
dimY = size(data,2);
totalnodes = dimX*dimY;

node = (X-1)*dimY +Y;
correlations = zeros(dimX,dimY);

%%First of all check if the node is on land, if so just return a
%%100x100 matrix
for node1 = 1 : totalnodes   
    if(node1 ~= node)        
        if(mod(node1,dimY)==0)
            node1_row = node1/dimY;
            node1_col = dimY;
        else
            node1_row = floor(node1/dimY)+1;
            node1_col = mod(node1,dimY);
        end;
        %%again check if node1 is on land
        if(data(node1_row,node1_col,1) == 100)
            correlations(node1_row,node1_col) = 100;
        else
            corr = corrcoef(data(X,Y,:), data(node1_row,node1_col,:));
            correlations(node1_row,node1_col) = (corr(1,2));
            %%cellA = data(X,Y,:); cellA = cellA(:,:);
            %%cellB = data(node1_row,node1_col,:); cellB = cellB(:,:);
            %%correl = corr(cellA',cellB','type','spearman');
            %%correlations(node1_row,node1_col) = correl;
        end;
        %%correlations(node1_row,node1_col) = data(node1_row,node1_col,1);
    end;    
end;




end
