Documentation of hoffmoeller_corr_plot


Global Index (short | long) | Local contents | Local Index (short | long)


Help text

  Plot the lagged correlation coefficient for various depths

Cross-Reference Information

This script calls

Listing of script hoffmoeller_corr_plot


clear
ct = getnc('temp', [180 270 -6 6], 1, 101:1000);
ct = squeeze(mean(mean(ct, 2), 3));
ct = detrend(ct) ./ std(detrend(ct));
ct2 = getnc('temp', [180 270 -6 6], 1:10, 101:1000);
[tem, tem, depth] = getll('temp', [180 270 -6 6]);
ct2 = squeeze(mean(mean(ct2, 3), 4));
ct2 = ct2';
newlev = [12.5 100 200 300 400 500]'; nlev = length(newlev);
clear tem;
for i = 1:900;
  tem(:,i) = interp1(depth, ct2(:,i), newlev);
end;
ct2 = tem';
ct2 = detrend(ct2);
tx = getnc('taux', [150 210 -6 6], 1, 101:1000);
tx = squeeze(mean2(mean2(shiftdim(tx, 1))));
tx = detrend(tx);
lev = 5:10;
tim = 101:1000;
lims1 = [150 180 -35 35];
hc1 = getheat(lims1, lev, tim);
hc1 = squeeze(mean2(shiftdim(hc1, 2)));
[lat1, lon1, depth] = getll('temp', lims1);
lims2 = [100 290 -3 3];
hc2 = getnc('temp', lims2, 1, tim);
hc2 = shiftdim(squeeze(mean2(shiftdim(hc2, 1))), 1);
[lat2, lon2] = getll('temp', lims2);
[tem, tem, depth2] = getll('wl', lims2);
hc1 = detrend(hc1);
hc2 = detrend(hc2);
for ind = 4:4;
  if ind == 1;
    [b2, a2] = butter(9, 2/10);
    hc1f = hc1 - filtfilt(b2, a2, hc1);
    hc2f = hc2 - filtfilt(b2, a2, hc2);
    ctf = ct - filtfilt(b2, a2, ct);
    ct2f = ct2 - filtfilt(b2, a2, ct2);
    txf = tx - filtfilt(b2, a2, tx);
    xlim = [-7 7];
    xtint = 2;
    tit = '10 yr HP';
  elseif ind == 2;
    [b1, a1] = butter(9, 2/9);
    [b2, a2] = butter(9, 2/21);
    hc1f = filtfilt(b1, a1, hc1) - filtfilt(b2, a2, hc1);
    hc2f = filtfilt(b1, a1, hc2) - filtfilt(b2, a2, hc2);
    ctf = filtfilt(b1, a1, ct) - filtfilt(b2, a2, ct);
    ct2f = filtfilt(b1, a1, ct2) - filtfilt(b2, a2, ct2);
    txf = filtfilt(b1, a1, tx) - filtfilt(b2, a2, tx);
    xlim = [-10 10];
    xtint = 2;
    tit = '10-20 yr BP';
  elseif ind == 3;
    [b1, a1] = butter(9, 2/19);
    [b2, a2] = butter(9, 2/61);
    hc1f = filtfilt(b1, a1, hc1) - filtfilt(b2, a2, hc1);
    hc2f = filtfilt(b1, a1, hc2) - filtfilt(b2, a2, hc2);
    ctf = filtfilt(b1, a1, ct) - filtfilt(b2, a2, ct);
    ct2f = filtfilt(b1, a1, ct2) - filtfilt(b2, a2, ct2);
    txf = filtfilt(b1, a1, tx) - filtfilt(b2, a2, tx);
    xlim = [-30 30];
    xtint = 5;
    tit = '20-60 yr BP';
  elseif ind == 4;
    [b2, a2] = butter(9, 2/9);
    hc1f = filtfilt(b2, a2, hc1);
    hc2f = filtfilt(b2, a2, hc2);
    ctf = filtfilt(b2, a2, ct);
    ct2f = filtfilt(b2, a2, ct2);
    txf = filtfilt(b2, a2, tx);
    xlim = [-60 60];
    xtint = 10;
    tit = '60 yr LP';
  end
lags = -60:60;
[reg1, c1] = regress_eof(hc1f, ctf, lags);
[reg2, c2] = regress_eof(hc2f, ctf, lags);
figure(ind); figure_landscape(1);
subplot(2,1,1);
contourf(lags, lat1, c1', [-1:.05:1]);
shading flat
caxis([-1*max(max(abs(c1))) max(max(abs(c1)))])
hold on;
pncont(lags, lat1, c1', [-1:.1:1], 0, 'k');
hold off;
hold on;
hline([-3 3], '--k', [-60 60])
hold off
set(gca, 'YTick', -60:15:60, 'XTick', -60:xtint:60)
box on
axis([xlim -30 30]);
xlabel('Contour Interval:  0.1')
ylabel('150E to 180');
colorbar2
title([tit ':  Correlation between 117-620m Heat Content and CT index']);
subplot(2,1,2);
contourf(lags, lon2, c2', [-1:.05:1]);
shading flat
hold on
pncont(lags, lon2, c2', [-1:.1:1], 0, 'k');
hold off
hold on
hline([150 180], '--k', [-60 60])
hold off
caxis([-1*max(max(abs(c2))) max(max(abs(c2)))])
set(gca, 'YTick', [120:30:270], 'XTick', -60:xtint:60);
axis([xlim 115 270.1])
xlabel('Contour Interval:  0.1')
ylabel('3S to 3N')
colorbar2
title([tit ':  Correlation between SST and CT index']);
end;

nlag = length(lags);
ct_corr = NaN * ones(nlev+1, nlag);
for i = 1:nlag;
  for j = 1:nlev;
    ct_corr(j, i) = corr(ct2f(:,j), ctf, lags(i));
  end
  ct_corr(nlev+1, i) = corr(txf, ctf, lags(i));
end
  
subplot(2,1,2);
  h1 = plot(...
    lags, ct_corr(1, :), '-k', ...
    lags, ct_corr(2, :), '--k', ...
    lags, ct_corr(3, :), '.-k', ...
    lags, ct_corr(4, :), 'o--k', ...
    lags, ct_corr(5, :), '+--k', ...
    lags, ct_corr(6, :), 'v:k', ...
    lags, ct_corr(7, :), 'x--k');
  set(h1([1 7]), 'linewidth', 2);
  axis([xlim -0.6 1.1])
  set(gca, 'YTick', [-1:.2:1]);
  grid on;
  title([tit ':  Correlation between Surface CT, and CT index at various depths']);
  ylabel('Correlation Coefficient');
  xlabel('Lag in Years');
  legend(h1, '12.5m', '100m', '200m', '300m', '400m', '500m', 'TAUX');
end

cd ~/pub/david/CSIRO