Documentation of compare_cts3


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


Help text

  ctlim = [-.01 360 -90 90];

Cross-Reference Information

This script calls

Listing of script compare_cts3


clear
cd /home/disk/hayes2/dvimont/csiro/data
tim = [261:1000];
filin = ['temp_A_L1-10.nc'];
nc = netcdf(filin, 'nowrite');
  depth = nc{'depth'}(1:7);
  lat = nc{'latitude'}(:);
  lon = nc{'longitude'}(:);
  ctlim = [180 270 -6 6];
  [xk, yk] = keep_var(ctlim, lon, lat);

%  temp = nc{'temp'}(tim, yk, xk);
  temp = nc{'temp'}(tim,1,yk,xk);
  mv = nc{'temp'}.missing_value(:);

nc = close(nc);
[ntim, nlev, nlat, nlon] = size(temp);
temp(find(temp == mv)) = NaN * ones(size(find(temp == mv)));
lat = lat(yk); lon = lon(xk);
get_global; default_global; FRAME = ctlim;

ctlim = [180 270 -6 6];
[xk, yk] = keep_var(ctlim, lon, lat);

ct = squeeze(mean2(mean2(shiftdim(temp(:,:,yk,xk), 1))));
ct = detrend(ct);

ct2 = mean([ct(1:2:ntim)'; ct(2:2:ntim)']);
ntim = length(ct2);




for num = 1:2;
for i = 1:3;
  if i == 1;
%    ctann = ct(1:ntim/2);
    ctann = real(pcs(:,i));
    tit = 'Years 101 - 550';
  elseif i == 2;
%    ctann = ct((ntim/2+1):ntim);
    ctann = real(pcs(:,i));
    tit = 'Years 551 - 1000';
  elseif i == 3;
%    ctann = ct(1:ntim);
    ctann = real(pcs(:,i));
    tit = 'Years 101 - 1000';
  end;

  nx = length(ctann);

  nfft = 128; 
  noverlap = nfft/2;

  [p, f] = spectrum(ctann, nfft, noverlap);
  n2 = nfft/2;
  f2 = 0.5 * (0:n2)/n2;
  rho = (corr(ctann, ctann, 1) + sqrt(corr(ctann, ctann, 2)))/2;% + ...
  rn = (1-rho^2) ./ (1-2*rho*cos((pi/n2)*(0:n2))+rho^2);
  rn = (rn / mean(rn))*mean(p(:,1));
  if i == 3;
    rner1 = rn * 2.05;
    rner5 = rn * 1.68;
  else
    rner1 = rn * 2.64;
    rner5 = rn * 2.01;
  end
  dofx = nx / n2; 
  figure(num); figure_orient;
  subplot(3,1,i)
     semilogy(f2, p(:,1), 'b-', f2, rn, 'b-', ...
	      f2, rner5, 'b--', f2, rner1, 'b-.')
%     axis([0 0.5 10e5 10e7])
     grid
     set(gca, 'XTick', [0:.05:.5]);
     title(['Power Spectrum for PC' num2str(num) ', 30s to 30n, ' tit]);
%     title(['Power Spectrum for CT' num2str(fig) ', ' tit]);
%     title(['Power Spectrum for PC1 of 20 Deg. Isotherm T'':  ' tit])
     xlabel(['Frequency:  yr^-^1;  Degrees of Freedom:  ' ...
              num2str(round(dofx)) ';' ...
             '  Bandwidth:  7.8 x 10^-^3 yr^-^1'])
     l=legend(['PC1\_SUM Spectrum'],...
              'Red Noise', '95% Confidence', '99% Confidence');
end
end

cd /home/disk/tao/dvimont/matlab/CSIRO/Temperature/Plots_Spectra

temp = squeeze(shiftdim(temp, 1));

for i = 1:nlat/2
  indy = 2*(i-1)+[1:2];
  for j = 1:nlon/2
    indx = 2*(j-1)+[1:2];
    sst(:,i,j) = squeeze(mean(mean(temp(indy,indx,:))));
  end
end
lat = mean([lat(1:2:nlat)'; lat(2:2:nlat)']);
lon = mean([lon(1:2:nlon)'; lon(2:2:nlon)']);

for i = 1:3;
if i == 1;
  tim = [1:450];
elseif i == 2;
  tim = [451:900];
elseif i == 3;
  tim = [1:900];
end
[xk, yk] = keep_var([110 290 -67.50 60], lon, lat);
temp = sst(tim,yk,xk);
[ntim, nlat, nlon] = size(temp);

%temp = squeeze(mean([reshape(temp(1:2:ntim,:,:), ...
%         1, ntim/2, nlat, nlon); ...
%         reshape(temp(2:2:ntim,:,:), ...
%         1, ntim/2, nlat, nlon)]));

[ntim, nlat, nlon] = size(temp);
temp = cosweight(temp, lat(yk));
temp = reshape(temp, ntim, nlat*nlon);
clim = mean(temp);
kp = find(~isnan(clim));
temp = temp(:,kp);
temp = detrend(temp);
[b,a] = butter(6,2/7);
temp = temp - filtfilt(b, a, temp);

[lam, per, lds, pcs] = eof_dan(temp);
eval(['ct' num2str(i) '= pcs(:,1);']);
eval(['ld' num2str(i) '= lds(:,2);']);
end

figure_landscape;
for i = 1:3;
  subplot(1,3,i);
  tem = NaN * ones(nlat*nlon,1);
  eval(['tem(kp) = ld' num2str(i) ';']);
  tem = reshape(tem, nlat, nlon);

  gcont(tem, [-1:.1:1]);dc;
end