forked from athurnherr/LDEO_IX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotinv.m
346 lines (297 loc) · 8.85 KB
/
plotinv.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
function plotinv(dr,d,p,ps)
% function plotinv(dr,d,p,ps)
%
% - plot final velocity profile
%
% Martin Visbeck and Gerd Krahmann, LDEO, April-2000
%
%======================================================================
% P L O T I N V . M
% doc: Fri Mar 18 09:37:33 2005
% dlm: Fri Mar 18 09:56:54 2005
% (c) 2005 A.M. Thurnherr
% uE-Info: 20 67 NIL 0 0 72 0 2 4 NIL ofnI
%======================================================================
% CHANGES BY ANT:
% Mar 18, 2005: - in cases of bad range, [geterr.m] does not return
% finite velocity errors; therefore the code was
% changed so as not to bomb on figure(1) any more
if existf(dr,'range_do');
zpmax=p.maxdepth+maxnan([0;dr.range_do]);
else
zpmax=p.maxdepth+maxnan([0;dr.range]);
end
if existf(p,'zbottom')
if isfinite(p.zbottom)
zpmax=p.zbottom;
end
end
if ~existf(p,'name')
p.name=' ';
end
ua=dr.u;
va=dr.v;
z=dr.z;
ur=maxnan([maxnan(abs(ua)), maxnan(abs(va))])*120;
if (ur<=0 | isnan(ur)), ur=1; end
ps=setdefv(ps,'urange',ur);
% plot final absolute velocity
clf
axes('position',[0.1 0.23 0.4 0.7])
plot(ua*100,-z,'-r','linewidth',2.5)
grid
hold on
plot(va*100,-z,'--g','linewidth',2.5)
ct=[' U(-) V(--)'];
if existf(dr,'uerr')==1
plot([va-dr.uerr]*100,-z,':g','linewidth',1.8)
plot([va+dr.uerr]*100,-z,':g','linewidth',1.8)
plot([ua-dr.uerr]*100,-z,':r','linewidth',1.8)
plot([ua+dr.uerr]*100,-z,':r','linewidth',1.8)
end
if existf(dr,'u_do')
plot((dr.u_do+dr.ubar)*100,-z,'-r','linewidth',0.5)
plot((dr.u_up+dr.ubar)*100,-z,'-r','linewidth',0.5)
plot((dr.v_do+dr.vbar)*100,-z,'--g','linewidth',0.5)
plot((dr.v_up+dr.vbar)*100,-z,'--g','linewidth',0.5)
iz=3:5:length(dr.u_do);
plot((dr.u_do(iz)+dr.ubar)*100,-z(iz),'.b','markersize',6)
plot((dr.v_do(iz)+dr.vbar)*100,-z(iz),'.b','markersize',6)
ct=[ct,'; blue dots down cast'];
end
if existf(dr,'u_shear_method')
plot((dr.u_shear_method+dr.ubar)*100,-dr.z,'-r','linewidth',0.9)
plot((dr.v_shear_method+dr.vbar)*100,-dr.z,'--g','linewidth',0.9)
iz=2:4:length(dr.u_shear_method);
plot((dr.u_shear_method(iz)+dr.ubar)*100,-dr.z(iz),'.r','markersize',7)
plot((dr.v_shear_method(iz)+dr.vbar)*100,-dr.z(iz),'.g','markersize',7)
ct=[ct,'; dotted shear'];
end
if existf(dr,'u_sadcp')
plot(dr.u_sadcp*100,-dr.z_sadcp,'-r','linewidth',1.3)
plot(dr.v_sadcp*100,-dr.z_sadcp,'-g','linewidth',1.3)
plot(dr.u_sadcp*100,-dr.z_sadcp,'pr','linewidth',0.9)
plot(dr.v_sadcp*100,-dr.z_sadcp,'pg','linewidth',0.9)
ct=[ct,'; pentagon SADCP'];
end
if (p.btrk_used>0 & existf(dr,'zbot') )
plot(dr.ubot*100,-dr.zbot,'r-','linewidth',1.3)
plot(dr.vbot*100,-dr.zbot,'g--','linewidth',1.3)
plot(dr.ubot*100,-dr.zbot,'r^','linewidth',1.3)
plot(dr.vbot*100,-dr.zbot,'g^','linewidth',1.3)
end
ax=axis;
ax(4)=0;
ax(3)=-zpmax;
ps=setdefv(ps,'zrange',ax(3:4));
ax(1:2)=[-1 1]*ps.urange;
ax(3:4)=ps.zrange;
if existf(dr,'onlyshear')
if dr.onlyshear
text(ax(1),ax(3)*0.95,' SHEAR SOLUTION ONLY','color','b','fontsize',15)
end
end
if ps.up_dn_looker==2
text(ax(1),ax(3)*0.90,' DOWN LOOKER ONLY','color','b','fontsize',13)
end
if ps.up_dn_looker==3
text(ax(1),ax(3)*0.90,' UP LOOKER ONLY','color','b','fontsize',13)
end
plot([0 0],ax(3:4),'-k')
axis(ax)
title(ct)
ylabel('depth [m]')
% plot bottom track data
if (p.btrk_used>0 & existf(dr,'zbot') )
plot([-1 1]*ps.urange,[1 1]*zpmax,'-k','linewidth',2)
set(gca,'XTickLabel',[]);
zbprofr=-dr.zbot+p.zbottom;
axes('position',[0.1 0.1 0.4 0.12])
iz=find(zbprofr>30 & zbprofr <250);
plot(dr.ubot(iz)*100,zbprofr(iz),'r-','linewidth',2.5)
grid
hold on
plot(dr.vbot(iz)*100,zbprofr(iz),'g--','linewidth',2.5)
if existf(dr,'uerrbot')
plot([dr.ubot(iz)+dr.uerrbot(iz)]*100,zbprofr(iz),':r','linewidth',1.8)
plot([dr.ubot(iz)-dr.uerrbot(iz)]*100,zbprofr(iz),':r','linewidth',1.8)
plot([dr.vbot(iz)+dr.uerrbot(iz)]*100,zbprofr(iz),':g','linewidth',1.8)
plot([dr.vbot(iz)-dr.uerrbot(iz)]*100,zbprofr(iz),':g','linewidth',1.8)
end
plot([0 0],[0 -maxnan(-[250, p.zbottom])],'-k')
xlabel('velocity [cm/s]')
ylabel('above bottom [m]')
ax2=[[-1 1]*ps.urange 0 min([250, p.zbottom])];
axis(ax2);
if p.btrk_used>1
text(0.9*ax2(1),ax2(4)*0.92,'post processed bottom track')
else
text(0.9*ax2(1),ax2(4)*0.92,'RDI bottom track')
end
end
% write some text information
subplot(322)
poss=p.poss;
pose=p.pose;
iy=1.2;
ix=-0.1;
idy=1/8;
iy=iy-idy;
[slat,slon] = pos2str(poss(1)+poss(2)/60,poss(3)+poss(4)/60);
text(ix,iy,[' Start:'])
text(ix+0.2,iy,[slat])
text(ix+0.7,iy,[slon])
date1=p.time_start;
date1(1)=y2k(date1(1));
ds=datenum(date1(1),date1(2),date1(3),date1(4),date1(5),date1(6));
iy=iy-idy;
text(ix+0.2,iy,[datestr(ds,0)])
[slat,slon] = pos2str(pose(1)+pose(2)/60,pose(3)+pose(4)/60);
iy=iy-idy;
text(ix,iy,[' End:'])
text(ix+0.2,iy,[slat])
text(ix+0.7,iy,[slon])
date2=p.time_end;
date2(1)=y2k(date2(1));
ds=datenum(date2(1),date2(2),date2(3),date2(4),date2(5),date2(6));
iy=iy-idy;
text(ix+0.2,iy,[datestr(ds,0)])
iy=iy-idy;
text(ix,iy,sprintf('u-mean: %3.0f [cm/s] v-mean %3.0f [cm/s]',...
meannan(ua)*100,meannan(va)*100))
iy=iy-idy;
if length(d)>0
if length(d.zu>2), zu=d.zu; else, zu=[0 0]; end
text(ix,iy,['binsize do: ',num2str(diff(d.zd([1,2]))),' [m] binsize up: ',...
int2str(diff(zu([1,2]))),' [m]'])
end
idy=1/10;
iy=iy-idy;
te=['mag. deviation ',num3str(p.drot,4,1)];
if existf(p,'deviat_used')
te=[te,' dev. dn: ',int2str(p.deviat_used(1))];
te=[te,' up: ',int2str(p.deviat_used(2))];
end
text(ix,iy,te)
iy=iy-idy;
text(ix,iy,['wdiff: ',num2str(p.wlim),...
' pglim: ',num2str(p.pglim),' elim ',num2str(p.elim)])
iy=iy-idy;
dum=' ';
if ps.smoofac~=0
dum=[dum,'smo:',num3str(ps.smoofac,3,2)];
end
if ps.dragfac~=0
dum=[dum,' dra:',num3str(ps.dragfac,3,2)];
end
if sum(ps.smallfac(:,2))>0
dum=[dum,' smal:',int2str(ps.smallfac(1,1)),'-',int2str(ps.smallfac(end,1))];
end
if ps.barofac~=0
dum=[dum,' bar:',num3str(ps.barofac,3,1)];
end
if ps.botfac~=0
dum=[dum,' bot:',num3str(ps.botfac,3,1)];
end
if ps.sadcpfac~=0
dum=[dum,' sad:',num3str(ps.sadcpfac,3,1)];
end
text(ix,iy,dum)
iy=iy-idy;
text(ix,iy,['weightmin ',num3str(ps.weightmin,3,1),...
' weightpower: ',num3str(ps.weightpower,3,1)])
iy=iy-idy;
ctext=['max depth: ',int2str(p.maxdepth),' [m]'];
if p.zbottom>-Inf, ctext=[ctext,' bottom: ',int2str(p.zbottom),' [m]']; end
text(ix,iy,ctext)
streamer(['Station : ',p.name,' Figure 1']);
axis off
% plot profiles of target strength
axes('position',[0.58 0.39 0.1 .25])
plot(dr.ts,-dr.z/1000,'b-','linewidth',1.5)
hold on
plot(dr.ts_out,(-max(d.zd)-dr.z)/1000,'k-')
if isfinite(maxnan(dr.ts))
ax(1)=-0.9*maxnan(-dr.ts_out);
ax(2)=maxnan(dr.ts)*1.1;
end
ax(3:4)=ax(3:4)/1000;
axis(ax)
ylabel('depth [km]')
xlabel('target strength [dB]','color','b')
set(gca,'fontsize',10);
% plot profiles of super ensemble data range
axes('position',[0.70 0.39 0.1 .25])
plot(sum(dr.range,2),-dr.z/1000,'r-','linewidth',1.5)
if existf(dr,'range_up')
hold on
plot(dr.range_up,-dr.z/1000,'-k')
plot(dr.range_do,-dr.z/1000,'-k')
iz=round(linspace(2,length(dr.z)-2,10));
plot(dr.range_do(iz),-dr.z(iz)/1000,'.b')
end
if isfinite(maxnan(sum(dr.range,2)))
ax(1)=0; ax(2)=1.1*maxnan(sum(dr.range,2));
end
axis(ax)
title('range of instuments [m]','color','r')
set(gca,'YtickLabel',[])
set(gca,'fontsize',10)
if existf(dr,'uerr')==1
% plot profiles of velocity error
axes('position',[0.82 0.39 0.1 .25])
ue=dr.uerr;
plot(ue,-dr.z/1000,'k-','linewidth',1.5)
hold on
ax(1)=0; ax(2)=3*medianan(ue);
if ~isfinite(ax(2)), ax(2) = 1; end;
axis(ax)
xlabel('vel error (-k) [m/s]')
set(gca,'fontsize',10)
set(gca,'YtickLabel',[])
end
% plot single ping accuary also
if existf(dr,'ensemble_vel_err')==1
plot(dr.ensemble_vel_err,-dr.z/1000,'-b')
ax(2)=max([2.5*medianan(ue),2.5*medianan(dr.ensemble_vel_err)]);
axis(ax)
title('single ping (-b)','color','b')
end
% plot position of CTD
subplot(326)
xctd=dr.xctd;
yctd=dr.yctd;
ii=fix(linspace(1,length(xctd),10));
[m,ib]=min(dr.zctd);
plot(xctd,yctd,'linewidth',2)
hold on
plot(xctd(ii),yctd(ii),'r.','markersize',10)
plot(xctd(ib),yctd(ib),'g+','markersize',9)
if existf(dr,'xship')
plot(dr.xship,dr.yship,'-g',dr.xship(ii),dr.yship(ii),'k.','markersize',10)
plot([xctd(ii);dr.xship(ii)],[yctd(ii); dr.yship(ii)],'-y','linewidth',0.5)
xlabel('CTD-position (blue) and ship (green) east-west [m]')
else
xlabel('CTD-position east-west [m]')
end
uship_a=p.uship+sqrt(-1)*p.vship;
if ~(abs(uship_a)==0 & p.lat==0 & p.lon==0)
plot(p.xdisp,p.ydisp,'gp')
text(p.xdisp,p.ydisp,' GPS-end')
end
text(xctd(ib),yctd(ib),' bottom')
text(xctd(end),yctd(end),' end')
axis equal
text(xctd(1),yctd(1),' start')
ylabel('north-south [m]')
grid
set(gca,'fontsize',10)
axes('position',[0.6 0.05 0.01 0.01])
text(0,0,p.software)
axis off
orient tall
%========================================================================
function d=y2k(d)
% fix date string
if d<80, d=2000+d; end
if d<100, d=1900+d; end