Documentation of vert_ubtp_uptb


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


Function Synopsis

[ubtp, uptb] = vert_ubtp_uptb(pcs, lims, lags);

Help text


  [ubtp, uptb] = vert_ubtp_uptb(pcs, lims, lags);


Cross-Reference Information

This function calls This function is called by

Listing of function vert_ubtp_uptb

function [ubtp, uptb] = vert_ubtp_uptb(pcs, lims, lags);

cdtem = ['cd ' eval('pwd')];

%cd ~/matlab/CSIRO/Thesis/Data
%load LP9_detrend_L1-7_EOF_yr101-1000.mat

tim = 101:1000;
temp = getnc('temp', lims, 1:10, tim);
u = getnc('u', lims, 1:10, tim);
u = 1e-2*u;

[latt, lont, deptht] = getll('temp', lims);
[latu, lonu] = getll('u', lims);

tbar = squeeze(mean(temp));
ubar = squeeze(mean(u));

temp = detrend(temp);
u = detrend(u);
treg = regress_eof(temp, pcs, lags);
ureg = regress_eof(u, pcs, lags);

%  Get dtdx

[nlev, nlat, nlon] = size(tbar);
tbar2 = (tbar(:,1:(nlat-1),:) + tbar(:,2:nlat,:))/2;
[nlev, nlat, nlon] = size(tbar2);

global DEGREE RADIAN RADUS
for lind = 1:nlev;
  tx = squeeze(tbar2(lind, :, :));
  [dtdx(lind,:,:) temlat] = sph_gradx1(tx, RADIAN*latu, RADIAN*lont, 0);
end

nlag = size(ureg, 1);
for i = 1:nlag;
  uptb(i,:,:,:) = squeeze(ureg(i,:,:,:)) .* dtdx;
end

%  Get ubtp

[nlag, nlev, nlat, nlon] = size(treg);
treg2 = (treg(:,:,1:(nlat-1),:) + treg(:,:,2:nlat,:))/2;
[nlag, nlev, nlat, nlon] = size(treg2);

clear dtdx
global DEGREE RADIAN RADUS
for i = 1:nlag;
  for lind = 1:nlev;
    tx = squeeze(treg2(i, lind, :, :));
    [dtdx(i,lind,:,:) temlat] = sph_gradx1(tx, RADIAN*latu, RADIAN*lont, 0);
  end
end

for i = 1:nlag;
  ubtp(i,:,:,:) = squeeze(dtdx(i,:,:,:)) .* ubar;
end

eval(cdtem);