Documentation of eq_tend_terms


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


Help text

  Plot all the terms
   d/dt = -adv + hflx + res
   d/dt + adv - hflx = res

Cross-Reference Information

This script calls

Listing of script eq_tend_terms


clear
cd /home/disk/tao/dvimont/matlab/CSIRO/Thesis/Data
load LP10_calif_anom_terms.mat; tit = 
load LP9_eq_ct_terms.mat; tit = ['EQ - CT'];
load LP10_gulf_stream_terms.mat; tit = ['Gulf Stream'];
load LP10_ind_through_terms.mat; tit = ['Ind. T-Flow'];
load LP10_indian_ocean_terms.mat; tit = ['Ind. Ocean'];
load LP9_np_anom2_terms.mat; tit = ['NP Cold Anom'];
load LP10_south_ocean_terms.mat; tit = ['S. Ocean Anom'];
load LP10_wpac_reg_terms.mat; tit = ['West EQ Pac'];
load LP10_s_wstp_terms.mat; tit = ['SH WSTP Anom'];
load LP10_sp_cold_terms.mat; tit = ['SP Cold Anom'];
load LP9_wstp2_terms.mat; tit = ['WSTP Anom'];
load LP10_west_eq_l1-9_tend_terms.mat
load LP10_eq_l1-9_tend_terms.mat
wbtp13 = wbtp13';
wbtp17 = wbtp17';
wptb13 = wptb13';
wptb17 = wptb17';
dhc17dt = dhc17dt';
dhc13dt = dhc13dt';
hflx = hflx';

res13 = dhc13dt + (ubtp13+vbtp13+wbtp13+uptb13+vptb13+wptb13-hflx);
res17 = dhc17dt + (ubtp17+vbtp17+wbtp17+uptb17+vptb17+wptb17-hflx);
res47 = res17 - res13;
ubtp47 = ubtp17 - ubtp13;
vbtp47 = vbtp17 - vbtp13;
wbtp47 = wbtp17 - wbtp13;
uptb47 = uptb17 - uptb13;
vptb47 = vptb17 - vptb13;
wptb47 = wptb17 - wptb13;
hc47 = hc17 - hc13;
dhc47dt = dhc17dt - dhc13dt;

figure(1); figure_orient(1);

subplot(2,1,1);
  h1 = plot(...
    nfrm, ubtp13, 'x-k', ...
    nfrm, vbtp13, 'o-k', ...
    nfrm, wbtp13, 'v-k', ...;
    nfrm, uptb13, '*--k', ...
    nfrm, vptb13, 's--k', ...
    nfrm, wptb13, '^--k', ...
    nfrm, -hflx, '>-.k', ...
    nfrm, -res13, '.:k', ...
    nfrm, -dhc13dt, 'd-.k', ...
    nfrm,    -1e-8*hc13, '-k', ...
    nfrm,    -35*taux, 'x--k');
  set(h1([8 10 11]), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 0-270m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -2 1.5]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'Ubar dHC''/dx', 'Vbar dHC''/dy', 'Wbar dHC''dz',...
             'U'' dHCbar/dx', 'V'' dHCbardy', 'W'' dHCbardz',...
             'Net Heat Flux', 'Residual', 'dHC''/dt', 'HC (scaled)');%, 'TAUX (scaled)');

cd /home/disk/tao/dvimont/matlab/CSIRO/Thesis/Chap3/Plots

%figure(2); figure_landscape(1);
subplot(2,1,2);
  h1 = plot(...
    nfrm, ubtp47, 'x-k', ...
    nfrm, vbtp47, 'o-k', ...
    nfrm, wbtp47, 'v-k', ...;
    nfrm, uptb47, '*--k', ...
    nfrm, vptb47, 's--k', ...
    nfrm, wptb47, '^--k', ...
    nfrm, -hflx, '>-.k', ...
    nfrm, -res47, '.:k', ...
    nfrm, -dhc47dt, 'd-.k', ...
    nfrm, -1e-8*hc47, '-k');%, ...;
