Documentation of get_udtdx


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


Function Synopsis

[ubtp, uptb, lat_out, lon_out, depth_out] = get_udtdx(pcs, lims, lags, lev, tim);

Help text


  [ubtp, uptb, lat_out, lon_out, depth_out] = ...
       get_udtdx(pcs, lims, lags, lev, tim);


Cross-Reference Information

This function calls This function is called by

Listing of function get_udtdx

function [ubtp, uptb, lat_out, lon_out, depth_out] = get_udtdx(pcs, lims, lags, lev, tim);

if length(lev) > 1;
  error('length(lev) > 1 not supported');
end

cdtem = ['cd ' pwd];

u = getnc('u', lims, lev, tim);
[latu, lonu, depthu] = getll('u', lims);

t = getnc('temp', lims, lev, tim);
[latt, lont, deptht] = getll('temp', lims);

[u, ubar] = remove_mean(u/100);
[t, tbar] = remove_mean(t);
ubar = squeeze(ubar); tbar = squeeze(tbar);
u = squeeze(u); t = squeeze(t);

ureg = regress_eof(u, pcs, lags);
treg = regress_eof(t, pcs, lags);

%  Get dtdx

global RADIAN

szt = size(treg)
treg = (treg(:,1:(szt(2)-1),:) + treg(:,2:szt(2),:))/2;
tbar = (tbar((1:szt(2)-1),:) + tbar(2:szt(2),:))/2;
latr = (latt(1:(szt(2)-1)) + latt(2:szt(2)))/2;

[dtdxb, lon2] = sph_gradx1(tbar, RADIAN * latr, RADIAN * lont, 0);
for i = 1:szt(1);
  dtdxp(i,:,:) = sph_gradx1(squeeze(treg(i,:,:)), RADIAN * latr, RADIAN * lont, 0);
  ubtp(i,:,:) = ubar .* squeeze(dtdxp(i,:,:));
  uptb(i,:,:) = dtdxb .* squeeze(ureg(i,:,:));
end

lon_out = lonu;
lat_out = latu;
depth_out = depthu(lev);