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

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/merccubedmodel.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 [] = merccube(XX,YY,C)
2
3 [nnx ny]=size(C);
4
5 if max(max(max(YY)))-min(min(min(YY))) < 3*pi
6 fac=180/pi;
7 else
8 fac=1;
9 end
10 X(1:ny,1:ny,1)=fac*XX(0*ny+(1:ny),1:ny);
11 X(1:ny,1:ny,2)=fac*XX(1*ny+(1:ny),1:ny);
12 X(1:ny,1:ny,3)=fac*XX(2*ny+(1:ny),1:ny);
13 X(1:ny,1:ny,4)=fac*XX(3*ny+(1:ny),1:ny);
14 X(1:ny,1:ny,5)=fac*XX(4*ny+(1:ny),1:ny);
15 X(1:ny,1:ny,6)=fac*XX(5*ny+(1:ny),1:ny);
16 X(end+1,:,:)=2*X(end,:,:)-X(end-1,:,:);
17 X(:,end+1,:)=2*X(:,end,:)-X(:,end-1,:);
18 Y(1:ny,1:ny,1)=fac*YY(0*ny+(1:ny),1:ny);
19 Y(1:ny,1:ny,2)=fac*YY(1*ny+(1:ny),1:ny);
20 Y(1:ny,1:ny,3)=fac*YY(2*ny+(1:ny),1:ny);
21 Y(1:ny,1:ny,4)=fac*YY(3*ny+(1:ny),1:ny);
22 Y(1:ny,1:ny,5)=fac*YY(4*ny+(1:ny),1:ny);
23 Y(1:ny,1:ny,6)=fac*YY(5*ny+(1:ny),1:ny);
24 Y(end+1,:,:)=2*Y(end,:,:)-Y(end-1,:,:);
25 Y(:,end+1,:)=2*Y(:,end,:)-Y(:,end-1,:);
26
27 Q(1:ny,1:ny,1)=C(0*ny+(1:ny),1:ny);
28 Q(1:ny,1:ny,2)=C(1*ny+(1:ny),1:ny);
29 Q(1:ny,1:ny,3)=C(2*ny+(1:ny),1:ny);
30 Q(1:ny,1:ny,4)=C(3*ny+(1:ny),1:ny);
31 Q(1:ny,1:ny,5)=C(4*ny+(1:ny),1:ny);
32 Q(1:ny,1:ny,6)=C(5*ny+(1:ny),1:ny);
33 Q(end+1,:,:)=0;
34 Q(:,end+1,:)=0;
35
36 [nx ny nt]=size(X)
37
38 hnx=ceil(nx/2);
39 hny=ceil(ny/2);
40
41 k=1;
42 pcolor(X(:,:,k),Y(:,:,k),Q(:,:,k))
43
44 axis([min(min(min(X))) max(max(max(X))) min(min(min(Y))) max(max(max(Y)))]);
45 hold on
46
47 k=2;
48 pcolor(X(:,:,k),Y(:,:,k),Q(:,:,k))
49
50 k=3;
51 pcolor(mod(X(:,1:hnx,k)+360,360),Y(:,1:hnx,k),Q(:,1:hnx,k))
52 x=mod(X(:,hnx:nx,k)+359.999,360)-359.999;
53 x(find(x<-180))=x(find(x<-180))+180;
54 pcolor(x,Y(:,hnx:nx,k),Q(:,hnx:nx,k))
55
56 k=4;
57 pcolor(mod(X(:,:,k)+360,360),Y(:,:,k),Q(:,:,k))
58 pcolor(mod(X(:,:,k)+360,360)-360,Y(:,:,k),Q(:,:,k))
59
60 k=5;
61 pcolor(X(:,:,k),Y(:,:,k),Q(:,:,k))
62
63 k=6;
64 x=mod(X(1:hnx,:,k)+359.999,360)-359.999;
65 x(find(x<-180))=x(find(x<-180))+180;
66 pcolor(x,Y(1:hnx,:,k),Q(1:hnx,:,k))
67 pcolor(mod(X(hnx:nx,:,k)+360,360),Y(hnx:nx,:,k),Q(hnx:nx,:,k))
68
69 hold off

  ViewVC Help
Powered by ViewVC 1.1.22