Documentation of regress_flux


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


Help text

tim = [451:900];

Cross-Reference Information

This script calls

Listing of script regress_flux


clear
tim = 101:1000;
cd /home/disk/tao/dvimont/matlab/CSIRO/Data
load butter_4.5_ctstar.mat
ctstar = ctstar(tim);
cd /home/disk/hayes2/dvimont/csiro/data
nc = netcdf('zonal_stress_A_1000_years.nc', 'nowrite');
  lat = nc{'latitude'}(:);
  lon = nc{'longitude'}(:);
  ctlim = [110 300 -75 65];
  [xk, yk] = keep_var(ctlim, lon, lat);
  utot = nc{'smfzon'}(tim,yk,xk);
  mv = nc{'smfzon'}.missing_value(:);
nc = close(nc);
utot(find(utot == mv)) = NaN * ones(size(find(utot == mv)));
nc = netcdf('merid_stress_A_1000_years.nc', 'nowrite');
  vtot = nc{'smfmer'}(tim,yk,xk);
  mv = nc{'smfmer'}.missing_value(:);
nc = close(nc);
vtot(find(vtot == mv)) = NaN * ones(size(find(vtot == mv)));
nc = netcdf('heat_flux_A_1000_years.nc', 'nowrite');
  hftot = nc{'stfht'}(tim,yk,xk);
  mv = nc{'stfht'}.missing_value(:);
nc = close(nc);
hftot(find(hftot == mv)) = NaN * ones(size(find(hftot == mv)));
lat = lat(yk); lon = lon(xk);
get_global; default_global; FRAME = ctlim;
num = 1;
tim = [1:450];
[u, climu] = remove_mean(utot(tim,:,:));
[v, climv] = remove_mean(vtot(tim,:,:));
[hf, climhf] = remove_mean(hftot(tim,:,:));
%ct = rave(rave(ctstar(tim), 3), 3);
ct = ctstar(tim);
ct = detrend(ct); ct = ct./std(ct);

[ntim, nlat, nlon] = size(u);
u = reshape(u, ntim, nlat*nlon);
v = reshape(v, ntim, nlat*nlon);
hf = reshape(hf, ntim, nlat*nlon);

stdu = std(u); stdv = std(v); stdhf = std(hf);

for fig = 1:1;
lag = fig -1;
if lag < 0
  tim1 = 1:(ntim+lag); tim2 = (1-lag):ntim;
  temu = ct(tim1)' * u(tim2,:) ./ (ntim+lag);
  temv = ct(tim1)' * v(tim2,:) ./ (ntim+lag);
  temhf = ct(tim1)' * hf(tim2,:) ./ (ntim+lag);
  dofx = get_dof(ct(tim1));  dofy = get_dof(hf(tim2,:));
  doftot = dofx + dofy - 2;
elseif lag > 0
  tim1 = (1+lag):ntim; tim2 = 1:(ntim-lag);
  temu = ct(tim1)' * u(tim2,:) ./ (ntim-lag);
  temv = ct(tim1)' * v(tim2,:) ./ (ntim-lag);
  temhf = ct(tim1)' * hf(tim2,:) ./ (ntim-lag);
  dofx = get_dof(ct(tim1));  dofy = get_dof(hf(tim2,:));
  doftot = dofx + dofy - 2;
else
  temu = ct' * u ./ ntim;
  temv = ct' * v ./ ntim;
  temhf = ct' * hf ./ ntim;
  dofx = get_dof(ct);  dofy = get_dof(hf);
  doftot = dofx + dofy - 2;
end
tit = ['lag ' num2str(lag) ' years'];

rcoefu = temu ./ stdu;
rcoefv = temv ./ stdv;
rcoefhf = temhf ./ stdhf;

temu = reshape(temu, nlat, nlon);
temv = reshape(temv, nlat, nlon);
temhf = reshape(temhf, nlat, nlon);
  score = reshape(rcoefhf .* sqrt(doftot) ./ sqrt(1 - rcoefhf.^2), nlat, nlon);
  tlim = tscore(min(doftot), 2.5);