%    nfrm,  1e8*curl2, 's--k');
%    nfrm, -35*taux, '--k')
  set(h1([10:11]), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 80-270m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -2 2.2]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'Ubar dHC''/dx', 'Vbar dHC''/dy', 'Wbar dHC''dz',...
             'U'' dHCbar/dx', 'V'' dHCbardy', 'W'' dHCbardz',...
             'Residual', 'dHC''/dt', 'HC (scaled)');%, 'TAUX (scaled)');

cd /home/disk/tao/dvimont/matlab/CSIRO/Thesis/Chap3/Plots


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Plot selected terms


%  Plot specific terms:

figure(1); figure_orient(1);

subplot(2,1,1);
  h1 = plot(...
    nfrm, -dhc13dt, 'd-.k', ...
    nfrm, vbtp13, 'o-k', ...
    nfrm, wbtp13, 'v-k', ...
    nfrm, uptb13, '*--k', ...
    nfrm, wptb13, '^--k', ...
    nfrm, -hflx, '>-.k', ...
    nfrm, -res13, '.:k', ... 
    nfrm, -1e-8*hc13, '-k', ...
    nfrm, -40*taux, 'x--k');
  set(h1(7:9), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 0-80m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -2 1.5]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'dHC''/dt', 'Vbar dHC''/dy', 'Wbar dHC''dz',...
             'U'' dHCbar/dx', 'W'' dHCbardz', ...
             'Net Heat Flux', 'Residual', 'HC (scaled)', 'TAUX (scaled)');

subplot(2,1,2);
  h1 = plot(...
    nfrm, -dhc47dt, 'd-.k', ...
    nfrm, ubtp47, 'x-k', ...
    nfrm, wbtp47, 'v-k', ...
    nfrm, uptb47, '*--k', ...
    nfrm, wptb47, '^--k', ...
    nfrm, -res47, '.:k', ... 
    nfrm, -1e-8*hc47, '-k');
  set(h1(6:7), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 80-270m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -1 2.5]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'dHC''/dt', 'Ubar dHC''/dx', 'Wbar dHC''dz', ...
             'U'' dHCbar/dx', 'W'' dHCbardz', ...
             'Residual', 'HC (scaled)');

cd /home/disk/tao/dvimont/Thesis/Chap3



figure(1); figure_orient(1);

subplot(2,1,1);
  h1 = plot(...
    nfrm, -dhc17dt, 'd-.k', ...
    nfrm, ubtp17, 'x-k', ...
    nfrm, wbtp17, 'v-k', ...
    nfrm, uptb17, '*--k', ...
    nfrm, wptb17, '^--k', ...
    nfrm, -hflx, '>-.k', ...
    nfrm, -res17, '.:k', ... 
    nfrm, -1e-8*hc17, '-k');
  set(h1(7:8), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 0-270m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -2 3.5]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'dHC''/dt', 'Vbar dHC''/dy', 'Wbar dHC''dz',...
             'U'' dHCbar/dx', 'W'' dHCbardz', ...
             'Net Heat Flux', 'Residual', 'HC (scaled)')

subplot(2,1,2);
  h1 = plot(...
    nfrm, -dhc47dt, 'd-.k', ...
    nfrm, ubtp47, 'x-k', ...
    nfrm, vbtp47, 'o-k', ...
    nfrm, wptb47, '^--k', ...
    nfrm, -res47, '.:k', ...
    nfrm, -1e-8*hc47, '-k', ...
    nfrm,  1e8*curl2, 's--k');
  set(h1(5:7), 'linewidth', 2);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title(['LP9:  ' tit ' 0-270m Integrated Heat Content Tendency Terms']);
  axis([-10 10 -1.75 1.5]);
  set(gca, 'XTick', -20:2:20);
  legend(h1, 'dHC''/dt', 'Ubar dHC''/dx', 'Vbar dHC''/dy', ...
             'W'' dHCbardz', ...;%'Net Heat Flux', 
             'Residual', 'HC (scaled)', '-1 x CURL(TAU) (scaled)');


cd /home/disk/tao/dvimont/Thesis/Chap3








%  Plot the data;

ubtp = -1*(ubtp13 + vbtp13 + wbtp13);
uptb = -1*(uptb13 + vptb13 + wptb13);

