Documentation of plot_daily_1daycorr


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


Help text

  Start with earth

Cross-Reference Information

This script calls

Listing of script plot_daily_1daycorr


clean
file_base=[7:48];
fint = [];
for i = 1:6;
  fint = [fint 73*(i-1)+file_base];
end
lims = [0 360 20 90];
tim = 1:5;

cd /home/disk/hayes2/dvimont/ccm/ccm3.6/run/sun/HT/HTRAE/cdtem_e
%cd /home/disk/hayes2/dvimont/ccm/ccm3.6/run/sun/HT/EARTH/cdtem_e

%  Get parameters
nc = netcdf('ha0001.nc', 'nowrite');
[lat, lon, yk, xk] = get_nclatlon(lims, nc);
nc = close(nc);
nlat = length(lat); nlon = length(lon);

zdat = repmat(NaN, [5*length(fint) nlat nlon]);;
for i = 1:length(fint);
  disp(fint(i))
  if fint(i) < 10;
    fyr = ['000' num2str(fint(i))];
  elseif fint(i) < 100;
    fyr = ['00' num2str(fint(i))];
  elseif fint(i) < 1000;
    fyr = ['0' num2str(fint(i))];
  end
  fname = ['ha' fyr '.nc'];
  nc = netcdf(fname, 'nowrite');
    z = nc{'Z500', 1}(:, yk, xk);
  nc = close(nc);
  zdat(5*(i-1)+[1:5], :, :) = z;
end

%  Remove smoothed climatology
tem = repmat(NaN, [6, 42*5, nlat, nlon]);
for i = 1:6;
  ind = 42*5*(i-1)+[1:(42*5)];
  tem(i,:,:,:) = zdat(ind,:,:);
end
tem = squeeze(mean(tem));
tem = rave(rave(tem, 7), 13);
for i = 1:6;
  ind = 42*5*(i-1)+[1:(42*5)];
  zdat(ind,:,:) = zdat(ind,:,:) - tem;
end
zdat(abs(zdat)>1e3) = NaN;
[ntim, nlat, nlon] = size(zdat);

%  Save data
cd /home/disk/tao/dvimont/matlab/CCM/Htrea/Data2
%save EARTH_daily_z500.mat zdat lims lat lon
zdat = reshape(shiftdim(zdat, 2), nlon, ntim*nlat);
zdat = flipud(zdat);
zdat = shiftdim(reshape(zdat, nlon, ntim, nlat), 1);
zdat2 = zdat;
save HTRAE_daily_z500.mat zdat2 lims lat lon





%  Start over
clean

%  Load data
cd /home/disk/tao/dvimont/matlab/CCM/Htrea/Data2
load EARTH_daily_z500.mat
load HTRAE_daily_z500.mat

%  Now, generate some statistics
zlow = rave(zdat, 5);
zhi = zdat - zlow;
zlow2 = rave(zdat2, 5);
zhi2 = zdat2 - zlow2;

%  Plot variances
[ntim, nlat, nlon] = size(zdat);
zlow = reshape(zlow, ntim, nlat*nlon);
zhi = reshape(zhi, ntim, nlat*nlon);
zlow2 = reshape(zlow2, ntim, nlat*nlon);
zhi2 = reshape(zhi2, ntim, nlat*nlon);

varlow = var_nan(zlow);
varhi = var_nan(zhi);
varlow2 = var_nan(zlow2);
varhi2 = var_nan(zhi2);

varlow = reshape(varlow, nlat, nlon);
varhi = reshape(varhi, nlat, nlon);
varlow2 = reshape(varlow2, nlat, nlon);
varhi2 = reshape(varhi2, nlat, nlon);


%  Plot results
cd ~/matlab/Wallace; link_toolboxes;
figure_tall(1);
global_axes(3.75, 3.75, 0, .5, 1.5);
global_latlon(lat, lon, lims);

