-
Notifications
You must be signed in to change notification settings - Fork 1
/
Heat_Budget_Plot_EqSlice.m
549 lines (523 loc) · 19.5 KB
/
Heat_Budget_Plot_EqSlice.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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
% This script makes plots depth-longitude or depth-latitude slices
close all;
clear all;
base = '/srv/ccrc/data03/z3500785/mom/mat_data/';
% $$$ base = 'archive/mat_data/';
RUNS = { ...
% MOM01-SIS:
% $$$ {'MOM01',[4567]}, ...
% $$$ % MOM025-SIS:
% $$$ {'MOM025_kb3seg',[101120],'(a) MOM025 Control'}, ...
% $$$ {'MOM025',[16:19],'(b) MOM025-kb0'}, ...
% $$$ {'MOM025_kb1em5',[95:99],'(c) MOM025-kb5'}, ...
% $$$ {'MOM025_kb1em6',[30]}, ...
% $$$ % ACCESS-OM2 Gadi runs:
% $$$ {'ACCESS-OM2_025deg_jra55_ryf',[7680]}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf',[7680],'(a) ACCESS-OM2-025-NG'}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf_rediGM_kbvar',[7781],'(b) ACCESS-OM2-025-NG-kbv'}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf_rediGM_kb1em5',[7781],'(c) ACCESS-OM2-025-NG-kb5'}, ...
{'ACCESS-OM2_025deg_jra55_ryf_norediGM',[7680]}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf_noGM',[7680]}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf_kds75',[7680]}, ...
% $$$ % $$$ {'ACCESS-OM2_025deg_jra55_ryf',[80]}, ...
% $$$ % $$$ {'ACCESS-OM2_025deg_jra55_ryf',[300]}, ...
% $$$ {'ACCESS-OM2_025deg_jra55_ryf_norediGM',[7680]}, ...
% $$$ {'ACCESS-OM2_01deg_jra55_ryf',[636639]}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf',[31],'(d) ACCESS-OM2-1-KDS50'}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf_sgl',[31]}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf_gfdl50',[31],'(e) ACCESS-OM2-1-GFDL50'}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf_kds75',[3135],'ACCESS-OM2-1-KDS75'}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf_kds100',[3135],'ACCESS-OM2-1-KDS100'}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf_kds135',[3135],'(f) ACCESS-OM2-1-KDS135'}, ...
% $$$ {'ACCESS-OM2_1deg_jra55_ryf',[51]}, ...
};
cols = {'b',[0.3020 0.7451 0.9333],'b','b','b'};
typs = {'-','-','--',':','-.'};
figure;
set(gcf,'Position',[1923 5 1366 998]);
set(gcf,'defaulttextfontsize',15);
set(gcf,'defaultaxesfontsize',15);
% $$$ rr = 1;
for rr = 1:length(RUNS);
outputs = RUNS{rr}{2};
model = RUNS{rr}{1};
% $$$ clearvars -except base RUNS rr outputs model;
load([base model sprintf('_output%03d_BaseVars.mat',outputs(1))]);
if (~exist('ndays'))
ndays = diff(time_snap);
ndays = ndays(1:12);
end
if (ndays(end) <= 0); ndays(end) = 365-ndays(end);end;
region = 'Global';
nyrs = tL/12;
if (round(nyrs)~=nyrs)
anavg = 1;
nyrs = tL;
months = {[1:1]};
else
anavg = 0;
months = {[1:12]};
end
yrs = 1:nyrs;
ycur = 1;
% Load Variable and calculate mean:
reg = 'EqPM2';
load([base model sprintf(['_output%03d_varsat_' reg '.mat'],outputs(1))]);
vars = {'temp','mld','ndif','vdif','vnlc'};%,'u_sq','v_sq','u','v','w_sq','w','Tdxsq','Tdysq','Tdzsq'};
% $$$ for i=1:length(vars)
% $$$ eval(['sz = size(' vars{i} ');']);
% $$$ if (~anavg)
% $$$ sz(end) = 12;
% $$$ end
% $$$ eval([vars{i} 'all = reshape(' vars{i} ',[sz nyrs]);']);
% $$$ end
% $$$ for i=2:length(outputs)
% $$$ load([base model sprintf(['_output%03d_varsat_' reg '.mat'],outputs(i))]);
% $$$ for i=1:length(vars)
% $$$ eval(['sz = size(' vars{i} ');']);
% $$$ if (~anavg)
% $$$ sz(end) = 12;
% $$$ end
% $$$ eval([vars{i} 'all = cat(4,' vars{i} 'all,reshape(' vars{i} ',[sz nyrs]));']);
% $$$ end
% $$$ end
% $$$ for i=1:length(vars)
% $$$ eval(['sz = size(' vars{i} 'all);']);
% $$$ if (~anavg)
% $$$ eval([vars{i} ' = mean(' vars{i} 'all,length(sz));']);
% $$$ else
% $$$ eval([vars{i} ' = ' vars{i} 'all;']);
% $$$ end
% $$$ eval(['clear ' vars{i} 'all;']);
% $$$ end
[xL,zL,tL] = size(temp);
TL = length(T);
if (max(max(max(temp)))>100)
temp = temp-273.15;
end
% $$$ %% Plot Temp bias against WOA13:
% $$$ % $$$ months = [1:12];
% $$$ % $$$ temp = monmean(temp(:,:,months),3,ndays(months));
% $$$ months = 1:10;
% $$$ temp = mean(temp,3);
% $$$
% $$$ % WOA13:
% $$$ WOAname = '/srv/ccrc/data03/z3500785/Data_Products/WOA13/woa13_decav_t00_04.nc';
% $$$ WOAlat = ncread(WOAname,'lat');
% $$$ WOAlon = ncread(WOAname,'lon');
% $$$ WOAdep = ncread(WOAname,'depth');
% $$$ [tmp Eqind] = min(abs(WOAlat));
% $$$ % $$$ [tmp ln140ind] = min(abs(WOAlon+110));
% $$$
% $$$ WOAT = squeeze(ncread(WOAname,'t_an',[1 Eqind 1 1],[1440 1 102 1]));
% $$$ % $$$ WOAT = squeeze(ncread(WOAname,'t_an',[ln140ind 1 1 1],[1 720 102 1]));
% $$$ % $$$
% $$$ %Shift longitudes:
% $$$ [tmp ind] = min(abs(WOAlon-80));
% $$$ WOAT = cat(1,WOAT(ind+1:end,:),WOAT(1:ind,:));
% $$$ WOAlon = cat(1,WOAlon(ind+1:end)-360,WOAlon(1:ind));
% $$$ [WOAlon,WOAdep] = ndgrid(WOAlon,WOAdep);
% $$$ % $$$ [WOAlat,WOAdep] = ndgrid(WOAlat,WOAdep);
% $$$ % $$$
% $$$ % Calculate bias from WOA:
% $$$ Tbias = temp-interp2(WOAlon',-WOAdep',WOAT',Xt,-Zt,'linear');
% $$$ % $$$ Tbias = temp-interp2(WOAlat',-WOAdep',WOAT',Yt,-Zt,'linear');
% $$$
% $$$ %Colormap:
% $$$ clim = [-3 3];
% $$$ sp = 0.25;
% $$$ cpts = [-1e10 clim(1):sp:clim(2) 1e10];
% $$$ npts = length(cpts)
% $$$ cmap = redblue(npts-3);
% $$$
% $$$ % $$$ figure;
% $$$ % $$$ set(gcf,'Position',[1 36 1920 970]);
% $$$ subplot(2,3,rr);
% $$$ contourf(Xt,-Zt,Tbias,cpts,'linestyle','none');
% $$$ % $$$ contourf(Yt,-Zt,Tbias,cpts,'linestyle','none');
% $$$ hold on;
% $$$ [c,h] = contour(WOAlon,-WOAdep,WOAT,[0:2:35],'-k');
% $$$ % $$$ [c,h] = contour(WOAlat,-WOAdep,WOAT,[0:2:35],'-k');
% $$$ clabel(c,h,[0:2:35]);
% $$$ [c,h] = contour(WOAlon,-WOAdep,WOAT,[20 20],'-k','linewidth',2);
% $$$ % $$$ [c,h] = contour(WOAlat,-WOAdep,WOAT,[20 20],'-k','linewidth',2);
% $$$ hold on;
% $$$ [c,h] = contour(Xt,-Zt,temp,[20 20],'--k','linewidth',2);
% $$$ % $$$ [c,h] = contour(Yt,-Zt,temp,[20 20],'--k','linewidth',2);
% $$$ ylim([-300 0]);
% $$$ xlim([-220 -80]);
% $$$ % $$$ ylim([-300 0]);
% $$$ % $$$ xlim([-15 15]);
% $$$ if (rr == 3 | rr == 6)
% $$$ cb = colorbar;
% $$$ ylabel(cb,'Temperature Bias ($^\circ$C)');
% $$$ end
% $$$ if (rr <= 3)
% $$$ set(gca,'xticklabel',[]);
% $$$ else
% $$$ xlabel('Longitude ($^\circ$E)');
% $$$ end
% $$$ % $$$ end
% $$$ % $$$ xlabel('Latitude ($^\circ$N)');
% $$$ if (rr == 1 | rr == 4)
% $$$ ylabel('Depth (m)');
% $$$ else
% $$$ set(gca,'yticklabel',[]);
% $$$ end
% $$$ caxis(clim);
% $$$ colormap(cmap);
% $$$ % $$$ set(gca,'FontSize',15);
% $$$ % $$$ title([strrep(strrep(strrep(strrep(strrep(RUNS{rr}{1},'_',' '),'ACCESS-OM2 ' ...
% $$$ % $$$ ,'AOM'),'deg jra55',''),' may',''),'ryf8485 ','') ' - WOA13 Equatorial T ($^\circ$C)']);
% $$$ text(-219,-285,RUNS{rr}{3},'Backgroundcolor','w');
% $$$
% $$$ poss = [0.0693 0.5271 0.2726 0.3753; ...
% $$$ 0.3578 0.5271 0.2726 0.3753; ...
% $$$ 0.6463 0.5271 0.2726 0.3753; ...
% $$$ 0.0693 0.1134 0.2726 0.3753; ...
% $$$ 0.3578 0.1134 0.2726 0.3753; ...
% $$$ 0.6463 0.1134 0.2726 0.3753];
% $$$ set(gca,'Position',poss(rr,:));
% $$$ end
%%% Plot Diathermal fluxes:
% Depth of isotherms:
Zi = zeros(xL,TL,tL);
for ti=1:tL
for xi=1:xL
tvec = squeeze(temp(xi,:,ti));
zvec = -Zt(xi,:);
tvec(isnan(tvec)) = -1000;
tvec(tvec == 0) = -1000;
tvec = tvec - 0.01*(1:zL);
Zi(xi,:,ti) = interp1(tvec,zvec,T,'linear');
ind = find(~isnan(Zi(xi,:,ti)),1,'last');
Zi(xi,(ind+1):end,ti) = max(zvec);%linspace(Zi(yi,ind;
end
end
Xi = repmat(Xt(:,1),[1 TL]);
var = cumsum(vdif+vnlc,2,'reverse'); % Vertical Mixing Flux
var = ndif; % Numerical mixing
% $$$ var = u_sq - u.^2 + v_sq-v.^2; % EKE
% $$$ var = w_sq - w.^2; % Vertical EKE
% $$$ var = Tdxsq+Tdysq; % Horizontal T differences
% $$$ var = Tdzsq;
months = {[1:tL]}%:12]};
% $$$ var = mean(reshape(var,[163 74 12 10]),4);
% $$$ months = {[1:12]}%:12]};
% $$$ months = {[1:12],[3],[7],[11]};
% $$$ monthsu01 = {[1:4],[1],[3],[4]};
% $$$ labels = {'Annual','March','July','November'};
%Colormap and continents:
sp = 0.01;
clim = [0 0.3];
sp = 0.1e-8;
clim = [0 3e-8];
sp = 0.05e-9;
clim = [0 1e-9];
sp = 0.5;
clim = [-20 0];
sp = 2;
clim = [-30 0];
% $$$ sp = 0.5;
% $$$ clim = [-20 0];
% $$$ sp = 1;
% $$$ clim = [-30 0];
% $$$ sp = 0.01;
% $$$ clim = [0 0.3];
% $$$ sp = 1e-9;
% $$$ clim = [0 3e-8];
% $$$ sp = 0.05e-9;
% $$$ clim = [0 1e-9];
% $$$ sp = 0.2;
% $$$ clim = [0 10];
cCH = 2; % 0 = symmetric redblue
% 1 = negative definite parula
% 2 = negative parula with +ve's possible
if (cCH==0)
cpts = [-1e10 clim(1):sp:clim(2) 1e10];
npts = length(cpts);
cmap = redblue(npts-3);
for i=1:(npts-3)
if (cmap(i,:) == 1.0)
cmap(i,:) = [0.94 0.94 0.94];
end
end
elseif (cCH>=1)
cpts = [-1e10 clim(1):sp:clim(2) 1e10];
npts = length(cpts);
cmap = parula(npts-3);
cmap(end,:) = [0.97 0.97 0.8];
cmap(end-1,:) = (cmap(end-1,:)+cmap(end,:))/2;
end
if (cCH == 2)
% $$$ buf = 12;
buf = 2;
onebin = 0; % only allow one pink bin
clim = [clim(1) buf*sp];
cpts = [-1e10 clim(1):sp:clim(2) 1e10];
if (onebin)
for ii = 1:buf
cmap(end+1,:) = cmap(npts-3,:);
end
cmap(end,:) = [1 0.7 0.9]; % last pink bin
else
cmap(end+1,:) = cmap(end,:); % 1st positive bin
cmap(end+buf-1,:) = [1 0.7 0.9]; % last pink bin
for ii = 1:(buf-2)
cmap(end-buf+1+ii,:) = cmap(end,:)*ii/(buf-1) + ...
cmap(end-buf+1,:)*(buf-1-ii)/(buf-1);
end
end
end
% $$$ cmap = flipud(cmap);
% MOM025 kb3seg example:
labels = {'(a) Numerical Mixing','(b) Vertical Mixing'};%,'(c) KDS75','(d) KDS100','(e) KDS135'};
% $$$ labels = {strrep(RUNS{rr}{1},'_',' ')}
poss = [0.1300 0.4800 0.4154 0.3355; ...
0.1300 0.1100 0.4154 0.3355;];
% $$$ % ACCESS-OM2 vertical res:
% $$$ labels = {'(a) KDS50','(b) GFDL50','(c) KDS75','(d) KDS100','(e) KDS135','(f) KDS50 - $\Delta t=1.5$hr'};
% $$$ poss = [0.0886 0.7160 0.3375 0.2581; ...
% $$$ 0.4503 0.7160 0.3375 0.2581; ...
% $$$ 0.0886 0.4163 0.3375 0.2581; ...
% $$$ 0.4503 0.4163 0.3375 0.2581; ...
% $$$ 0.0886 0.1142 0.3375 0.2581];
% $$$ % ACCESS-OM2 extras:
% $$$ labels = {'(a) ACCESS-OM2-1-KDS50','(b) ACCESS-OM2-1-KDS50 with $\Delta t=1.5$hr','(c) ACCESS-OM2-025-NG','(d) $1/4^\circ$','(e) $1/4^\circ$ R'};
% $$$
% $$$ % MOM025 Control dif vars:
% $$$ labels = {'(a) $\overline{u''u''}+\overline{v''v''}$', ...
% $$$ '(b) $\overline{w''w''}$','(c) $|\Delta_x T|^2 + |\Delta_y T|^2$','(d) $|\Delta_z T|^2$'};
% $$$ units = {'$m^2s^{-2}$','$m^2s^{-2}$','$^\circ C^2$','$^\circ C^2$'};
% $$$ poss = [0.05500 0.48100 0.4 0.3355; ...
% $$$ 0.53500 0.48100 0.4 0.3355; ...
% $$$ 0.05500 0.1100 0.4 0.3355; ...
% $$$ 0.53500 0.1100 0.4 0.3355;];
% $$$ figure;
set(gcf,'Position',[1923 5 1366 998]);
% $$$ set(gcf,'Position',[1 36 1920 970]);
set(gcf,'defaulttextfontsize',15);
set(gcf,'defaultaxesfontsize',15);
rr = 1;
for i=1:length(months)
subplot(2,1,1);
% $$$ subplot(3,2,rr);
% $$$ subplot(3,3,9);%rr);
contourf(Xi,nanmonmean(Zi(:,:,months{i}),3,ndays(months{i})),nanmonmean(var(:,:,months{i}),3,ndays(months{i})),cpts,'linestyle','none');
% $$$ contourf(Xu,-Zu,nanmonmean(var(:,:,months{i}),3,ndays(months{i})),cpts,'linestyle','none');
hold on;
Tout = nanmonmean(temp(:,:,months{i}),3,ndays(months{i}));
Tout(Tout==0) = NaN;
[c,h] = contour(Xt,-Zt,Tout,[0:1:35],'-k');
clabel(c,h,[0:2:35]);
% $$$ [c,h] = contour(Xt,-Zt,Tout,[22.5 22.5],'-k','linewidth',2);
% $$$ if (strcmp(model,'MOM01'))
% $$$ mnu = monthsu01{i};
% $$$ else
% $$$ mnu = months{i};
% $$$ end
% $$$ ucol = [0.8706 0.4902 0];
% $$$ [c,h] = contour(Xu,-Zu,mean(u(:,:,mnu),3),[-2:0.2:-0.2],'--', ...
% $$$ 'color',ucol);
% $$$ [c,h] = contour(Xu,-Zu,mean(u(:,:,mnu),3),[0.2:0.2:2],'-', ...
% $$$ 'color',ucol);
% $$$ clabel(c,h,'color','w');
% $$$ plot(Xu(:,1),-monmean(mld(:,months{i}),2,ndays(months{i})),'--','color',[0 0.5 0],'linewidth',3);
ylim([-200 0]);
% $$$ plot(Xt(1:10:end,:),-Zt(1:10:end,:),'.','color',[0.5 0.5 0.5]);
% $$$ xlim([-80 -12]);
xlim([-200 -80]);
% $$$ if (rr == 2 | rr == 4 | rr == 5)
% $$$ if (rr >= 1)
cb = colorbar;
% $$$ ylabel(cb,units{rr});
ylabel(cb,'Wm$^{-2}$');
% $$$ end
% $$$ if (rr >=2)
% $$$ if (rr>=4)
xlabel('Longitude ($^\circ$E)');
% $$$ end
% $$$ if (rr==1 | rr == 3 | rr == 5)
ylabel('Depth (m)');
% $$$ end
% $$$ if (rr == 2 | rr == 4)
% $$$ set(gca,'yticklabel',[]);
% $$$ end
% $$$ if (rr <= 1)
% $$$ set(gca,'xticklabel',[]);
% $$$ end
caxis(clim);
% $$$ text(-199,-15,labels{rr},'Backgroundcolor','w','FontSize',15,'margin',0.5);
text(-199,-10,labels{rr},'Backgroundcolor','w','FontSize',15,'margin',0.5);
set(gca,'Position',poss(rr,:));
% $$$ title([strrep(strrep(strrep(strrep(strrep(RUNS{rr}{1},'_',' '),'ACCESS-OM2 ' ...
% $$$ ,'AOM'),' jra55',''),' may',''),'ryf8485 ','') ...
% $$$ ' Vertical Mixing']);
end
colormap(gca, cmap);
%colormap(cmap);
end
% $$$ end
% $$$ %%% Latitudinal Slices:
% $$$
% $$$ % Load Base Variables:
% $$$ base = '/srv/ccrc/data03/z3500785/mom/mat_data/';
% $$$ model = 'MOM025_kb3seg';
% $$$ outputs = [75:79];
% $$$ load([base model sprintf('_output%03d_BaseVars.mat',outputs(1))]);
% $$$ ndays = diff(time_snap);
% $$$
% $$$ % Load Variable and calculate mean:
% $$$ lonsl = 110;
% $$$ load([base model sprintf(['_output%03d_varsat_' num2str(lonsl) 'W.mat'],outputs(1))]);
% $$$ vars = {'temp','u','v','kappa','taux','tauy','mld','vdif','vnlc','pmer','sufc','swrd'};
% $$$ for i=1:length(vars)
% $$$ eval([vars{i} 'a = ' vars{i} ';']);
% $$$ end
% $$$ for i=2:length(outputs)
% $$$ load([base model sprintf(['_output%03d_varsat_' num2str(lonsl) 'W.mat'],outputs(i))]);
% $$$ for i=1:length(vars)
% $$$ eval([vars{i} 'a = ' vars{i} 'a + ' vars{i} ';']);
% $$$ end
% $$$ end
% $$$ for i=1:length(vars)
% $$$ eval([vars{i} ' = ' vars{i} 'a/length(outputs);']);
% $$$ eval(['clear ' vars{i} 'a;']);
% $$$ end
% $$$ if(max(max(max(temp)))>100)
% $$$ temp = temp-273.15;
% $$$ end
% $$$
% $$$ [yL,zL,tL] = size(temp);
% $$$ TL = length(T);
% $$$
% $$$ % Depth of isotherms:
% $$$ Zi = zeros(yL,TL,tL);
% $$$ for ti=1:tL
% $$$ for yi=1:yL
% $$$ tvec = squeeze(temp(yi,:,ti));
% $$$ zvec = -Zt(yi,:);
% $$$ tvec(isnan(tvec)) = -1000;
% $$$ tvec = tvec - 0.01*(1:zL);
% $$$ Zi(yi,:,ti) = interp1(tvec,zvec,T,'linear');
% $$$ ind = find(~isnan(Zi(yi,:,ti)),1,'last');
% $$$ Zi(yi,(ind+1):end,ti) = max(zvec);%linspace(Zi(yi,ind;
% $$$ end
% $$$ end
% $$$ Yi = repmat(Yt(:,1),[1 TL]);
% $$$
% $$$ var = cumsum(vdif,2,'reverse'); % Vertical Mixing Flux
% $$$
% $$$ %Colormap and continents:
% $$$ sp = 5;
% $$$ clim = [-150 0];
% $$$
% $$$ cCH = 1; % 0 = symmetric redblue
% $$$ % 1 = negative definite parula
% $$$ % 2 = negative parula with +ve's possible
% $$$ if (cCH==0)
% $$$ cpts = [-1e10 clim(1):sp:clim(2) 1e10];
% $$$ npts = length(cpts);
% $$$ cmap = redblue(npts-3);
% $$$ for i=1:(npts-3)
% $$$ if (cmap(i,:) == 1.0)
% $$$ cmap(i,:) = [0.94 0.94 0.94];
% $$$ end
% $$$ end
% $$$ elseif (cCH>=1)
% $$$ cpts = [-1e10 clim(1):sp:clim(2) 1e10];
% $$$ npts = length(cpts);
% $$$ cmap = parula(npts-3);
% $$$ cmap(end,:) = [0.97 0.97 0.8];
% $$$ cmap(end-1,:) = (cmap(end-1,:)+cmap(end,:))/2;
% $$$ end
% $$$ if (cCH == 2)
% $$$ buf = 6;
% $$$ clim = [clim(1) buf*sp];
% $$$ cpts = [-1e10 clim(1):sp:clim(2) 1e10];
% $$$ cmap(end+1,:) = cmap(end,:); % 1st positive bin
% $$$ cmap(end+buf-1,:) = [1 0.7 0.9]; % last pink bin
% $$$ for ii = 1:(buf-2)
% $$$ cmap(end-buf+1+ii,:) = cmap(end,:)*ii/(buf-1) + ...
% $$$ cmap(end-buf+1,:)*(buf-1-ii)/(buf-1);
% $$$ end
% $$$ end
% $$$
% $$$ % $$$ var = (vdif+vnlc)/rho0/Cp*86400; % Vertical Mixing Transformation
% $$$ % $$$ var = (pmer+sufc)/rho0/Cp*86400; % Surface Forcing Transformation
% $$$ % $$$ clim = [-1 1]*1e-5*86400; % FOR WMT
% $$$ % $$$ sp = 0.1*1e-5*86400;
% $$$ % $$$ doWMT = 1;
% $$$
% $$$ months = {[1:12],[3],[8]};
% $$$ monthsu01 = {[1:4],[1],[3],[4]};
% $$$ labels = {'Annual','March','August'};
% $$$
% $$$ % $$$ %Save for schematic:
% $$$ % $$$ Xl = Yi;
% $$$ % $$$ Yl = nanmonmean(Zi(:,:,months{i}),3,ndays(months{i}));
% $$$ % $$$ Zl = nanmonmean(vdif(:,:,months{i}),3,ndays(months{i}));
% $$$ % $$$ XlC = Yt;
% $$$ % $$$ YlC = -Zt;
% $$$ % $$$ ZlC = monmean(temp(:,:,months{i}),3,ndays(months{i}));
% $$$
% $$$ % $$$ [tmp Eqind] = min(abs(Yu(:,1)));
% $$$ % $$$ tauweight = abs(taux(Eqind,:))*200;
% $$$ % $$$ % Wind stress vectors:
% $$$ % $$$ sp =5;
% $$$ % $$$ yvec = Yu(:,1);
% $$$ figure;
% $$$ set(gcf,'Position',[1 36 1920 970]);
% $$$ set(gcf,'defaulttextfontsize',20);
% $$$ set(gcf,'defaultaxesfontsize',20);
% $$$ for i=1:length(months)
% $$$ subplot(3,1,i);
% $$$ contourf(Yi,nanmonmean(Zi(:,:,months{i}),3,ndays(months{i})),nanmonmean(var(:,:,months{i}),3,ndays(months{i})),cpts,'linestyle','none');
% $$$ hold on;
% $$$ [c,h] = contour(Yt,-Zt,monmean(temp(:,:,months{i}),3,ndays(months{i})),[0:1:35],'-k');
% $$$ clabel(c,h,[0:2:35]);
% $$$ [c,h] = contour(Yt,-Zt,monmean(temp(:,:,months{i}),3, ...
% $$$ ndays(months{i})),[21.5 21.5],'-k','linewidth',2);
% $$$ if (strcmp(model,'MOM01'))
% $$$ mnu = monthsu01{i};
% $$$ else
% $$$ mnu = months{i};
% $$$ end
% $$$ ucol = [0.8706 0.4902 0];
% $$$ [c,h] = contour(Yu,-Zu,mean(u(:,:,mnu),3),[-2:0.2:-0.2],'--', ...
% $$$ 'color',ucol);
% $$$ [c,h] = contour(Yu,-Zu,mean(u(:,:,mnu),3),[0.2:0.2:2],'-', ...
% $$$ 'color',ucol);
% $$$ plot(Yu(:,1),-monmean(mld(:,months{i}),2,ndays(months{i})),'--','color',[0 0.5 0],'linewidth',3);
% $$$ ylim([-200 0]);
% $$$ %ylim([-250 0]);
% $$$ xlim([-10 10]);
% $$$ cb = colorbar;
% $$$ if (doWMT)
% $$$ ylabel(cb,'m/day');
% $$$ else
% $$$ ylabel(cb,'Wm$^{-2}$');
% $$$ end
% $$$ xlabel('Latitude ($^\circ$N)');
% $$$ ylabel('Depth (m)');
% $$$ caxis(clim);
% $$$ text(-9.6,-188,labels{i},'Backgroundcolor','w','FontSize',20);
% $$$ text(9.6,-188,[num2str(lonsl) '$^\circ$W'],'Backgroundcolor','w','FontSize',20,'HorizontalAlignment','Right');
% $$$
% $$$ % $$$ %Add wind-stress vectors:
% $$$ % $$$ pos = get(gca,'Position')
% $$$ % $$$ wsh = axes('Position',[pos(1) pos(2)+pos(4)+0.005 pos(3) 0.03]);
% $$$ % $$$ % $$$ for ii=1:sp:length(yvec)
% $$$ % $$$ plot(0,0,'o','MarkerSize',abs(mean(mean(taux(yvec>=-10 & yvec<=10,months{i}),2),1))*200);
% $$$ % $$$ hold on;
% $$$ % $$$ % $$$ end
% $$$ % $$$ %quiver(yvec,zeros(size(yvec)),mean(taux(1:sp:end,months{i}),2),mean(tauy(1:sp:end,months{i}),2));
% $$$ % $$$ xlim([-10 10]);
% $$$ % $$$ ylim([-1 1]);
% $$$ % $$$ box off;axis off;
% $$$ % $$$ set(wsh,'Position',[[pos(1) pos(2)+pos(4)+0.005 pos(3) 0.03]]);
% $$$
% $$$ LabelAxes(gca,i,20,0.008,0.95);
% $$$ end
% $$$ colormap(cmap);
% $$$