/[MITgcm]/MITgcm/utils/matlab/plotcube.m
ViewVC logotype

Diff of /MITgcm/utils/matlab/plotcube.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by adcroft, Tue May 29 14:01:40 2001 UTC revision 1.3 by adcroft, Thu Aug 30 15:29:26 2001 UTC
# Line 1  Line 1 
1  function [] = plotcube(X,Y,Z,C)  function [] = plotcube(XX,YY,C)
2    % plotcube(x,y,c)
3    %
4    % Plots cubed-sphere data in 3D on sphere. (x,y) are
5    % coordinates, c is cell-centered scalar to be plotted.
6    % Dimensions should be N+1 x N+1 x 6 for (x,y)
7    % and                   N  x  N  x 6 for c
8    %
9    % The default plotting mode is shading faceted. Using this or
10    % shading flat, (x,y) should be the coordinates of grid-corners
11    % and can legitimately have dimension (N+1)x(N+1)x6.
12    %
13    % If using shading interp, then (x,y) must be the coordinates of
14    % the cell centers with same dimensions as c.
15    %
16  % e.g.  % e.g.
 % load CUBE_3DGRID  
 % tt=rdmds('TTtave.0000103680');  
 % plotcube(XG,YG,ZG,tt(:,:,1))  
17  %  %
18  %  %  % xg=rdmds('XG');
19  %  %  % yg=rdmds('YG');
20    % ps=rdmds('Eta.0000000000');
21    % plotube(xg,yg,ps);
22    %
23    % xc=rdmds('XC');
24    % yc=rdmds('YC');
25    % plotube(xg,yg,ps);shading interp
26    
27    if max(max(max(YY)))-min(min(min(YY))) < 3*pi
28     X=tiles(XX*180/pi,1:6);
29     Y=tiles(YY*180/pi,1:6);
30    else
31     X=tiles(XX,1:6);
32     Y=tiles(YY,1:6);
33    end
34    Q=tiles(C,1:6);
35    
36    % Assume model grid corner coordinates were provided.
37    if size(X,1)==size(Q,1)
38     X(end+1,:,:)=NaN;
39     X(:,end+1,:)=NaN;
40     X(end,:,[1 3 5])=X(1,:,[2 4 6]);
41     X(:,end,[2 4 6])=X(:,1,[3 5 1]);
42     X(:,end,[1 3 5])=squeeze(X(1,end:-1:1,[3 5 1]));
43     X(end,:,[2 4 6])=squeeze(X(end:-1:1,1,[4 6 2]));
44     Y(end+1,:,:)=NaN;
45     Y(:,end+1,:)=NaN;
46     Y(end,:,[1 3 5])=Y(1,:,[2 4 6]);
47     Y(:,end,[2 4 6])=Y(:,1,[3 5 1]);
48     Y(:,end,[1 3 5])=squeeze(Y(1,end:-1:1,[3 5 1]));
49     Y(end,:,[2 4 6])=squeeze(Y(end:-1:1,1,[4 6 2]));
50    end
51    [nx ny nt]=size(X);
52    
53  n=size(C,2);  z=sin(Y*pi/180);
54    x=cos(Y*pi/180).*cos(X*pi/180);
55    y=cos(Y*pi/180).*sin(X*pi/180);
56    
57  surf(X(:,:,1),Y(:,:,1),Z(:,:,1),C(1:n,:))  surf(x(:,:,1),y(:,:,1),z(:,:,1),Q(:,:,1))
58  hold on  hold on
59  for j=2:6  for j=2:6
60   surf(X(:,:,j),Y(:,:,j),Z(:,:,j),C((j-1)*n+1:j*n,:))   surf(x(:,:,j),y(:,:,j),z(:,:,j),Q(:,:,j))
61  end  end
62  hold off  hold off
63  xlabel('X');  xlabel('X');

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22