1 |
% Ch = diagCatH(C,depth,h) |
2 |
% |
3 |
% Get field C(depth,lat,lon) at depth h(lat,lon) |
4 |
% |
5 |
% depth < 0 |
6 |
% h < 0 |
7 |
% |
8 |
% G. Maze, MIT, June 2007 |
9 |
%y |
10 |
|
11 |
function varargout = diagCatH(C,Z,h) |
12 |
|
13 |
% 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREPROC |
14 |
[nz,ny,nx] = size(C); |
15 |
Ch = zeros(ny,nx); |
16 |
|
17 |
% 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMPUTING |
18 |
warning off |
19 |
for ix = 1 : nx |
20 |
for iy = 1 : ny |
21 |
Ch(iy,ix) = interp1( Z, squeeze(C(:,iy,ix)) , h(iy,ix) , 'linear'); |
22 |
end |
23 |
end |
24 |
warning on |
25 |
|
26 |
% 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OUTPUTS |
27 |
switch nargout |
28 |
case 1 |
29 |
varargout(1) = {Ch}; |
30 |
end |