figure(1);
subplot(2,1,1);
  h1 = plot(...
       nfrm, ubtp, 'x--k', ...
       nfrm, uptb, 'o--k', ...
       nfrm, hflx, 'v--k', ...
       nfrm, dhc13dt, 'd-.k', ...
       nfrm, 1.5e-8*hc13, '-k');
  axis([-10 10 -2 2]);
  grid on
  xlabel('Lag (in years)');
  ylabel('W m^-^2');
  title('0-80m Integrated Heat Content Anomaly Tendency Terms');
  legend(h1, 'Ubar Grad(T'')', 'U'' Grad(Tbar)', 'Net Heat Flux',...
             'dHC/dt', 'HC (scaled)');



%  Look at heat content and wind stress only

clear

%  Load PCS:

cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
load LP10_detrend_L1-7_yr101-1000.mat
load RAW_detrend_L1-7_EOF_yr101-1000.mat
pcs = -1*pcs;

lev = 1:3;
lims = [178 272 -3 3]; 
nfrm = -25:25;
tim = 101:1000;

hc13 = getheat(1:3, tim, lims);
hc46 = getheat(4:6, tim, lims);
hc79 = getheat(7:9, tim, lims);
sst = getnc('temp', lims, 1, tim);
taux = getnc('taux', [165 210 -3 3], 1, tim);
[lat, lon, depthw] = getll('wl', lims);

[tem, hc13] = regress_eof(hc13, pcs, nfrm);
[tem, hc46] = regress_eof(hc46, pcs, nfrm);
[tem, hc79] = regress_eof(hc79, pcs, nfrm);
[tem, sst] = regress_eof(sst, pcs, nfrm);
[tem, taux] = regress_eof(taux, pcs, nfrm);

hc13 = squeeze(mean(mean(shiftdim(hc13, 1))));
hc46 = squeeze(mean(mean(shiftdim(hc46, 1))));
hc79 = squeeze(mean(mean(shiftdim(hc79, 1))));
sst = squeeze(mean(mean(shiftdim(sst, 1))));
taux = squeeze(mean(taux, 2));

taux2 = 1.8 * taux2 / max(taux2);
sst2 = 1.6 * sst2 / max(sst2);
h13 = 1.4 * h13 / max(h13);
h46 = 1.2 * h46 / max(h46);
h79 = 1.0 * h79 / max(h79);


figure(1); figure_landscape;
h1 = plot(...
   nfrm, hc79, ':k',  ...
   nfrm, hc46, '--k', ...
   nfrm, hc13, '-.k', ...
   nfrm, sst, 'o-k', ...
   nfrm, taux, 'x-k');
axis([-15 15 -1 2])
set(gca, 'XTick', [-20:2:20]);
grid on
title(['Lagged Regression (scaled) of Various Equatorial Indices on PC1 ' ...
       'of 0-270m Heat Content']); 
xlabel('Lag in Years');
ylabel('Scaled Regression Coefficient');
legend(h1, '210-470m Heat Content', '80-210m Heat Content', ...
           '0-80m Heat Content', '12.5m Temperature', ...
           'Zonal Wind Stress')

cd /home/disk/tao/dvimont/matlab/CSIRO/Heat/GRL_Figs



%  Look at each level individually

clear

lev = 1:3;
lims = [178 272 -3 3]; 
nfrm = -25:25;
tim = 101:1000;

%  Get CT index

ct = getnc('temp', lims, 1, tim);
%ct = getheat([178 272 -6 6], 1:7, tim);
%ct = getheat([110 150 0 15], 4:7, tim);
ct = squeeze(mean2(mean2(shiftdim(ct, 1))));
ct = detrend(ct);
[b, a] = butter(6, 2/10);
ct = filtfilt(b, a, ct);
pcs = ct./std(ct);

%  Load PCS:

cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
load LP10_detrend_L1-7_yr101-1000.mat
load RAW_detrend_L1-7_EOF_yr101-1000.mat
pcs = -1*pcs;

[lat, lon, depth] = getll('temp', lims);
temp = getnc('temp', lims, 1:10, tim);
temp = squeeze(mean(mean(temp, 3),4));
taux = getnc('taux', [150 210 -6 6], 1, tim);
taux = squeeze(mean2(mean2(shiftdim(taux, 1))));

