-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_attr.m
31 lines (24 loc) · 976 Bytes
/
do_attr.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
function [s_attr] = do_attr(s_cfg, varname)
%function [s_attr] = do_attr(s_cfg, varname)
%
% s_attr = struct(...
% 'units', units,...
% 'colorlim', colorlim,...
% 'varname', varname);
%reads variable attributes
switch (s_cfg.filetype)
case 'cdf'
[units, attunits] = attnc(s_cfg.file, varname, 'units');
[mincolor, minimum] = attnc(s_cfg.file, varname, 'minimum');
[maxcolor, maximum] = attnc(s_cfg.file, varname, 'maximum');
case 'nc'
units = nc_attget(s_cfg.file, varname, 'units');
mincolor = nc_attget(s_cfg.file, varname, 'minimum');
maxcolor = nc_attget(s_cfg.file, varname, 'maximum');
otherwise
end
colorlim = [mincolor maxcolor];
s_attr = struct(...
'units', units,...
'colorlim', colorlim,...
'varname', varname);