-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_vars.m
61 lines (52 loc) · 1.95 KB
/
get_vars.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
function list = get_vars(s_cfg, s_cds, s_at, s_us, ...
bl_corner, tr_corner, ...
m_bl_corner, m_tr_corner, ...
bat_bl_corner, bat_tr_corner)
%function var2d = get_var(s_cfg, s_at, bl_corner, tr_corner, m_bl_corner, m_tr_corner...
% bat_bl_corner, bat_tr_corner)
%
% Extracts the MOHID netcdf data with the landmask and the bathymetry
%
%Gets the typical variable called by the user
[var2d mask batim] = get_var(s_cfg, s_at, bl_corner, ...
tr_corner, m_bl_corner, m_tr_corner,...
bat_bl_corner, bat_tr_corner);
switch(s_us.type)
case 'map'
case 'xz'
%Is it the meridional velocity we want to plot?
if (strcmp(s_at.varname,'v') || strcmp(s_at.varname,'Vel_Y'))
var2d = -1 .* var2d;
end
case 'yz'
otherwise
end
%Fill the gaps
switch (s_cfg.maskit)
case 'mask'
var2d = var2d .* mask;
case 'interpol'
var2d = interpol(var2d);
end
var2d = var2d * s_cfg.scalecolor;
%Do we want to plot a vector field?
%If yes, then we also want to plot the bathymetry contour
if s_cfg.plot_vectors
s_ataux = s_at;
%Get u_component
s_ataux.varname = s_cfg.u_vec;
u_var = get_var(s_cfg, s_ataux, bl_corner, tr_corner, ...
m_bl_corner, m_tr_corner,...
bat_bl_corner, bat_tr_corner);
u_var = u_var * s_cfg.scalecolor;
%Get v_component
s_ataux.varname = s_cfg.v_vec;
v_var = get_var(s_cfg, s_ataux, bl_corner, tr_corner, ...
m_bl_corner, m_tr_corner,...
bat_bl_corner, bat_tr_corner);
v_var = v_var * s_cfg.scalecolor;
list = {var2d, mask, batim, u_var, v_var};
%No? Then we simply add the user-given variable to our list
else
list = {var2d, mask, batim};
end