figure_tall(1); clf;
ax = subplot2(1,1); cla
  maxes('stereo', [90 270]);
  [c, h] = map_contour(varlow, 2000);
  hold on;
    h2 = map_surface(varlow, -1*ones(nlat, nlon));
  hold off;
  caxis([-15000 15000]);
  set(h, 'linewidth', 2);
  draw_landmap;
  gridm on; framem on; tightmap2;
  set(gca, 'visible', 'off');
  yl = ylabel('\bf EARTH');
  set(yl, 'fontsize', 22, 'visible', 'on');
  tt = title('\bf 10-day LP Var(Z500)');
  set(tt, 'fontsize', 22, 'visible', 'on');
  
ax = subplot2(1,2); cla
  maxes('stereo', [90 270]);
  [c, h] = map_contour(varlow2, 2000);
  hold on;
    h2 = map_surface(varlow2, -1*ones(nlat, nlon));
  hold off;
  caxis([-15000 15000]);
  set(h, 'linewidth', 2);
  draw_landmap;
  gridm on; framem on; tightmap2;
  set(gca, 'visible', 'off');
  yl = ylabel('\bf HTRAE');
  set(yl, 'fontsize', 22, 'visible', 'on');
  xl = xlabel('Contour:  2000 m^2');
  set(xl, 'visible', 'on', 'fontsize', 14);
  
cd ~/matlab/CCM/Htrea/Figs_daily
print -dpsc2 10day_LP_z500_var.ps

  
figure_tall(2); clf;
ax = subplot2(1,1); cla
  maxes('stereo', [90 270]);
  [c, h] = map_contour(varhi, 1000);
  hold on;
    h2 = map_surface(varhi, -1*ones(nlat, nlon));
  hold off;
  caxis([-5000 5000]);
  set(h, 'linewidth', 2);
  draw_landmap;
  gridm on; framem on; tightmap2;
  set(gca, 'visible', 'off');
  yl = ylabel('\bf EARTH');
  set(yl, 'fontsize', 22, 'visible', 'on');
  tt = title('\bf 10-day HP Var(Z500)');
  set(tt, 'fontsize', 22, 'visible', 'on');
  
ax = subplot2(1,2); cla
  maxes('stereo', [90 270]);
  [c, h] = map_contour(varhi2, 1000);
  hold on;
    h2 = map_surface(varhi2, -1*ones(nlat, nlon));
  hold off;
  caxis([-5000 5000]);
  set(h, 'linewidth', 2);
  draw_landmap;
  gridm on; framem on; tightmap2;
  set(gca, 'visible', 'off');
  yl = ylabel('\bf HTRAE');
  set(yl, 'fontsize', 22, 'visible', 'on');
  xl = xlabel('Contour:  1000 m^2');
  set(xl, 'visible', 'on', 'fontsize', 14);
  
cd ~/matlab/CCM/Htrea/Figs_daily
print -dpsc2 10day_HP_z500_var.ps



%  Look at one point correlation maps over Pacific
[xk, yk] = keep_var([90 270 20 90], lon, lat);
vh1 = varhi(yk, xk); vh2 = varlow(yk, xk);
[b1, s1] = minmax(vh1);
[b2, s2] = minmax(vh2);

%  EARTH:  Try this
[xk, yk] = keep_var([150 210 44 46], lon, lat); yk = 10; nx = length(xk);
lags = -5:5; nlag = length(lags);
dx = mean(diff(lon));
pat1 = repmat(NaN, [nx nlag nlat (nlon/2)+1]); %  (it works)
c1 = pat1; 

[ntim, nlat, nlon] = size(zdat);
zhi = reshape(zhi, ntim, nlat, nlon);
tic
for i = 1:nx;
  disp(i)
  tim = zhi(:, yk, xk(i));
  [xt, yt] = keep_var([[-90 90]+lon(xk(i)) 20 90], lon, lat);
  dat = zhi(:, yt, xt);
  [pat1(i,:,:,:), c1(i,:,:,:)] = regress_eof(dat, tim, lags);
