forked from cultpenguin/mGstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisorange.m
99 lines (84 loc) · 1.76 KB
/
isorange.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
% isorange : convert range scaling to gstat/gslib range settings
%
%
% for example
% V = '1.0 Sph(0.7,0.8,0.9)';
%
% Vgstat=isorange(V);
% format_variogram(Vgstat,1)
%
% Used when 'options.isorange=1'
%
function V=isorange(V);
if isstruct(V)==0
V=deformat_variogram(V);
end
for iV=1:length(V),
ndim=length(V(iV).par2);
if ndim==2,
% 2 dimensional scaling
rx=V(iV).par2(1);
ry=V(iV).par2(2);
if (rx>ry)
V(iV).par2=[rx 90 ry/rx];
else
V(iV).par2=[ry 0 rx/ry];
end
end
if ndim==3,
% 3 dimensional scaling
rx=V(iV).par2(1);
ry=V(iV).par2(2);
rz=V(iV).par2(3);
if ((rx>ry)&(rx>rz))
% X-dir the principal direction
p=90;
q=0;
a=rx;
if (ry>rz)
% Y-dir secondary direction
r=0;
s=ry/rx;
t=rz/rx;
else
% Z-dir secondary direction
r=90;
s=rz/rx;
t=ry/rx;
end
elseif ((ry>rx)&(ry>rz))
% Y-dir the principal direction
p=0;
q=0;
a=ry;
if (rx>rz)
% X-dir secondary direction
r=0;
s=rx/ry;
t=rz/ry;
else
% Z-dir secondary direction
r=90;
s=rz/ry;
t=rx/ry;
end
else
% Z-dir the principal direction
p=90;
q=360-90;
a=rz;
if (rx>ry)
% X-dir secondary direction
r=90;
s=rx/rz;
t=ry/rz;
else
% Y-dir secondary direction
r=0;
s=ry/rz;
t=rx/rz;
end
end
V(iV).par2=[a p q r s t];
end
end