Global Index (short | long) | Local contents | Local Index (short | long)
First, load temperature field to get climatology
| This script calls | |
|---|---|
clear
cd /home/disk/hayes2/dvimont/csiro/data
filin = 'temp_A_L1-10.nc'; lev = 1:10;
%tim = [551:1000];
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:10,yk,xk);
mv = nc{'temp'}.missing_value(:);
nc = close(nc);
[ntim, nlev, nlat, nlon] = size(temp);
temp(find(temp == mv)) = NaN * ones(size(find(temp == mv)));
lat1 = lat(yk); lon1 = lon(xk);
get_global; default_global; FRAME = ctlim;
clim = squeeze(mean(temp(:,:,:,:)));
% Determine the max and min outcropping latitudes of the 20 deg. isotherm
tiso = 20;
latind = [];
for i = 1:nlon;
tem = [max(find(clim(1,:,i) >= tiso)) min(find(clim(1,:,i) >= tiso))];
latind = [max([latind tem]) min([latind tem])];
end
latind = latind(2):latind(1);
temp = temp(:,:,latind,:);
clim = clim(:,latind,:);
[ntim, nlev, nlat, nlon] = size(temp);
lat = lat(yk(latind));
lon = lon(xk);
ctlim2 = [ctlim(1:2) floor(min(lat)) ceil(max(lat))];
% Now, load u and v, ocean velocities
cd /home/disk/hayes2/dvimont/csiro/data
nc = netcdf('ul_L1-10.nc', 'nowrite');
depth2 = nc{'depth'}(:);
lat2 = nc{'latitude'}(:);
lon2 = nc{'longitude'}(:);
[xk, yk] = keep_var(ctlim2, lon2, lat2);
u = nc{'u'}(tim,lev,yk,xk);
mv = nc{'u'}.missing_value(:);
nc = close(nc);
u(u == mv) = NaN;
nc = netcdf('vl_L1-10.nc', 'nowrite');
v = nc{'v'}(tim,lev,yk,xk);
nc = close(nc);
v(v == mv) = NaN;
lon2 = lon2(xk); lat2 = lat2(yk);
% Get depth of 20deg isotherm (climatological)
kp1 = find(~isnan(clim(1,:,:))); nkp = length(kp1);
clim = clim(:,kp1);
kp2 = [];
for j = 1:nkp;
if isempty(find(diff(clim(:,j)) > 0));
kp2 = [kp2 j];
end
end
d20clim = NaN * ones(1, nkp);
for i = kp2;
d20clim(i) = interp1(clim(:,i), depth, 20);
end
d20 = NaN * ones(1, nlat*nlon);
d20(kp1) = d20clim;
d20 = reshape(d20, nlat, nlon);
% Interpolate depth to get depth of 20deg isotherm
depth20 = NaN * ones(ntim, nkp);
for i = 1:ntim;
for j = ind;
depth20(i,j) = interp1(clim2(:,j), squeeze(temp2(i,:,j)), 20);
end
end
% Interpolate d20 to u,v grid
d20uv = interp2(lon, lat, d20, lon2, lat2');