Documentation of get_wbtp


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


Function Synopsis

[wdtdz, lat_out, lon_out, depth_out] = ...

Help text


  [wbtp, lat_out, lon_out, depth_out] = ...
          get_wbar_dtprimedz(pcs, lims, nfrm, tim, lev);


Cross-Reference Information

This function calls This function is called by

Listing of function get_wbtp

function [wdtdz, lat_out, lon_out, depth_out] = ...
          get_wbar_dtprimedz(pcs, lims, nfrm, tim, lev);

%lims = [117.5 169 7.5 24];
if nargin == 1;
  lims = [110 300 -60 60]; nfrm = 6; tim = 101:550; lev = 1;
elseif nargin == 2;
  nfrm = 6; tim = 101:550; lev = 1;
elseif nargin == 3;
  tim = 101:550; lev = 1;
elseif nargin == 4;
  lev = 1;
end

if length(lev) > 1; 
  error('Single levels only')
end;

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

cd /home/disk/hayes2/dvimont/csiro/data

%  First, get wbar

[wbar, we] = getnc('wl', 'we', lims, lev, tim);
[latw, lonw, depthw] = getll('wl', lims);
wbar = squeeze(mean(wbar))/1e6;
we = squeeze(mean(we))/1e6;
wbar = wbar + we;

%  Now get tprime

temp = getnc('temp', lims, [lev lev+1], tim);
[latt, lont, deptht] = getll('temp', lims);
[temp, tbar] = remove_mean(temp);
[ntim, nlev, nlat, nlon] = size(temp);

%  Assume PCS are sent in the command line

%cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
%load LP10_L1-7_CEOF.mat; tit = 'Lowpass Filtered Data ( > 10 Years )';
%load HP8_L1-7_CEOF.mat; tit = 'Highpass Filtered Data ( < 8 Years )';
%load RAW_L1-7_CEOF.mat; tit = 'Unfiltered Data';

%  Get regressions

if isreal(pcs);
  treg = regress_eof(temp, pcs, nfrm);
else
  treg = regress_ceof(temp, pcs, nfrm);
end
[nfrm, nlev, nlat, nlon] = size(treg);

%  First, get dtdz
%  Interpolate to depthw, which is closer to temz.  This makes a smoother
%    interpolation, and will hopefully be more exact.

dz = diff(deptht([lev lev+1]));
temz = deptht(lev) + 0.5*dz;
dtdz = squeeze(diff(treg, 1, 2))./dz;
nlev = nlev - 1;

%  Get wdtdz

for i = 1:nfrm;
  wdtdz(i,:,:) = -1 * squeeze(dtdz(i,:,:)) .* wbar;
end

lat_out = latw;
lon_out = lonw;
depth_out = depthw(lev);

eval(cdtem);