Documentation of project_windstress


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


Help text

load heat_pcs_eq.mat

Cross-Reference Information

This script calls

Listing of script project_windstress


clean
clear
cd /home/disk/tao/dvimont/matlab/CSIRO/New_calcs2/data
load heat_pcs.mat

lims = [89 306 -80 80];
taux = getnc('taux', lims, 1, 101:1000);
[lat, lon] = getll('taux', lims);

taux = detrend(taux);

[b, a] = butter(9, 2/12);
htx = taux - filtfilt(b, a, taux);

[b, a] = butter(9, 2/10);
ltx = filtfilt(b, a, taux);

lagh = -6:6;
[hpat, hc] = regress_eof(htx, hpcs, lagh);

lagl = -12:12;
[lpat, lc] = regress_eof(ltx, lpcs, lagl);

cd /home/disk/tao/dvimont/matlab/CSIRO/New_calcs2/data
save taux_regression_HP_LP.mat hpat hc lpat lc lims lat lon lagh lagl


%  Start with previously done calc
clean

cd /home/disk/tao/dvimont/matlab/CSIRO/New_calcs2/data
load taux_regression_HP_LP.mat

%  Define constants
He = 0.8;
Hf = 270;
g = 9.8;
c = sqrt(g*He);
global OMEGA RADUS;
beta = 2*OMEGA/RADUS;
T = (c*beta)^(-1/2);
L = (c/beta)^(1/2);

y = (pi/180*RADUS*lat)/L;
expfun = exp(-0.5*y.^2);

%  Start with Kelvin wave
n = 0;

pcfun = hermite(y, n);
pcfun = 2^(-n/2)*pcfun.*expfun;
pcfun = pcfun./sqrt(pcfun'*pcfun);

patdx = squeeze(hpat);
[nlag, nlat, nlon] = size(patdx);
projkh = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projkh(i, j) = pcfun(ind1)'*pat(ind1)./length(ind1);
  end
end

%  First Rossby
n = 1;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(hpat);
[nlag, nlat, nlon] = size(patdx);
projrh1 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrh1(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Second Rossby
n = 3;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(hpat);
[nlag, nlat, nlon] = size(patdx);
projrh3 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrh3(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Third Rossby
n = 5;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(hpat);
[nlag, nlat, nlon] = size(patdx);
projrh5 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrh5(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Fourth Rossby
n = 7;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(hpat);
[nlag, nlat, nlon] = size(patdx);
projrh7 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrh7(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end


%  Do lowpass filtered
%  Start with Kelvin wave
n = 0;

pcfun = hermite(y, n);
pcfun = 2^(-n/2)*pcfun.*expfun;
pcfun = pcfun./sqrt(pcfun'*pcfun);

patdx = -squeeze(lpat);
[nlag, nlat, nlon] = size(patdx);
projkl = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projkl(i, j) = pcfun(ind1)'*pat(ind1)./length(ind1);
  end
end

%  First Rossby
n = 1;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = -squeeze(lpat);
[nlag, nlat, nlon] = size(patdx);
projrl1 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrl1(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Second Rossby
n = 3;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = -squeeze(lpat);
[nlag, nlat, nlon] = size(patdx);
projrl3 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrl3(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Third Rossby
n = 5;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(lpat);
[nlag, nlat, nlon] = size(patdx);
projrl5 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrl5(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end

%  Fourth Rossby
n = 7;

pcfun_p1 = hermite(y, n+1);
pcfun_p1 = 2^(-(n+1)/2)*pcfun_p1.*expfun;
pcfun_p1 = pcfun_p1./sqrt(pcfun_p1'*pcfun_p1);
pcfun_m1 = hermite(y, n-1);
pcfun_m1 = 2^(-(n-1)/2)*pcfun_m1.*expfun;
pcfun_m1 = pcfun_m1./sqrt(pcfun_m1'*pcfun_m1);

patdx = squeeze(lpat);
[nlag, nlat, nlon] = size(patdx);
projrl7 = NaN*ones(nlag, nlon);

for i = 1:nlag;
  for j = 1:nlon;
    pat = squeeze(patdx(i,:,j))';
    ind1 = find(~isnan(pat));
    projrl7(i, j) = (2*n+1)^(-1) * ...
      (n*pcfun_p1(ind1)'*pat(ind1)/length(ind1) - ...
      sqrt(n*(n+1))*pcfun_m1(ind1)'*pat(ind1)/length(ind1));
  end
end



cd /home/disk/tao/dvimont/matlab/CSIRO/New_calcs2/data
save HP_LP_tau_wave_proj.mat projkh projkl projrh1 projrl1 ...
    projrh3 projrl3 projrh5 projrl5 projrh7 projrl7 ...
    lat lon lagh lagl lims