Documentation of reg_obs_onto_BPppcs


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


Help text

  Load variables for regression

Cross-Reference Information

This script calls

Listing of script reg_obs_onto_BPppcs


clear
cd ~/Papers/mlcsiro/matlab/obs/data
load nmc_svd_sst_slp_ndjfma.mat; dofilt = 1;

lims = [89 306 -79 79]
tim = 121:624;

cd /home/disk/tao/data/nmc.reanalysis/monthly
[slp, lat, lon] = getnc2('slp.mon.mean.nc', 'slp', lims, 1, tim);
[tax, lat, lon] = getnc2('uwnd.mon.mean.nc', 'uwnd', lims, 925, tim);
tax = squeeze(tax);
[tsu, lat, lon] = getnc2('air.mon.mean.sfc.nc', 'air', lims, 1, tim);
load slp_5x5_deg_ave.mat
lims = [89 306 -79 79]
cd /home/disk/tao/data/nmc.reanalysis
lm = getnc2('landmask.nc', 'lsmask', lims, 1, 1);
lm(lm == -1) = NaN;

[ntim, nlat, nlon] = size(slp);
[xk, yk] = keep_var(limslp, lon_5x5, lat_5x5);
slp_5x5 = slp_5x5(tim,yk,xk);

slp2 = annave(slp);
tax2 = annave(tax);
tsu2 = annave(tsu);
slp_5x5 = annave(slp_5x5);

%  Regress out cold tongue index
nlat1 = length(yk); nlon1 = length(xk);
noct = 0;
if noct;
  ctlim = [180 270 -6 6];
  [ctx, cty] = keep_var(ctlim, lon, lat);
  ct = tsu2(:, cty, ctx);
  ct = squeeze(mean(mean(shiftdim(ct, 1))));
  ct = (ct - mean(ct))./std(ct);
  slp_5x5 = reshape(slp_5x5, ntim, nlat1*nlon1);
  a1 = ct'*slp_5x5 / ntim;
  slp_5x5 = slp_5x5 - ct*a1;
  slp2 = reshape(slp2, ntim, nlat*nlon);
  tax2 = reshape(tax2, ntim, nlat*nlon);
  tsu2 = reshape(tsu2, ntim, nlat*nlon);
  a1 = ct'*slp2 ./ ntim; slp2 = slp2 - ct*a1;
  a1 = ct'*tax2 ./ ntim; tax2 = tax2 - ct*a1;
  a1 = ct'*tsu2 ./ ntim; tsu2 = tsu2 - ct*a1;
  slp2 = reshape(slp2, ntim, nlat, nlon);
  tax2 = reshape(tax2, ntim, nlat, nlon);
  tsu2 = reshape(tsu2, ntim, nlat, nlon);  
end

