-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreparetanplot.m
38 lines (35 loc) · 1.02 KB
/
preparetanplot.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
function varargout=preparetanplot(data)
% [dat,dmax]=PREPARETANPLOT(data)
%
% Returns the intensity (if data is a struct, then the intensity of
% data{1})
%
% INPUT:
%
% data data(:,:,1) is a 2d array containing the values of the vector
% field in longitudinal direction,(phi)
% data(:,:,2) is a 2d array containing the values of the vector
% field in latitudinal direction (theta)
% OR:
% data is a struct, where data{1} as mentioned before
%
% OUTPUT:
%
% dat 2d array containing the intensity values of the vectors (the
% negative to make the plotting colors in kelicol red). First
% dimension is lat, second is lon)
% dmax Maximum intensity value
%
% See also KELICOL
%
% Last modified by plattner-at-alumni.ethz.ch, 02/27/2012
if iscell(data)
absdata=sqrt(data{1}(:,:,1).^2+data{1}(:,:,2).^2);
else
absdata=sqrt(data(:,:,1).^2+data(:,:,2).^2);
end
dmax=max(max(absdata)); thresh=100;
dat=-absdata;
dat(abs(dat)<dmax/thresh)=0;
varns={dat,dmax};
varargout=varns(1:nargout);