Global Index (short | long) | Local contents | Local Index (short | long)
Average into 5x5 squares
This script calls | |
---|---|
clear tim = 1:648; lims1 = [270 360 20 73]; lims2 = [0 43 20 73]; filin = 'slp.mon.mean.nc'; varn = 'slp'; cd /home/disk/tao/data/nmc.reanalysis/monthly [slp1, lat1, lon1] = getnc2(filin, varn, lims1, 1, tim); [slp2, lat2, lon2] = getnc2(filin, varn, lims2, 1, tim); slp = shiftdim([shiftdim(slp1, 2); shiftdim(slp2, 2)], 1); lon = [lon1-360; lon2]; lat = lat1; clear slp1 slp2 lat1 lat2 lon1 lon2 [ntim, nlat, nlon] = size(slp); wgt = ones(2, nlat, nlon); slptem = cosweight(slp, lat); slptem = cosweight(slp, lat); wgt = cosweight(wgt, lat); wgt = cosweight(wgt, lat); wgt = squeeze(wgt(1,:,:)); slp2 = repmat(NaN, [ntim nlat/2 nlon/2]); for i = 1:(nlat/2); ind1 = 2*(i-1)+[1:2]; for j = 1:(nlon/2); ind2 = 2*(j-1)+[1:2]; slp2(:,i,j) = squeeze(sum(sum(shiftdim(slptem(:,ind1,ind2),1)))) / ... sum(sum(wgt(ind1,ind2))); end end lon2 = repmat(NaN, [nlon/2 1]); for i = 1:(nlon/2); ind1 = 2*(i-1)+[1:2]; lon2(i) = mean(lon(ind1)); end lat2 = repmat(NaN, [nlat/2 1]); for i = 1:(nlat/2); ind1 = 2*(i-1)+[1:2]; lat2(i) = mean(lat(ind1)); end [ntim, nlat2, nlon2] = size(slp2); slp2 = annave(slp2); slp2a = rave(slp2, 3); % Now, get intra-seasonal data: mo = [11:16]; nmo = length(mo); nyr = floor(ntim/12) - 1; slp2 = reshape(slp2, ntim, nlat2*nlon2); slp2a = reshape(slp2a, ntim, nlat2*nlon2); slp3 = repmat(NaN, [nyr*nmo, nlat2*nlon2]); slp4 = repmat(NaN, [nyr*nmo, nlat2*nlon2]); for i = 1:nyr; ind1 = 12*(i-1)+mo; ind2 = nmo*(i-1)+[1:nmo]; slp3(ind2,:) = slp2(ind1,:) - ones(nmo,1)*mean(slp2(ind1,:)); slp4(ind2,:) = slp2a(ind1,:); end % Ok, get EOFs and PCs slp3 = reshape(slp3, nyr*nmo, nlat2, nlon2); slp3 = cosweight(slp3, lat2); slp3 = reshape(slp3, nyr*nmo, nlat2*nlon2); slp4 = reshape(slp4, nyr*nmo, nlat2, nlon2); slp4 = cosweight(slp4, lat2); slp4 = reshape(slp4, nyr*nmo, nlat2*nlon2); [lam_hp, lds_hp, pcs_hp, per_hp] = eof_dan(slp3); [lam, lds, pcs, per] = eof_dan(slp4); % Save ATL data cd /home/disk/tao/dvimont/matlab/NMC/Atlantic/Data save NATL_intraseas_eofs2.mat lims1 lims2 lat2 lon2 tim mo ... lam lds pcs per lam_hp lds_hp pcs_hp per_hp % Look at regressions clear cd /home/disk/tao/dvimont/matlab/NMC/Atlantic/Data load NATL_intraseas_eofs2.mat cd /home/disk/tao/data/nmc.reanalysis/monthly tim = 1:642; lims1 = [lims1(1:2) -20 90]; lims2 = [lims2(1:2) -20 90]; % SLP filin = 'slp.mon.mean.nc'; varn = 'slp'; [dat1, lat1, lon1] = getnc2(filin, varn, lims1, 1, tim); [dat2, lat2, lon2] = getnc2(filin, varn, lims2, 1, tim); slp = shiftdim([shiftdim(dat1, 2); shiftdim(dat2, 2)], 1); lon5 = [lon1-360; lon2]; lat5 = lat1; clear dat1 dat2 lat1 lat2 lon1 lon2 % UWND filin = 'uwnd.mon.mean.nc'; varn = 'uwnd'; [dat1, lat1, lon1] = getnc2(filin, varn, lims1, 925, tim); [dat2, lat2, lon2] = getnc2(filin, varn, lims2, 925, tim); dat1 = squeeze(dat1); dat2 = squeeze(dat2); uwnd = shiftdim([shiftdim(dat1, 2); shiftdim(dat2, 2)], 1); lon6 = [lon1-360; lon2]; lat6 = lat1; clear dat1 dat2 lat1 lat2 lon1 lon2 % VWND filin = 'vwnd.mon.mean.nc'; varn = 'vwnd'; [dat1, lat1, lon1] = getnc2(filin, varn, lims1, 925, tim); [dat2, lat2, lon2] = getnc2(filin, varn, lims2, 925, tim); dat1 = squeeze(dat1); dat2 = squeeze(dat2); vwnd = shiftdim([shiftdim(dat1, 2); shiftdim(dat2, 2)], 1); lon3 = [lon1-360; lon2]; lat3 = lat1; clear dat1 dat2 lat1 lat2 lon1 lon2 % SKT filin = 'skt.mon.mean.nc'; varn = 'skt'; [dat1, lat1, lon1] = getnc2(filin, varn, lims1, 1, tim); [dat2, lat2, lon2] = getnc2(filin, varn, lims2, 1, tim); skt = shiftdim([shiftdim(dat1, 2); shiftdim(dat2, 2)], 1); lon4 = [lon1-360; lon2]; lat4 = lat1; clear dat1 dat2 lat1 lat2 lon1 lon2 % LM filin = 'land.sfc.gauss.nc'; varn = 'land'; [dat1, lat1, lon1] = getnc2(filin, varn, lims1, 1, 1); [dat2, lat2, lon2] = getnc2(filin, varn, lims2, 1, 1); dat1 = squeeze(dat1); dat2 = squeeze(dat2); land = [dat1 dat2]; land = 1-land; clear dat1 dat2 lat1 lat2 lon1 lon2 lat1 = lat5; lon1 = lon5; lat2 = lat6; lon2 = lon6; clear lat5 lat6 lon5 lon6 % Now, get averages and such slp = annave(slp); skt = annave(skt); uwnd = annave(uwnd); vwnd = annave(vwnd); nmo = length(mo); ntim = length(tim); nyr = ceil(ntim/12) - 1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Get regressions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% timeseries = pcs(:,1); timeseries2 = pcs_hp(:,1); lags = [2 2 2 2]; % SLP lag = lags(1); [ntim, nlat, nlon] = size(slp); dat1 = repmat(NaN, [nyr*nmo, nlat*nlon]); dat2 = repmat(NaN, [nyr*nmo, nlat*nlon]); slplp = rave(slp, 3); for i = 1:nyr; ind1 = 12*(i-1)+mo+lag; ind2 = nmo*(i-1)+[1:nmo]; dat1(ind2,:) = slp(ind1,:) - ones(nmo,1)*mean(slp(ind1,:)); dat2(ind2,:) = slplp(ind1,:); end dat1 = reshape(dat1, nmo*nyr, nlat, nlon); dat2 = reshape(dat2, nmo*nyr, nlat, nlon); rslp1 = repmat(NaN, [2 nlat nlon]); cslp1 = repmat(NaN, [2 nlat nlon]); [rslp1(1,:,:), cslp1(1,:,:)] = regress_eof(dat2, timeseries, 0); [rslp1(2,:,:), cslp1(2,:,:)] = regress_eof(dat1, timeseries2, 0); % SKT lag = lags(2); [ntim, nlat, nlon] = size(skt); dat1 = repmat(NaN, [nyr*nmo, nlat*nlon]); dat2 = repmat(NaN, [nyr*nmo, nlat*nlon]); slplp = rave(skt, 3); for i = 1:nyr; ind1 = 12*(i-1)+mo+lag; ind2 = nmo*(i-1)+[1:nmo]; dat1(ind2,:) = skt(ind1,:) - ones(nmo,1)*mean(skt(ind1,:)); dat2(ind2,:) = slplp(ind1,:); end dat1 = reshape(dat1, nmo*nyr, nlat, nlon); dat2 = reshape(dat2, nmo*nyr, nlat, nlon); rskt1 = repmat(NaN, [2 nlat nlon]); cskt1 = repmat(NaN, [2 nlat nlon]); [rskt1(1,:,:), cskt1(1,:,:)] = regress_eof(dat2, timeseries, 0); [rskt1(2,:,:), cskt1(2,:,:)] = regress_eof(dat1, timeseries2, 0); % UWND lag = lags(3); [ntim, nlat, nlon] = size(uwnd); dat1 = repmat(NaN, [nyr*nmo, nlat*nlon]); dat2 = repmat(NaN, [nyr*nmo, nlat*nlon]); slplp = rave(uwnd, 3); for i = 1:nyr; ind1 = 12*(i-1)+mo+lag; ind2 = nmo*(i-1)+[1:nmo]; dat1(ind2,:) = uwnd(ind1,:) - ones(nmo,1)*mean(uwnd(ind1,:)); dat2(ind2,:) = slplp(ind1,:); end dat1 = reshape(dat1, nmo*nyr, nlat, nlon); dat2 = reshape(dat2, nmo*nyr, nlat, nlon); ruwn1 = repmat(NaN, [2 nlat nlon]); cuwn1 = repmat(NaN, [2 nlat nlon]); [ruwn1(1,:,:), cuwn1(1,:,:)] = regress_eof(dat2, timeseries, 0); [ruwn1(2,:,:), cuwn1(2,:,:)] = regress_eof(dat1, timeseries2, 0); % VWND lag = lags(4); [ntim, nlat, nlon] = size(vwnd); dat1 = repmat(NaN, [nyr*nmo, nlat*nlon]); dat2 = repmat(NaN, [nyr*nmo, nlat*nlon]); slplp = rave(vwnd, 3); for i = 1:nyr; ind1 = 12*(i-1)+mo+lag; ind2 = nmo*(i-1)+[1:nmo]; dat1(ind2,:) = vwnd(ind1,:) - ones(nmo,1)*mean(vwnd(ind1,:)); dat2(ind2,:) = slplp(ind1,:); end dat1 = reshape(dat1, nmo*nyr, nlat, nlon); dat2 = reshape(dat2, nmo*nyr, nlat, nlon); rvwn1 = repmat(NaN, [2 nlat nlon]); cvwn1 = repmat(NaN, [2 nlat nlon]); [rvwn1(1,:,:), cvwn1(1,:,:)] = regress_eof(dat2, timeseries, 0); [rvwn1(2,:,:), cvwn1(2,:,:)] = regress_eof(dat1, timeseries2, 0); % Plot results: figure_landscape(1); clf; global_axes(4, 6, 0.5, 0.5, 1.5); % SLP figure_landscape(1); clf; global_latlon(lat1, lon1, [-90 40 -20 90]); subplot2(2,1); map_axis('giso'); map_contour_pn(rslp1(1,:,:), 0.5); hold on; tem = squeeze(cslp1(1,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); subplot2(2,2); map_axis('giso'); map_contour_pn(rslp1(2,:,:), 0.5); hold on; tem = squeeze(cslp1(2,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); % SKT figure_landscape(2); clf; global_latlon(lat4, lon4, [-90 40 -20 90]); subplot2(2,1); map_axis('giso'); tem = squeeze(rskt1(1,:,:)).*land; map_contour_pn(tem, 0.1); hold on; tem = squeeze(cskt1(1,:,:)).*land; tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); subplot2(2,2); map_axis('giso'); tem = squeeze(rskt1(2,:,:)).*land; map_contour_pn(tem, 0.1); hold on; tem = squeeze(cskt1(2,:,:)).*land; tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); % UWND figure_landscape(3); clf; global_latlon(lat2, lon2, [-90 40 -20 90]); subplot2(2,1); map_axis('giso'); map_contour_pn(ruwn1(1,:,:), 0.25); hold on; tem = squeeze(cuwn1(1,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); subplot2(2,2); map_axis('giso'); map_contour_pn(ruwn1(2,:,:), 0.25); hold on; tem = squeeze(cuwn1(2,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); % VWND figure_landscape(4); clf; global_latlon(lat2, lon2, [-90 40 -20 90]); subplot2(2,1); map_axis('giso'); map_contour_pn(rvwn1(1,:,:), 0.1); hold on; tem = squeeze(cvwn1(1,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off'); subplot2(2,2); map_axis('giso'); map_contour_pn(rvwn1(2,:,:), 0.1); hold on; tem = squeeze(cvwn1(2,:,:)); tem(abs(tem) < 0.2) = NaN; map_surface(tem, -0.5); hold off; caxis([-1 1]); fill_landmap('under'); gridm on; tightmap; framem on; set(gca, 'visible', 'off');