Documentation of make_regressions


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


Help text

  The following files are in the directory below:

  filin1 = 'temp_A_L1_1000_years.nc'    % SST
  filin2 = 'temp_A_L5_1000_years.nc'    % Layer 5 Temp.
  filin = 'temp_A_L1-5_1000_years.nc'  % Averaged Pot. Temp., Top 160m
  filin = 'temp_A_L1-10_1000_years.nc' % Averaged Pot. Temp., Top 620m

Cross-Reference Information

This script calls

Listing of script make_regressions


clear
filin = 'temp_A_L1-10.nc'
tim = 101:550;

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

nc = netcdf(filin, 'nowrite');
  lat = nc{'latitude'}(:);
  lon = nc{'longitude'}(:);

%  ctlim = [130 285 -50 65];
%  ctlim = [180 270 -6 6];
%  ctlim = [-.1 360 -90 90];
  ctlim = [110 300 -75 65];
  [xk, yk] = keep_var(ctlim, lon, lat);

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

cd /home/disk/tao/dvimont/matlab/CSIRO
temp1 = squeeze(temp1);
[temp2, lat, lon, depth, middepth] = getheat(1:7, tim, ctlim);
%temp2 = shiftdim(squeeze(mean(shiftdim(temp2, 1))),2);
[ntim, nlat, nlon] = size(temp1);

temp1 = reshape(temp1, ntim, nlat*nlon);
temp2 = reshape(temp2, ntim, nlat*nlon);
temp1(temp1 == mv) = NaN;
temp2(temp2 == mv) = NaN;

clim1 = mean(temp1); clim2 = mean(temp2);
kp1 = find(~isnan(clim1)); kp2 = find(~isnan(clim2));
temp1 = temp1(:,kp1); temp2 = temp2(:,kp2);
temp1 = detrend(temp1); temp2 = detrend(temp2);
c = 4.2*1000*27500*100*100*1e-12
temp2 = temp2*c;

%lat = lat(yk); lon = lon(xk);
get_global
default_global; FRAME = ctlim; % [0 360 -90 90];

if 1;
  lat1 = lat; lon1 = lon;
  cd /home/disk/hayes2/dvimont/csiro/matlab_data
  load 20degiso_yr101-550_temp_noave.mat
  temp2 = temp20;
  kp2 = kp20;
  lat2 = lat; lon2 = lon;
end

cd /home/disk/tao/dvimont/matlab/CSIRO/Data
%load ct_csiro.mat
load butter_4.5_ctstar.mat
[b1, a1] = butter(6, 2/10); [b, a] = butter(6, 2/20);
ctlow = ctstar(tim) - filtfilt(b1, a1, ctstar(tim));
temp1 = temp1 - filtfilt(b1, a1, temp1);
temp2 = temp2 - filtfilt(b1, a1, temp2);

ctlow = detrend(ctlow);
ctlow = (ctlow - mean(ctlow)) / std(ctlow);




for fnum = 1:11;
figure(fnum); clf; figure_orient(1);