figure(fig); figure_landscape;
sp2(1)
     [h, a, c] = gquiv(temu, temv, 1.2); dc;%, 'giso', [0 180]);
     title(['<Wind Stress, CT>, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ', ' tit]);
     xlabel(['Max = ' num2str(round(c(2)*100)/100) ' dynes cm^-^1'])

sp2(2)
     gshade2(abs(score), tlim); hold on;
     gcont(-1*temhf, [-10:10]); dc; hold off;%, 'giso', [0 180]);
     title(['<Heat Flux, CT, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ', ' tit]);
     xlabel(['Contour Interval:  1 W m^-^2 (Positive Up)']);

end;
for fig = 5:-1:1; figure(fig); end;
cd /home/disk/tao/dvimont/matlab/CSIRO/Plots2


%  Look at wind stress curl:

vor = sph_curl(temu, temv, lon, lat) * 1e8;
div = sph_div(temu, temv, lon,lat) * 1e8;

figure(2)
sp(1)
     mcont(vor, [-20:2:20], 'giso', [0 180]);
     title(['Vorticity Regressed on CT, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ', ' tit]);
     xlabel(['Contour Interval:  2 * 10^-^8 s^-^1']);
sp(2)
     mcont(div, [-20:1:20], 'giso', [0 180]);
     title(['Divergence Regressed on CT, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ', ' tit]);
     xlabel(['Contour Interval:  1 * 10^-^8 s^-^1']);


% CLIMATOLOGY

sp(1)
     [h, a, c] = mquiv(squeeze(climu), squeeze(climv), 1.2, 'giso', [0 180]);
     title(['Wind Stress Climatology, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ' ' tit]);
     xlabel(['Max = ' num2str(round(c(2)*10)/10) ' dynes cm^-^1'])
sp(2)
     mcont(squeeze(-1*climhf), [-300:25:300], 'giso', [0 180]);
     title(['Heat Flux Climatology, Years ' ...
             num2str(min(tim+100)) ' to ' num2str(max(tim+100)) ' ' tit]);
     xlabel(['Contour Interval:  25 W m^-^2 (Positive Up)']);

cd /home/disk/tao/dvimont/matlab/CSIRO/Plots2



%  Look at regressions on complex PC's

cd /home/disk/hayes2/dvimont/csiro/matlab_data
load LPregmap_3deof_12.5to62.5pac.mat
load LPregmap_3deof_-30to30pac.mat
load LPregmap_3deof_totpac.mat

cd /home/disk/hayes2/dvimont/csiro/data
nc = netcdf('zonal_stress_A_1000_years.nc', 'nowrite');
  lat = nc{'latitude'}(:);
  lon = nc{'longitude'}(:);
  ctlim = [110 300 -75 65];
  [xk, yk] = keep_var(ctlim, lon, lat);
nc = close(nc);
lat = lat(yk); lon = lon(xk);
nlat = length(lat); nlon = length(lon);
get_global; default_global; FRAME = ctlim;

tim = [1:450]; ntim = length(tim);
pcs = pcs(tim,:);

hfr = pcs.' * hf ./ ntim;
ur = pcs.' * u ./ ntim;
vr = pcs.' * v ./ ntim;

figure(1); clf; figure_landscape;
lag = 0; lg = lag*pi/180;
num = 1;
nfrm = 4;
FRAME = [110 285 -15 65 ];

cint = .01; clev = [-.1:cint:.1];
for i = 1:nfrm;

  wgt = conj(exp(j * ((i-1) * pi/nfrm + lg) ));% * ones(npt, 1));  
  tem = squeeze(real(wgt .* hfr(num,:)));
  tem = 1*reshape(tem, nlat, nlon);

     subplot(2,2,i);
       if ismap(gca); clma; end
       gcont(tem, clev); dc;
       title(['LPEQ:  <HF, CPC' num2str(num) '>, Phase = ' num2str(((i-1)*180)/nfrm+lag)]);
       xlabel(['Contour Interval:  ' num2str(cint) ' W m^-^2 std^-^1 (Pos. Up)'])

end
cd /home/disk/tao/dvimont/matlab/CSIRO/Plots2


figure(2); clf; figure_landscape;
lag = 0; lg = lag*pi/180;
num = 1;
nfrm = 4;
FRAME = [110 285 -15 65 ];

for i = 1:nfrm;

  wgt = conj(exp(j * ((i-1) * pi/nfrm + lg) ));% * ones(npt, 1));  
  tem1 = squeeze(real(wgt .* ur(num,:)));
  tem1 = reshape(tem1, nlat, nlon);
  tem2 = squeeze(real(wgt .* vr(num,:)));
  tem2 = reshape(tem2, nlat, nlon);

     subplot(2,2,i);
       if ismap(gca); clma; end
       [h, a, c] = gquiv(tem1, tem2, 1.2); dc;
       title(['LPEQ:  <(U,V), CPC' num2str(num) '>, Phase = ' num2str(((i-1)*180)/nfrm+lag)]);
       xlabel(['Max = ' num2str(round(c(2)*1e5)) ' x 10^-^5 dynes cm^-^1'])

end
cd /home/disk/tao/dvimont/matlab/CSIRO/Plots2