-
Notifications
You must be signed in to change notification settings - Fork 2
/
example_draw_2d.m
69 lines (54 loc) · 1.7 KB
/
example_draw_2d.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
%==========================================================================
% matFVCOM toolbox
%
% example: Draw 2d figures
% --- f_load_grid
% --- f_2d_mesh
% --- f_2d_image
% --- f_2d_contour
% --- f_2d_boundary
% --- f_2d_mask_boundary
%
% Siqi Li, SMAST
% 2021-03-22
%==========================================================================
clc
clear
%--------------------------------------------------------------------------
% Input file path and name
file = 'H:\tools\matFVCOM\data\gom3_example.nc';
%--------------------------------------------------------------------------
% Draw FVCOM 2d mesh figure, and highlight the boundary lines
f = f_load_grid(file, 'xy');
figure
hold on
h1 = f_2d_mesh(f);
h2 = f_2d_boundary(f);
axis([min(f.x) max(f.x) min(f.y) max(f.y)])
%--------------------------------------------------------------------------
% Draw FVCOM 2d image figure on node: zeta
zeta = ncread(file, 'zeta', [1 1], [Inf 1]);
figure
h = f_2d_image(f, zeta);
colorbar
%--------------------------------------------------------------------------
% Draw FVCOM 2d contour figure on node: temperature
temp = ncread(file, 'temp', [1 1 1], [Inf 1 1]);
figure
hold on
h1 = f_2d_image(f, temp);
h2 = f_2d_contour(f, temp);
h3 = f_2d_mask_boundary(f);
colorbar
axis([min(f.x) max(f.x) min(f.y) max(f.y)])
%--------------------------------------------------------------------------
% Draw FVCOM 2d image & contour figure on cell: current velocity
u = ncread(file, 'u', [1 1 1], [Inf 1 1]);
v = ncread(file, 'v', [1 1 1], [Inf 1 1]);
current = sqrt(u.^2 + v.^2);
figure
hold on
h1 = f_2d_image(f, current);
h2 = f_2d_contour(f, current, 'TextList', [0.5 1 1.5]);
colorbar
caxis([0 2])