
%
% this creates global variables for gcm:
%
% N:      number of intervals per patch at lat=0
% topo:   1-degree topographic map - thank you MATLAB
% cmap:   a colormap to display topo on a sphere
% pow:    the power used in mapping the octahedron to the sphere
% x,y,z:  positions of the 2N+1 by 2N+1 array of nodes
% aks:    axes-handle used by show(lat,lng) 
%
% uses [u1,v1,w1]=cnodes(N)           [-pi/2,pi/2],[0,pi/2]
% and  [x1,y1,z1]=nvrtrf(u1,v1,w1,pow)
%

global N pow topo cmap x y z;



if ~size(topo) 
   load topo;                              % go get it
   cmap=(2+topomap1)/3;                    % lighten it up
   clear topomap1 topomap2 topolegend;     % clean it up
end

if size(N)
   NN=input(sprintf('\n?? change N = %d to N = ',N));
   if size(NN) N=NN; end
else N=input('give us N : '); end

if size(pow)
   pww=input(sprintf('\n?? change pow = %g to pow = ',pow));
   if size(pww) pow=pww; end
else pow=input('give us pow (between 1 and 3) : '); end

[u1,v1,w1]=cnodes(N); [x1,y1,z1]=nvrtrf(u1,v1,w1,pow);

x=-x1; x=[flipud(x);x(2:end,:)]; x=[x(:,1:end-1),-fliplr(x)];
y=-y1; y=[flipud(y1);y(2:end,:)]; y=[y(:,1:end-1),fliplr(y)];
z=[flipud(z1);z1(2:end,:)]; z=[z(:,1:end-1),fliplr(z)];

if get(0,'child') close; end            % so show will redraw

str=sprintf('\nshow South America ? (null for yes)\n');
if ~size(input(str,'s')) show(-20,-50); disp(' '); end  

help show


clear NN pww str u1 v1 w1 x1 y1 z1
