-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample_draw_transect.m
More file actions
79 lines (66 loc) · 2.5 KB
/
example_draw_transect.m
File metadata and controls
79 lines (66 loc) · 2.5 KB
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
%==========================================================================
% matFVCOM toolbox
%
% example: Draw transect figures
% --- f_load_grid
% --- f_transect_mesh
% --- f_transect_image
% --- f_transect_contour
% --- f_transect_mask_bottom
%
% Siqi Li, SMAST
% 2021-03-22
%==========================================================================
clc
clear
%--------------------------------------------------------------------------
% The location of the section. Only the turning pionts are needed.
xy=[-70.88333333 41.19666667 % L1
-70.88333333 41.03000000 % L2
-70.88333333 40.86333333 % L3
-70.88333333 40.69666667 % L4
-70.88333333 40.51333333 % L5
-70.88333333 40.36333333 % L6
-70.88333333 40.22666667 % L7
-70.88333333 40.09833333 % L9
-70.88333333 39.94000000 % L10
-70.88333333 39.77333333 % L11
];
station_list = {'L1';'L2';'L3';'L4';'L5';'L6';'L7';'L9';'L10';'L11';};
zlims = [-500 0];
d0 = sqrt((xy(:,1)-xy(1,1)).^2+(xy(:,2)-xy(1,2)).^2);
%--------------------------------------------------------------------------
% Input file path and name
file = 'H:\tools\matFVCOM\data\gom3_example.nc';
%--------------------------------------------------------------------------
% Draw FVCOM transect mesh figure (layer and level)
f = f_load_grid(file, 'geo');
figure
hold on
h1 = f_transect_mask_bottom(f, xy(:,1), xy(:,2), zlims);
h2 = f_transect_mesh(f, 'layer', xy(:,1), xy(:,2), zlims, 'linestyle', '--');
h3 = f_transect_mesh(f, 'level', xy(:,1), xy(:,2), zlims, 'linestyle', '-');
set(gca, 'xtick', d0)
set(gca, 'xticklabel', {'L1';'L2';'L3';'L4';'L5';'L6';'L7';'L9';'L10';'L11';})
%--------------------------------------------------------------------------
% Draw FVCOM transect image figure: temperature (on node)
temp = ncread(file, 'temp', [1 1 1], [Inf Inf 1]);
figure
colormap(jet)
hold on
h1 = f_transect_image(f, temp, xy(:,1), xy(:,2), zlims);
colorbar
h2 = f_transect_mask_bottom(f, xy(:,1), xy(:,2), zlims);
set(gca, 'xtick', d0)
set(gca, 'xticklabel', station_list)
%--------------------------------------------------------------------------
% Draw FVCOM transect image figure: temperature (on cell)
u = ncread(file, 'u', [1 1 1], [Inf Inf 1]);
figure
hold on
h1 = f_transect_image(f, u, xy(:,1), xy(:,2), zlims);
colorbar
h2 = f_transect_contour(f, u, xy(:,1), xy(:,2), zlims);
h3 = f_transect_mask_bottom(f, xy(:,1), xy(:,2), zlims);
set(gca, 'xtick', d0)
set(gca, 'xticklabel', station_list)