Global Index (short | long) | Local contents | Local Index (short | long)
tim = [551:1000];
| This script calls | |
|---|---|
clear
cd /home/disk/hayes2/dvimont/csiro/data
filin = 'temp_A_L1-10.nc';
tim = [101:550];
nc = netcdf(filin, 'nowrite');
depth = nc{'depth'}(:);
lat = nc{'latitude'}(:);
lon = nc{'longitude'}(:);
ctlim = [110 300 -60 60];
[xk, yk] = keep_var(ctlim, lon, lat);
temp = nc{'temp'}(tim,1,yk,xk);
mv = nc{'temp'}.missing_value(:);
nc = close(nc);
temp(temp == mv) = NaN;
lat1 = lat(yk); lon1 = lon(xk);
clim = squeeze(mean(temp));
[ntim, nlev, nlat, nlon] = size(temp);
% Get climatological max and min outcropping latitudes for 20deg isotherm
tiso = 20;
latind = [];
for i = 1:nlon;
tem = [max(find(clim(:,i) >= tiso)) min(find(clim(:,i) >= tiso))];
latind = [max([latind tem]) min([latind tem])];
end
if rem(size([latind(2):latind(1)]), 2);
latind(1) = latind(1)+1;
end
lat = lat1(latind(2):latind(1));
ctlim = [110 300 floor(lat1(latind(2))) ceil(lat1(latind(1)))];
% load variables within outcropping latitudes
tim = [551:1000];
cd /home/disk/hayes2/dvimont/csiro/data
nc = netcdf(filin, 'nowrite');
depth = nc{'depth'}(:);
lat = nc{'latitude'}(:);
lon = nc{'longitude'}(:);
[xk, yk] = keep_var(ctlim, lon, lat);
temp = nc{'temp'}(tim,1:10,yk,xk);
mv = nc{'temp'}.missing_value(:);
nc = close(nc);
temp(temp == mv) = NaN;
[ntim, nlev, nlat, nlon] = size(temp);
lat = lat(yk); lon = lon(xk);
% Average every other lat and lon
clim = squeeze(mean(temp));
if 1;
temp = shiftdim(temp, 2);
clim = shiftdim(clim, 1);
temp2 = NaN * ones(ntim, nlev, nlat/2, nlon/2);
clim2 = NaN * ones(nlev, nlat/2, nlon/2);
for i = 1:nlat/2;
indy = 2*(i-1)+[1:2];
for j = 1:nlon/2;
indx = 2*(j-1)+[1:2];
temp2(:,:,i,j) = squeeze(mean2(mean2(temp(indy,indx,:,:))));
clim2(:,i,j) = squeeze(mean2(mean2(clim(indy,indx,:))));
end
end
lat = mean([lat(1:2:nlat)' ; lat(2:2:nlat)']);
lon = mean([lon(1:2:nlon)' ; lon(2:2:nlon)']);
else
temp2 = temp;
clim2 = clim;
end
[ntim, nlev, nlat, nlon] = size(temp2);
kp20 = find(clim2(1,:) >= tiso);
temp2 = reshape(temp2, ntim, nlev, nlat*nlon);
temp2 = temp2(:,:,kp20);
[ntim, nlev, nkp] = size(temp2);
temp2 = reshape(shiftdim(temp2, 1), nlev, nkp*ntim);
d20 = NaN * ones(1, nkp*ntim);
for i = 1:nkp*ntim
if ~sum(diff(temp2(:,i)) > 0);
d20(i) = interp1(temp2(:,i), depth, 20);
end
end
d20 = reshape(d20, nkp, ntim);
d20 = shiftdim(d20, 1);
d20tot = NaN * ones(ntim, nlat*nlon);
d20tot(:,kp20) = d20;
nlat = length(lat); nlon = length(lon);
d20tot = reshape(d20tot, ntim, nlat, nlon);
cd /home/disk/hayes2/dvimont/csiro/matlab_data/20Deg_Isotherm
save depth_20deg_ave_yr551-1000.mat d20tot lat lon ctlim