Back to home page

MITgcm

 
 

    


Warning, /utils/matlab/cs_grid/plotcube.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
cb815fa54d Alis*0001 function [] = plotcube(XX,YY,C)
                0002 % plotcube(x,y,c)
                0003 %
                0004 % Plots cubed-sphere data in 3D on sphere. (x,y) are
                0005 % coordinates, c is cell-centered scalar to be plotted.
                0006 % Dimensions should be N+1 x N+1 x 6 for (x,y)
                0007 % and                   N  x  N  x 6 for c
                0008 %
                0009 % The default plotting mode is shading faceted. Using this or
                0010 % shading flat, (x,y) should be the coordinates of grid-corners
                0011 % and can legitimately have dimension (N+1)x(N+1)x6.
                0012 %
                0013 % If using shading interp, then (x,y) must be the coordinates of
                0014 % the cell centers with same dimensions as c.
                0015 %
aea29c8517 Alis*0016 % e.g.
                0017 %
cb815fa54d Alis*0018 % xg=rdmds('XG');
                0019 % yg=rdmds('YG');
                0020 % ps=rdmds('Eta.0000000000');
                0021 % plotube(xg,yg,ps);
                0022 %
                0023 % xc=rdmds('XC');
                0024 % yc=rdmds('YC');
                0025 % plotube(xg,yg,ps);shading interp
f8d374081f Jean*0026 %
                0027 % Written by adcroft@.mit.edu, 2001.
cb815fa54d Alis*0028 if max(max(max(YY)))-min(min(min(YY))) < 3*pi
                0029  X=tiles(XX*180/pi,1:6);
                0030  Y=tiles(YY*180/pi,1:6);
                0031 else
                0032  X=tiles(XX,1:6);
                0033  Y=tiles(YY,1:6);
                0034 end
                0035 Q=tiles(C,1:6);
                0036 
                0037 % Assume model grid corner coordinates were provided.
                0038 if size(X,1)==size(Q,1)
                0039  X(end+1,:,:)=NaN;
                0040  X(:,end+1,:)=NaN;
                0041  X(end,:,[1 3 5])=X(1,:,[2 4 6]);
                0042  X(:,end,[2 4 6])=X(:,1,[3 5 1]);
                0043  X(:,end,[1 3 5])=squeeze(X(1,end:-1:1,[3 5 1]));
                0044  X(end,:,[2 4 6])=squeeze(X(end:-1:1,1,[4 6 2]));
90134473cd Dani*0045  X(1,end,[1 3 5]) = X(1,1,1);
                0046  X(end,1,[2 4 6]) = X(end,end,2);
cb815fa54d Alis*0047  Y(end+1,:,:)=NaN;
                0048  Y(:,end+1,:)=NaN;
                0049  Y(end,:,[1 3 5])=Y(1,:,[2 4 6]);
                0050  Y(:,end,[2 4 6])=Y(:,1,[3 5 1]);
                0051  Y(:,end,[1 3 5])=squeeze(Y(1,end:-1:1,[3 5 1]));
                0052  Y(end,:,[2 4 6])=squeeze(Y(end:-1:1,1,[4 6 2]));
90134473cd Dani*0053  Y(1,end,[1 3 5]) = Y(end,end,1);
                0054  Y(end,1,[2 4 6]) = Y(1,1,2);
cb815fa54d Alis*0055 end
                0056 [nx ny nt]=size(X);
aea29c8517 Alis*0057 
cb815fa54d Alis*0058 z=sin(Y*pi/180);
                0059 x=cos(Y*pi/180).*cos(X*pi/180);
                0060 y=cos(Y*pi/180).*sin(X*pi/180);
aea29c8517 Alis*0061 
cb815fa54d Alis*0062 surf(x(:,:,1),y(:,:,1),z(:,:,1),Q(:,:,1))
aea29c8517 Alis*0063 hold on
                0064 for j=2:6
cb815fa54d Alis*0065  surf(x(:,:,j),y(:,:,j),z(:,:,j),Q(:,:,j))
aea29c8517 Alis*0066 end
                0067 hold off
                0068 xlabel('X');
                0069 ylabel('Y');
                0070 zlabel('Z');