end
toc

%  HTRAE:  Try this
[xk, yk] = keep_var([158 218 44 46], lon, lat); 
yk = 10; nx = length(xk);
lags = -5:5; nlag = length(lags);
dx = mean(diff(lon));
pat2 = repmat(NaN, [nx nlag nlat (nlon/2)+1]); %  (it works)
c2 = pat2; 

[ntim, nlat, nlon] = size(zdat);
zhi2 = reshape(zhi2, ntim, nlat, nlon);
tic
for i = 1:nx;
  disp(i)
  tim = zhi2(:, yk, xk(i));
  [xt, yt] = keep_var([[-90 90]+lon(xk(i)) 20 90], lon, lat);
  dat = zhi2(:, yt, xt);
  [pat2(i,:,:,:), c2(i,:,:,:)] = regress_eof(dat, tim, lags);
end
toc


%  Save regressions and such
lims1 = [150 210 20 90]; lims2 = [158 218 20 90];
cd /home/disk/tao/dvimont/matlab/CCM/Htrea/Data2
save HP_1pt_regs.mat pat1 pat2 c1 c2 lat lon lims1 lims2


%  Plot correlations and such
cd /home/disk/tao/dvimont/matlab/CCM/Htrea/Data2
load HP_1pt_regs.mat

cd ~/matlab/Wallace; link_toolboxes;
figure_tall(1); 
global_axes(3.125, 3.125/2, .25, .25, 1);

[xk, yk] = keep_var([[-90 90]+mean(lims1(1:2)) 20 90], lon, lat);
global_latlon(lat(yk), lon(xk), [[-90 90]+mean(lims1(1:2)) 20 90]);
tem1 = squeeze(mean2(c1));
for i = 1:5;
  lind = i+3;
  subplot2(2,2*(i-1)+1); cla;
  maxes('stereo', [90 mean(lims1(1:2))]);
  [c, h] = map_contour_pn(tem1(lind,:,:), 0.1);
  hold on;
    tem2 = squeeze(tem1(lind,:,:)); tem2(find(abs(tem2)<0.1))=NaN;
    h2 = map_surface(tem2, -1*ones(nlat, nlon));
    p1 = plotm(lat(10), mean(lims1(1:2)), '.k');
  hold off;
  fill_landmap(-2, 0.8*[1 1 1]);
  caxis([-1 1]);
  db = drawboxm(FRAME, 'k');
  set(db, 'linewidth', 2);
  gridm on; axis_limits(100);
  set(gca, 'visible', 'off');
  yl = title2(['\bf Day ' num2str(lags(lind))]);
  set(yl, 'fontsize', 12, 'visible', 'on');
end

[xk, yk] = keep_var([[-90 90]+lon(68) 20 90], lon, lat);
global_latlon(lat(yk), lon(xk), [[-90 90]+lon(68) 20 90]);
tem1 = squeeze(mean2(c2));
for i = 1:5;
  lind = i+3;
  subplot2(2,2*(i-1)+2); cla;
  maxes('stereo', [90 lon(68)]);
  [c, h] = map_contour_pn(tem1(lind,:,:), 0.1);
  hold on;
    tem2 = squeeze(tem1(lind,:,:)); tem2(find(abs(tem2)<0.1))=NaN;
    h2 = map_surface(tem2, -1*ones(nlat, nlon));
    p1 = plotm(lat(10), lon(68), '.k');
  hold off;
  fill_landmap(-2, 0.8*[1 1 1]);
  caxis([-1 1]);
  db = drawboxm(FRAME, 'k');
  set(db, 'linewidth', 2);
  gridm on; axis_limits(100);
  set(gca, 'visible', 'off');
  yl = title2(['\bf Day ' num2str(lags(lind))]);
  set(yl, 'fontsize', 12, 'visible', 'on');
end

cd ~/matlab/CCM/Htrea/Figs_daily
print -dpsc2 1pt_corr_maps_z500.ps