forked from csdms-contrib/slepian_alpha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eqband.m
70 lines (63 loc) · 1.7 KB
/
eqband.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
function varargout=eqband(res,inclang)
% XY=eqband(res,inclang)
% eqband(...) % Only makes a plot
%
% Finds the coordinates of a band on the sphere
%
% INPUT:
%
% res 0 The standard, default values
% N Splined values at N times the resolution
% inclang Inclination angle, determines size polar caps
%
% OUTPUT:
%
% XY Closed-curved coordinates of the continent
%
% SEE ALSO: ALLOCEANS
%
% Written by D.C. Slobbe, 21/10/2010
% Last modified by fjsimons-at-alum.mit.edu, 11/1/2010
defval('res',0)
defval('inclang',66.15);
% The directory where you keep the coordinates
whereitsat=fullfile(getenv('IFILES'),'COASTS');
if res==0
fnpl=fullfile(whereitsat,sprintf('eqband-%5.2f.mat',inclang));
else
fnpl=fullfile(whereitsat,sprintf('eqband-%5.2f-%i.mat',inclang,res));
end
if exist(fnpl,'file')==2
load(fnpl)
if nargout==0
plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on
else
varns={XY};
varargout=varns(1:nargout);
end
else
if res==0
% Resolution seems overkill to me, but let's leave it
NX=3599;
X=linspace(0.1,359.9,NX)';
NY=round(inclang/90*NX/2)+1;
Y=linspace(inclang,-inclang,NY)';
XY=[[X ; ones(NY,1)*360 ; flipud(X) ; zeros(NY,1) ],...
[ones(NX,1)*-inclang ; flipud(Y) ; ones(NX,1)*inclang ; Y]];
XY(:,1)=XY(:,1)+360;
% Eyeball
plot(XY(:,1),XY(:,2),'LineW',2,'Color','k');
axis equal
% Check this out %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
curvecheck(XY(:,1),XY(:,2))
% Check this out %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
save(fnpl,'XY')
else
XY =eqband(0);
XYb=bezier(XY,res);
XY=XYb;
save(fnpl,'XY')
end
varns={XY};
varargout=varns(1:nargout);
end