temp = filtfilt(b, a, detrend(temp));
taux = filtfilt(b, a, detrend(taux));

%  As a doublecheck, band pass this.  Note that when this is done,
%    the resulting plot has everything phase shifted.  There is no
%    contemporaneous beginning at lag -6, as is the case when only
%    a lowpass filter is used.

[b, a] = butter(6, 2/15);
  temp = temp - filtfilt(b, a, temp);
  taux = taux - filtfilt(b, a, taux);
  pcs = pcs - filtfilt(b, a, pcs);

[tem, tcoef] = regress_eof(temp, pcs, nfrm);
[tem, xcoef] = regress_eof(taux, pcs, nfrm);

clear tcoef2;
newdepth = [0:50:400];
for i = 1:length(nfrm);
  tcoef2(i,:) = interp1(depth, tcoef(i,:), newdepth);
end
tcoef2(:,1) = tcoef(:,1);

figure(1); fo; clf;
spthes(1);
h1 = plot(...
  nfrm, tcoef2(:,1), '-k', ...
  nfrm, tcoef2(:,3), '*-k', ...
  nfrm, tcoef2(:,5), '^-k', ...
  nfrm, tcoef2(:,7), 's-k', ...
  nfrm, tcoef2(:,9), 'v-k', ...
  nfrm, xcoef, 'x--k');
set(h1([1 6]), 'linewidth', 2);
%hold on;
%h2 = plot(...
%  nfrm, tcoef2(:,8), '-k', ...
%  nfrm, tcoef2(:,6), '-k', ...
%  nfrm, tcoef2(:,4), '-k', ...
%  nfrm, tcoef2(:,2), '-k')
%hold off

axis([-10 10 -.5 1.1]);
grid on
set(gca, 'XTick', [-20:2:20], 'YTick', [-0.5:.25:1]);
%title(['Lagged Correlation between EQ Temp at various depths, and PC1 ' ...
%       'of LP10 HC270']); 
xlabel('Lag in Years');
ylabel('Correlation Coefficient');
legend(h1, 'SST', '100m', '200m', '300m', '400m', ...
           '  \tau_X');

cd ~/Thesis/Chap4
cd /home/disk/tao/dvimont/matlab/CSIRO/Heat/GRL_Figs


  nfrm, tcoef(:,9), 'v-k', ...
  nfrm, tcoef(:,2), '<-k', ...
  nfrm, tcoef(:,1), 'o-k', ...





cd /home/disk/tao/dvimont/matlab/CSIRO/Thesis/Data
load LP9_detrend_L1-7_EOF_yr101-1000.mat

   taux = getnc('taux', [165 210 -3 3], 1, tim);
   taux = regress_eof(taux, pcs, nfrm);
   taux = squeeze(mean2(taux'));


res19 = -dhc19dt - (ubtp19+vbtp19+wbtp19+uptb19+vptb19+wptb19-hflx);
res17 = -dhc17dt - (ubtp17+vbtp17+wbtp17+uptb17+vptb17+wptb17-hflx);
res89 = res19 - res17;
ubtp89 = ubtp19 - ubtp17;
vbtp89 = vbtp19 - vbtp17;
wbtp89 = wbtp19 - wbtp17;
uptb89 = uptb19 - uptb17;
vptb89 = vptb19 - vptb17;
wptb89 = wptb19 - wptb17;
hc89 = hc19 - hc17;
dhc89dt = dhc19dt - dhc17dt;




%  Get windstress curl if necessary

cd /home/disk/tao/dvimont/matlab/CSIRO/Thesis/Data
load LP9_detrend_L1-7_EOF_yr101-1000.mat

[taux, tauy] = getnc('taux', 'tauy', lims, 1, tim);
[lat, lon] = getll('taux', lims);
taux = regress_eof(taux, pcs, nfrm);
tauy = regress_eof(tauy, pcs, nfrm);

for i = 1:length(nfrm);
  tx = squeeze(taux(i,:,:));
  ty = squeeze(tauy(i,:,:));
  curl(i,:,:) = sph_curl1(tx, ty, lat, lon, 0);
end

curl2 = squeeze(mean2(mean2(shiftdim(curl, 1))))';