Documentation of ml_run_stats2


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


Help text

  Average by season, to make this a bit more manageable

Cross-Reference Information

This script calls

Listing of script ml_run_stats2


clear
lims = [-0.1 360 -90 90];
varn = 'psl'
varn = 'tsu'
cd /home/disk/hayes2/dvimont/csiro/data
nc = netcdf(['s' varn '_qm1_0036-0365.nc'], 'nowrite');
  lat = nc{'latitude'}(:);
  lon = nc{'longitude'}(:);
  [xk, yk] = keep_var(lims, lon, lat);
  sst = nc{varn}(:,:,yk,xk);
  sf = nc{varn}.scale_factor(:);
  ao = nc{varn}.add_offset(:);
nc = close(nc);
sst = sst*sf+ao;
[lat, lon, depth, lm] = getll('temp', lims);

[nyr, nmon, nlat, nlon] = size(sst);
sst2 = repmat(NaN, [nyr nlat nlon]);

for i = 1:nyr;
  sst2(i,:,:) = mean(squeeze(sst(i,:,:,:)));
end

%  These should have been saved

cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
load ML_ANN_detrend_SST_eof.mat 
load ML_ANN_sst.mat 
load ML_ANN_slp.mat 

lims = [-0.1 360 20 90];

[xk, yk] = keep_var(lims, lon, lat);
sst2 = slp(:,yk,xk);

[sst, clim] = remove_mean(sst2);

lm2 = ~isnan(lm);
[ntim, nlat, nlon] = size(sst);
for i = 1:ntim;
  sst(i,:,:) = squeeze(sst(i,:,:)) .* lm2;
end

%  Take EOF:

[ntim, nlat, nlon] = size(sst);
sst = reshape(sst, ntim, nlat*nlon);
sst = detrend(sst);
sst = reshape(sst, ntim, nlat, nlon);

sst = cosweight(sst, lat(yk));
kp = find(~isnan(lm));
sst = sst(:, kp);
sst = reshape(sst, ntim, nlat*nlon);


[lam, lds, pcs, per] = eof_dan(sst);

cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
%save ML_ANN_detrend_SST_eof.mat lam lds pcs per lims kp lat lon
%save ML_ANN_sst.mat sst2 lat lon
%save ML_ANN_slp.mat slp lat lon

cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
load ML_ANN_detrend_SST_eof.mat
load ML_ANN_detrend_SLP_eof.mat
load ML_ANN_sst.mat 
load ML_ANN_slp.mat 

lims = [100 300 -60 60];
[xk, yk] = keep_var(lims, lon, lat);
slp = slp(:, yk, xk);
sst = sst2(:, yk, xk);

[lat, lon, depth, lm] = getll('temp', lims);

[reg1, c1] = regress_eof(sst2, pcs, 1);
reg2 = regress_eof(sst2, pcs(:,2), 1);
reg3 = regress_eof(sst2, pcs(:,3), 1);
reg4 = regress_eof(sst2, pcs(:,4), 1);

default_global;

figure(1); fo;
subplot(2,2,1);
  gcont(reg1, .05);
  dc2(lm);
subplot(2,2,2);
  gcont(reg2, .05);
  dc2(lm);
subplot(2,2,3);
  gcont(reg3, .05);
  dc2(lm);
subplot(2,2,4);
  gcont(reg4, .05);
  dc2(lm);

[reg1, c2] = regress_eof(slp, pcs, 0);
reg2 = regress_eof(slp, pcs(:,2), 0);
reg3 = regress_eof(slp, pcs(:,3), 0);
reg4 = regress_eof(slp, pcs(:,4), 0);

default_global;

figure(2); fo(1);
subplot(2,2,1);
  gcont(reg1, .2);
  dc2(lm);
subplot(2,2,2);
  gcont(reg2, .2);
  dc2(lm);
subplot(2,2,3);
  gcont(reg3, .2);
  dc2(lm);
subplot(2,2,4);
  gcont(reg4, .2);
  dc2(lm);



%  Look at CT index

default_global; FRAME = [0 360 -90 90];

[xk, yk] = keep_var([180 270 -6 6], lon, lat);
ct = sst(:,yk,xk);
ct = mean2(mean2(shiftdim(ct, 1)));
ct = detrend(ct);
ct = squeeze(ct);

[reg1, c1] = regress_eof(sst2, ct, 0);
[reg2, c2] = regress_eof(slp, ct, 0);

figure(1); fo(1); clf;
subplot(2,1,1);
  gcont(reg1, .05);
  dc2(lm, .5, 1);
  color_shade(squeeze(c1.^2), .10, .87*[1 1 1]);
  title('ML RUN:  SST regressed on CT index');
  xlabel(['Contour Interval:  0.05 K std^-^1;' ...
          ' Light shading indicates > 10% variance explained']);

subplot(2,1,2);
  gcont(reg2, .1);
  dc2(lm, .5, -1);
  color_shade(squeeze(c2.^2), .10, .87*[1 1 1]);
  title('ML RUN:  SLP regressed on CT index');
  xlabel(['Contour Interval:  0.2 mb std^-^1;' ...
          ' Light shading indicates > 10% variance explained']);

ct = getct;
ct = detrend(ct);

sstc = getnc('temp', [-0.1 360 -90 90], 1, 101:1000);
sstc = detrend(sstc);
slpc = getflx('psl', [-0.1 360 -90 90], 101:1000);
slpc = detrend(slpc);

[reg1, c1] = regress_eof(sstc, ct, 0);
[reg2, c2] = regress_eof(slpc, ct, 0);

figure(2); fo(1); clf;
subplot(2,1,1);
  gcont(reg1, .05);
  dc2(lm, .5, -1);
  color_shade(squeeze(c1.^2), .10, .87*[1 1 1]);
  title('COUP RUN:  SST regressed on CT index');
  xlabel(['Contour Interval:  0.05 K std^-^1;' ...
          ' Light shading indicates > 10% variance explained']);

subplot(2,1,2);
  gcont(reg2, .1);
  dc2(lm, .5, -1);
  color_shade(squeeze(c2.^2), .10, .87*[1 1 1]);
  title('COUP RUN:  SLP regressed on CT index');
  xlabel(['Contour Interval:  0.2 mb std^-^1;' ...
          ' Light shading indicates > 10% variance explained']);

cd ~/matlab/CSIRO/Thesis/Chap5/Plots


%  look at power spectrum of ML CT index

clear

csirod;
load ML_seas_sst.mat
back

lims = [180 270 -6 6];
[xk, yk] = keep_var(lims, lon, lat);
ct1 = seas(:,yk,xk);
ct1 = squeeze(mean2(mean2(shiftdim(ct1, 1))));
ct1 = detrend(ct1);

data
load seas_ct2.mat
back
ct2 = detrend(ct2);

nfft = 128*2; noverlap = .75*nfft;

nx1 = length(ct1); nx2 = length(ct2);
dofx1 = 2*nx1/nfft; dofx2 = 2*nx2/nfft;

[p1, f1] = spectrum(ct1, nfft, noverlap);
[p2, f2] = spectrum(detrend(ct2), nfft, noverlap);
er1 = p1(:,1)*4.25;
er5 = p1(:,1)*2.8;
figure(1); fo; clf
subplot(3,1,1);
h1 = semilogy(2*f1, p1(:,1), 'v-k', 2*f1, p2(:,1), 'o-k', ...
              2*f1, er5, '-k', 2*f1, er1, '--k');
set(h1(1:2), 'linewidth', 2);
grid on;
axis([0 0.5 .03 1.5])
xlabel('Frequency (yr^-^1)');