1 |
function R=searibbon2(ICQ4,mesh,xi,yi,interpint) |
---|
2 |
%SEARIBBON |
---|
3 |
% SEARIBBON computes a transect given end-points, mesh, and .icq4 |
---|
4 |
% This is the transect |
---|
5 |
% R=searibbon(ICQ4,mesh,x,y,interpint) |
---|
6 |
% |
---|
7 |
% R = x: [nnv x npts] |
---|
8 |
% y: [nnv x npts] |
---|
9 |
% d: [nnv x npts] |
---|
10 |
% ZMID: [nnv x npts] |
---|
11 |
% UZMID: [nnv x npts] |
---|
12 |
% VZMID: [nnv x npts] |
---|
13 |
% WZMID: [nnv x npts] |
---|
14 |
% Q2MID: [nnv x npts] |
---|
15 |
% Q2LMID: [nnv x npts] |
---|
16 |
% TMPMID: [nnv x npts] |
---|
17 |
% SALMID: [nnv x npts] |
---|
18 |
% |
---|
19 |
% Check for existence of .icq4 file |
---|
20 |
|
---|
21 |
flds{1}='ZMID'; |
---|
22 |
flds{2}='UZMID'; |
---|
23 |
flds{3}='VZMID'; |
---|
24 |
flds{4}='WZMID'; |
---|
25 |
flds{5}='Q2MID'; |
---|
26 |
flds{6}='Q2LMID'; |
---|
27 |
flds{7}='TMPMID'; |
---|
28 |
flds{8}='SALMID'; |
---|
29 |
|
---|
30 |
Z=ICQ4.ZMID; |
---|
31 |
|
---|
32 |
NNV=size(Z,2); |
---|
33 |
% OPNML Compliant 3-18-99 CVL |
---|
34 |
mesh=belint(mesh); |
---|
35 |
mesh=el_areas(mesh); |
---|
36 |
|
---|
37 |
% INTERPOLATE X & Y ALONG TRACK IF REQUESTED |
---|
38 |
|
---|
39 |
d=[0; cumsum(((diff(xi(:))).^2+(diff(yi(:))).^2).^0.5)]; |
---|
40 |
xy=[xi(:),yi(:)]; |
---|
41 |
if exist('interpint') |
---|
42 |
if ~isnan(interpint) |
---|
43 |
xy=interp1(d,xy,... |
---|
44 |
sort([d(:);[interpint:interpint:max(d)]'])); |
---|
45 |
d=sort([d(:);[interpint:interpint:max(d)]']); |
---|
46 |
end |
---|
47 |
end |
---|
48 |
|
---|
49 |
% REMOVE NANS FOR NOW |
---|
50 |
|
---|
51 |
ll=findelem(mesh,xy); |
---|
52 |
ind=find(~isnan(ll)); |
---|
53 |
if isempty(ind) |
---|
54 |
error('section off grid!') |
---|
55 |
end |
---|
56 |
|
---|
57 |
% BUILD BASIS FN LIST |
---|
58 |
|
---|
59 |
ll=ll(ind); |
---|
60 |
xy=xy(ind,:); |
---|
61 |
[p]=basis2d(mesh,xy); |
---|
62 |
|
---|
63 |
% FIRST PART OF STRUCTURE |
---|
64 |
R.x=meshgrid(xy(:,1),1:NNV)'; |
---|
65 |
R.y=meshgrid(xy(:,2),1:NNV)'; |
---|
66 |
R.d=d(ind)*ones(1,NNV); |
---|
67 |
|
---|
68 |
% INTERPOLATE AT EACH SIGMA LEVEL |
---|
69 |
|
---|
70 |
for iv=1:NNV |
---|
71 |
t=Z(:,iv); |
---|
72 |
v1(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
73 |
|
---|
74 |
t=ICQ4.UZMID(:,iv); |
---|
75 |
v2(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
76 |
|
---|
77 |
t=ICQ4.VZMID(:,iv); |
---|
78 |
v3(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
79 |
|
---|
80 |
t=ICQ4.WZMID(:,iv); |
---|
81 |
v4(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
82 |
|
---|
83 |
t=ICQ4.Q2MID(:,iv); |
---|
84 |
v5(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
85 |
|
---|
86 |
t=ICQ4.Q2LMID(:,iv); |
---|
87 |
v6(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
88 |
|
---|
89 |
t=ICQ4.TMPMID(:,iv); |
---|
90 |
v7(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
91 |
|
---|
92 |
t=ICQ4.SALMID(:,iv); |
---|
93 |
v8(1:length(xy),iv)=sum((p.*t(mesh.e(ll,:)))')'; |
---|
94 |
end |
---|
95 |
|
---|
96 |
R=setfield(R,flds{1},v1); |
---|
97 |
R=setfield(R,flds{2},v2); |
---|
98 |
R=setfield(R,flds{3},v3); |
---|
99 |
R=setfield(R,flds{4},v4); |
---|
100 |
R=setfield(R,flds{5},v5); |
---|
101 |
R=setfield(R,flds{6},v6); |
---|
102 |
R=setfield(R,flds{7},v7); |
---|
103 |
R=setfield(R,flds{8},v8); |
---|