/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/plotcube.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/plotcube.m

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


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch: MAIN, initial
CVS Tags: baseline, HEAD
Changes since 1.1: +0 -0 lines
Checking in work done with Dimitri on high-resolution cube gridding and parallel 
communications. 
   o code is in a contrib experiment for now so we can continue collaborating
     on it. However most code is general and will be moved into main branch once 
     it is fully hardened.
   o There are README files in the contrib root and in the subdirectories that
     explain the contents

1 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.
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,:,:)=2*X(end,:,:)-X(end-1,:,:);
41 X(:,end+1,:)=2*X(:,end,:)-X(:,end-1,:);
42 X(end,:,[1 3 5])=X(1,:,[2 4 6]);
43 X(:,end,[2 4 6])=X(:,1,[3 5 1]);
44 X(:,end,[1 3 5])=squeeze(X(1,end:-1:1,[3 5 1]));
45 X(end,:,[2 4 6])=squeeze(X(end:-1:1,1,[4 6 2]));
46 %Y(end+1,:,:)=NaN;
47 %Y(:,end+1,:)=NaN;
48 Y(end+1,:,:)=2*Y(end,:,:)-Y(end-1,:,:);
49 Y(:,end+1,:)=2*Y(:,end,:)-Y(:,end-1,:);
50 Y(end,:,[1 3 5])=Y(1,:,[2 4 6]);
51 Y(:,end,[2 4 6])=Y(:,1,[3 5 1]);
52 Y(:,end,[1 3 5])=squeeze(Y(1,end:-1:1,[3 5 1]));
53 Y(end,:,[2 4 6])=squeeze(Y(end:-1:1,1,[4 6 2]));
54 end
55 [nx ny nt]=size(X);
56
57 z=sin(Y*pi/180);
58 x=cos(Y*pi/180).*cos(X*pi/180);
59 y=cos(Y*pi/180).*sin(X*pi/180);
60
61 surf(x(:,:,1),y(:,:,1),z(:,:,1),Q(:,:,1))
62 hold on
63 for j=2:6
64 surf(x(:,:,j),y(:,:,j),z(:,:,j),Q(:,:,j))
65 end
66 hold off
67 xlabel('X');
68 ylabel('Y');
69 zlabel('Z');

  ViewVC Help
Powered by ViewVC 1.1.22