%  Reweight patterns by sqrt(cos...)
tem = reshape(slpu', 20, nlat1, nlon1);
tem = cosweight(tem, lat(yk));
tem = reshape(tem, 20, nlat1*nlon1)';
use_tim = tem(:,1:10);

%  2-12 mo
[b, a] = butter(9, 2/12);

slp = slp2 - filtfilt(b, a, slp2);
tax = tax2 - filtfilt(b, a, tax2);
tsu = tsu2 - filtfilt(b, a, tsu2);
use_slp = slp_5x5 - filtfilt(b, a, slp_5x5);

tim_hp = reshape(use_slp, ntim, nlat1*nlon1) * use_tim;

[pat1aa, c1aa] = regress_eof(slp, tim_hp);
[pat2aa, c2aa] = regress_eof(tax, tim_hp);
[pat3aa, c3aa] = regress_eof(tsu, tim_hp);

%  12-24 mo
[b2, a2] = butter(9, 2/12);
[b, a] = butter(9, 2/24);

slp = filtfilt(b2, a2, slp2) - filtfilt(b, a, slp2);
tax = filtfilt(b2, a2, tax2) - filtfilt(b, a, tax2);
tsu = filtfilt(b2, a2, tsu2) - filtfilt(b, a, tsu2);
use_slp = filtfilt(b2, a2, slp_5x5) - filtfilt(b, a, slp_5x5);

tim_bp = reshape(slp(:,yk,xk), ntim, nlat1*nlon1) * use_tim;

timind = [25:480];
[pat1bb, c1bb] = regress_eof(slp(timind,:,:), tim_bp(timind,1));
[pat2bb, c2bb] = regress_eof(tax(timind,:,:), tim_bp(timind,1));
[pat3bb, c3bb] = regress_eof(tsu(timind,:,:), tim_bp(timind,1));

%  24-Inf mo
[b, a] = butter(9, 2/24);

slp = filtfilt(b, a, slp2);
tax = filtfilt(b, a, tax2);
tsu = filtfilt(b, a, tsu2);
use_slp = filtfilt(b, a, slp_5x5);

tim_lp = reshape(slp(:,yk,xk), ntim, nlat1*nlon1) * use_tim;

timind = [25:480];
[pat1cc, c1cc] = regress_eof(slp(timind,:,:), tim_lp(timind,1));
[pat2cc, c2cc] = regress_eof(tax(timind,:,:), tim_lp(timind,1));
[pat3cc, c3cc] = regress_eof(tsu(timind,:,:), tim_lp(timind,1));

cd ~/Papers/mlcsiro/matlab/data
save OBS_hp_bp_lp_ppcs_regs.mat tim_hp tim_bp tim_lp ...
    pat1aa c1aa pat2aa c2aa pat3aa c3aa ...
    pat1bb c1bb pat2bb c2bb pat3bb c3bb ...
    pat1cc c1cc pat2cc c2cc pat3cc c3cc ...
    lims limslp xk yk lat lon 
    

%  Plot data
default_global; FRAME = [95 300 -45 75];
global GRDX_SPACING GRDY_SPACING
GRDX_SPACING = 45; GRDY_SPACING = 20;
  
figure(2); fl(1); clf;
clim = 0.25;
subplot(3,3,1);
  gcont(pat1aa, 0.5);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c1aa.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SLP >  0.5 mb std^-^1');
  y1 = ylabel('2-12 Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
%  h = drawbox(limslp, 'k'); set(h, 'linewidth', 2);
subplot(3,3,2);
  gcont(pat2aa, 0.5, 1);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c2aa.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, U >  0.5 m s^-^1 std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,3);
  gcont(pat3aa, 0.05);
  dc2(lm, 0.3, 1000);
  color_shade(squeeze(c3aa.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SST >  0.05 K std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);

subplot(3,3,4);
  gcont(pat1bb, 0.25);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c1bb.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SLP >  0.25 mb std^-^1');
  y1 = ylabel('12-24 Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,5);
  gcont(pat2bb, 0.25, 1);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c2bb.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, U >  0.25 m s^-^1 std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,6);
  gcont(pat3bb, 0.05);
  dc2(lm, 0.3, 1000);
  color_shade(squeeze(c3bb.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SST >  0.05 K std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);

subplot(3,3,7);
  gcont(pat1cc, 0.25);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c1cc.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SLP >  0.25 mb std^-^1');
  y1 = ylabel('24-Inf Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,8);
  gcont(pat2cc, 0.25, 1);
  dc2(lm, 0.3, -1000);
  color_shade(squeeze(c2cc.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, U >  0.25 m s^-^1 std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,9);
  gcont(pat3cc, 0.05);
  dc2(lm, 0.3, 1000);
  color_shade(squeeze(c3cc.^2), clim, 0.7*[1 1 1]);
  t1 = title('< ML\_SLP, SST >  0.05 K std^-^1');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);


cd ~/Papers/mlcsiro/matlab/obs/Figs
print -dps2 HP_BP_LP_SLP_TX_SLP_pslpx_OBS_noct.ps
  




default_global; FRAME = [95 300 -45 75];
global GRDX_SPACING GRDY_SPACING
GRDX_SPACING = 45; GRDY_SPACING = 20;
  
figure(3); fl(1); clf;
clim = 0.2;
subplot(3,3,1);
  gcont(c1aa, clim);
  dc2(lm, 0.3, -1000);
  t1 = title('Corr:  < ML\_SLP, SLP >');
  y1 = ylabel('2-12 Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
%  h = drawbox(limslp, 'k'); set(h, 'linewidth', 2);
subplot(3,3,2);
  gcont(c2aa, clim, 0);
  dc2(lm, 0.3, -1000);
  t1 = title('Corr:  < ML\_SLP, U >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,3);
  gcont(c3aa, clim);
  dc2(lm, 0.3, 1000);
  t1 = title('Corr:  < ML\_SLP, SST >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);

subplot(3,3,4);
  gcont(c1bb, clim);
  dc2(lm, 0.3, -1000);
  t1 = title('Corr:  < ML\_SLP, SLP >');
  y1 = ylabel('12-24 Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
%  h = drawbox(limslp, 'k'); set(h, 'linewidth', 2);
subplot(3,3,5);
  gcont(c2bb, clim, 0);
  dc2(lm, 0.3, 1000);
  t1 = title('Corr:  < ML\_SLP, U >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,6);
  gcont(c3bb, clim);
  dc2(lm, 0.3, 1000);
  t1 = title('Corr:  < ML\_SLP, SST >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);

subplot(3,3,7);
  gcont(c1cc, clim);
  dc2(lm, 0.3, -1000);
  t1 = title('Corr:  < ML\_SLP, SLP >');
  y1 = ylabel('24-Inf Mo.'); set(y1, 'fontsize', 9);
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
%  h = drawbox(limslp, 'k'); set(h, 'linewidth', 2);
subplot(3,3,8);
  gcont(c2cc, clim, 0);
  dc2(lm, 0.3, 1000);
  t1 = title('Corr:  < ML\_SLP, U >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);
subplot(3,3,9);
  gcont(c3cc, clim);
  dc2(lm, 0.3, 1000);
  t1 = title('Corr:  < ML\_SLP, SST >');
  set(gca, 'fontsize', 8); set(t1, 'fontsize', 9);