cint = .025; clims = [-0.275:cint:0.375];
colormap('default'); a = colormap;
acol = min(clims):((max(clims)-min(clims))/(size(a,1)-1)):max(clims);
bcol = clims(2:length(clims)) - cint/2;
b = interp2(1:3, acol, a, 1:3, bcol');
colormap(b)

for i = 1:2;

eval(['temp = temp' num2str(i) ';']);
eval(['kp = kp' num2str(i) ';']);
%eval(['XAX = lon' num2str(i) '; YAX = lat' num2str(i) ';']);
%FRAME = [ctlim(1:2) floor(min(YAX)) ceil(max(YAX))];
%nlat = length(YAX); nlon = length(XAX);

l = fnum - 6;
if l >= 0;
  temtime = ctlow(1:(ntim-l));
  tem1 = temtime' * temp((1+l):ntim,:,:) / (ntim-l);
  xlab = [' leads by ' num2str(abs(l)) ' years'];
  ptit = ['lead' num2str(l)];
else
  temtime = ctlow((1-l):ntim);
  tem1 = temtime' * temp(1:(ntim+l),:,:) / (ntim+l);
  xlab = [' lags by ' num2str(abs(l)) ' years'];
  ptit = ['lag' num2str(abs(l))];
end
%wgt = max([abs(min(tem1)) abs(max(tem1))]);
%tem1 = tem1 / wgt;
%tem1 = tem1 * (wgt / (max(tem1)-min(tem1)));
tem = NaN * ones(1, nlat*nlon); tem(kp) = tem1;
  tem = reshape(tem, nlat, nlon);
tem(1,1) = (199*(i-1)+1)*min(clims); tem(1,2) = (199*(i-1)+1)*max(clims)+cint;

sp(i);
     gshade(tem, (199*(i-1)+1)*clims);
%     gcont(tem, (0.5*(i-1)+1)*clims);
     dc
     colorbar2
%     title(['Average Temp (L1-10) Regressed on LPCT; LPCT' xlab]);
     if i == 1;
       title(['<SST, LPCT> : LPCT' xlab]);
       lab1 = [num2str(cint) ' K'];
     elseif i == 2;
       title(['<275m HEAT, LPCT> : LPCT' xlab]);
       lab1 = [num2str(200*cint) '*10^1^2 J'];
     end
     xlabel(['Contour Interval:  ' lab1 ' (std)^-^1'])

end

clims = [clims (max(clims)+cint)];
colormap('default');
a = colormap;
acol = min(clims):((max(clims)-min(clims))/(size(a,1)-1)):max(clims);
bcol = clims(2:length(clims)) - cint/2;
b = interp2(1:3, acol, a, 1:3, bcol');
colormap(b)

cd /home/disk/tao/dvimont/matlab/CSIRO/Plots
%pcommand = ['print -dps2 T1_HEAT7_Reg_on_LPCT_' ptit '.ps'];
%pcommand = ['print -dps2 SST_Reg_on_LPCT_' ptit '.ps'];
%pcommand = ['print -dps2 Heat1-10_Reg_on_LPCT_' ptit '.ps'];
%eval(pcommand)
end
for i = fnum:-1:1;  figure(i); end;






cint = .0125;
clims = [-.175:cint:.15];
clims2 = [clims (max(clims)+cint)];
M = moviein(18);

for i = 1:18

colormap('default');
a = colormap;
acol = min(clims):((max(clims)-min(clims))/(size(a,1)-1)):max(clims);
bcol = clims(2:length(clims)) - cint/2;
b = interp2(1:3, acol, a, 1:3, bcol');
colormap(b)

l = (i-7);
if l >= 0;
  temtime = ctlow(1:(ntim-l));
  tem = temtime' * reshape(temp((1+l):ntim,:,:), (ntim-l), nlat*nlon) / (ntim-l);
  xlab = [' leads by ' num2str(abs(l)) ' years'];
else
  temtime = ctlow((1-l):ntim);
  tem = temtime' * reshape(temp(1:(ntim+l),:,:), (ntim+l), nlat*nlon) / (ntim+l);
  xlab = [' lags by ' num2str(abs(l)) ' years'];
end
tem = reshape(tem, nlat, nlon);
tem(1,1) = min(clims); tem(1,2) = max(clims)+cint;
subplot(1,1,1)
     gshade(tem, clims);
     dc
     title(['Average Temp (L1-10) Regressed on LPCT; LPCT' xlab]);
     xlabel('Contour Interval:  0.025 K (std)^-^1')

colormap('default');
a = colormap;
acol = min(clims2):((max(clims2)-min(clims2))/(size(a,1)-1)):max(clims2);
bcol = clims2(2:length(clims2)) - cint/2;
b = interp2(1:3, acol, a, 1:3, bcol');
colormap(b)

M(:,i) = getframe;

end

cd /home/disk/tao/dvimont/matlab/CSIRO/Data
save movie_regress.mat M

cd /home/disk/hayes2/dvimont/csiro/matlab_data
load sst_eof_bp_4.5-50yr.mat

temp1 = pc10(:,1:5)*ld10(1:5,:);

figure(1); figure_orient;
M = moviein(50);
for i = 81:130

tem = NaN*ones(1, nlat*nlon);
tem(kp) = temp1(i,:);
tem = reshape(tem, nlat, nlon);

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

M(:,i-80) = getframe;
end



%  Another movie

tind = 200:1:250;
tem1 = temp1(tind,:);
tem1 = detrend(tem1);
tem2 = temp2(tind,:);
tem2 = detrend(tem2);
M = moviein(length(tind));

for i = 1:length(tind);
%  tempat = NaN * ones(1, nlat*nlon);
%  tempat(kp1) = tem1(i,:);
%  tempat = reshape(tempat, nlat, nlon);
%  sp2(1);
%    gcont(tempat, [-5:.1:5]);

  tempat = NaN * ones(1, nlat*nlon);
  tempat(kp2) = tem2(i,:);
  tempat = reshape(tempat, nlat, nlon);
%  sp2(2);
    gcont(tempat, 280*[-2:.1:2]);

  M(:,i) = getframe;

end