/[MITgcm]/MITgcm_contrib/high_res_cube/eddy_flux/grph_CS.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/eddy_flux/grph_CS.m

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


Revision 1.3 - (show annotations) (download)
Wed Aug 18 22:08:19 2004 UTC (20 years, 11 months ago) by edhill
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
 o more routines for all of the {UV}(TSB} products

1 function grph_CS(var,xcs,ycs,xcg,ycg,c1,c2,shift)
2 % grph_CS(var,xcs,ycs,xcg,ycg,c1,c2,shift) : produce a flat plot of the
3 % cube_sphere "var" keeping the initial grid (no interpolation, use "surf")
4 % xcs,ycs,xcg,ycg = center + corner grid point coordinates
5 % c1 < c2 = min & max for the color graph
6 % c1 > c2 = scale with min,max of the field, + c1/100 and + c2/100
7 % shift=-1 : No coast-line
8 % else : draw coast-line shifted by "shift" degree.
9 %-----------------------
10
11 % EH3: longitudes must be within the interval: (-180,180]
12 if (min(min(xcs)) <= -180) || (180 < max(max(xcs))) ...
13 || (min(min(xcg)) <= -180) || (180 < max(max(xcg)))
14 disp('Error: longitudes must be within (-180,180]')
15 return
16 end
17
18 % EH3: latitudes must be within the interval: [-90,90]
19 if (min(min(ycs)) < -90) || (90 < max(max(ycs))) ...
20 || (min(min(ycg)) < -90) || (90 < max(max(ycg)))
21 disp('Error: latitudes must be within [-90,90]')
22 return
23 end
24
25 %------------------------------
26 nc=size(var,2) ; ncp=nc+1 ;
27 mx=min(min(var));
28 mn=max(max(var));
29 for j=1:nc,
30 for i=1:6*nc,
31 if var(i,j) ~= NaN
32 mn=min(var(i,j),mn); mx=max(var(i,j),mx);
33 end
34 end
35 end
36 %------------
37 if c1 >= c2
38 mb=(mx-mn)*0.01;
39 c1=mn+mb*c1;
40 c2=mx+mb*c2;
41 if c1*c2 < 0
42 c2=max(abs([c1 c2]));
43 c1=-c2;
44 end
45 fprintf('min,max %8.3e %8.3e Cmin,max %8.3e %8.3e \n',mn,mx,c1,c2)
46 end
47 %------------------------------
48 %figure(1);
49 if shift ~= -1
50 path('/u/u0/jmc/MATLAB',path);
51 set_axis
52 fac=rad ;
53 else
54 fac=1. ;
55 end
56 %---
57 nbsf = 0 ; ic = 0 ; jc = 0 ;
58 [xx2]=split_Z_cub(xcg);
59 [yy2]=split_Z_cub(ycg);
60 %---
61 for n=[ 1:6 ],
62 %if n < 5 & n > 2,
63 if n < 7,
64 %--------------------------------------------------------
65 i0=nc*(n-1);
66 vv1=zeros(ncp,ncp) ; xx1=vv1 ; yy1=vv1 ;
67 for j=1:nc,
68 for i=1:nc,
69 vv1(i,j)=var(i0+i,j) ;
70 end
71 end
72 for j=1:nc,
73 vv1(ncp,j)=vv1(nc,j) ;
74 end
75 for i=1:nc,
76 vv1(i,ncp)=vv1(i,nc) ;
77 end
78 vv1(ncp,ncp)=vv1(nc,nc) ;
79 %-----
80 xx1=xx2(:,:,n);
81 yy1=yy2(:,:,n);
82 if xx1(ncp,1) < -300. ; xx1(ncp,1)=xx1(ncp,1)+360. ; end
83 if xx1(1,ncp) < -300. ; xx1(1,ncp)=xx1(1,ncp)+360. ; end
84 %------------
85 if shift <= -360
86 %--- Jump ? (only for debug diagnostic) :
87 for i=1:nc
88 for j=1:nc,
89 if abs(xx1(i,j)-xx1(i,j+1)) > 120
90 fprintf('N: i,J,xx_j,j+1,+C %3i %3i %3i %8.3e %8.3e %8.3e \n', ...
91 n, i,j,xx1(i,j), xx1(i,j+1), xcs(i0+i,j) ) ;
92 end
93 if abs(xx1(i,j)-xx1(i+1,j)) > 120
94 fprintf('N: I,j,xx_i,i+1,+C %3i %3i %3i %8.3e %8.3e %8.3e \n', ...
95 n, i,j,xx1(i,j), xx1(i+1,j), xcs(i0+i,j) ) ;
96 end
97 end
98 end
99 %---
100 end
101 %--------------------------------------
102 % case where Xc jump from < 180 to > -180 when j goes from jc to jc+1
103
104 if n == 4 | n == 3
105 jc = nc/2 + 1;
106 nbsf=part_surf(nbsf,fac,xx1,yy1,vv1,1,ncp,1,jc,c1,c2) ;
107 for i=1:ncp,
108 if xx1(i,jc) > 120 ; xx1(i,jc)= xx1(i,jc)-360. ; end
109 if yy1(i,jc) == 90 & xx1(i,jc) == 90, xx1(i,jc)=-90; end
110 end
111 nbsf=part_surf(nbsf,fac,xx1,yy1,vv1,1,ncp,jc,ncp,c1,c2) ;
112 %---
113 % case where Xc jump from < -180 to > 180 when i goes from ic to ic+1
114 elseif n == 6
115 ic = nc/2 + 1;
116 nbsf=part_surf(nbsf,fac,xx1,yy1,vv1,ic,ncp,1,ncp,c1,c2) ;
117 for j=1:ncp,
118 if xx1(ic,j) > 120 ; xx1(ic,j)= xx1(ic,j)-360. ; end
119 if yy1(ic,j) == -90 & xx1(ic,j) == 90, xx1(ic,j)=-90; end
120 end
121 nbsf=part_surf(nbsf,fac,xx1,yy1,vv1,1,ic,1,ncp,c1,c2) ;
122 else
123 nbsf=part_surf(nbsf,fac,xx1,yy1,vv1,1,ncp,1,ncp,c1,c2) ;
124 end
125 %--------------------------------------
126 end
127 end
128 hold off
129 if shift ~= -1
130 m_proj('Equidistant Cylindrical','lat',90,'lon',[-180+shift 180+shift])
131 %m_proj('Equidistant Cylindrical','lat',[-0 60],'lon',[-180+shift 180+shift])
132 m_coast('color',[0 0 0]);
133 m_grid('box','on')
134 end
135
136 %--
137 scalHV_colbar([1.0 1.0 0.7 0.7],0);
138 if shift == -1,
139 text(-150*fac,-150*fac,sprintf('min,Max= %9.5g , %9.5g', mn, mx))
140 %set(gca,'position',[-.1 0.2 0.8 0.75]); % xmin,ymin,xmax,ymax in [0,1]
141 else
142 text(0.,-150.*fac,sprintf('min,Max= %9.5g , %9.5g', mn, mx))
143 end
144 return
145 %----------------------------------------------------------------------
146 function nbsf=part_surf(nbsf,fac,xx,yy,vv,i1,i2,j1,j2,c1,c2)
147 S=surf(fac*xx(i1:i2,j1:j2),fac*yy(i1:i2,j1:j2), ...
148 zeros(i2+1-i1,j2+1-j1),vv(i1:i2,j1:j2)) ;
149 if c1 < c2, caxis([c1 c2]) ; end
150 set(S,'LineStyle','-','LineWidth',0.01);
151 set(S,'EdgeColor','none');
152 %set(S,'Clipping','off');
153 %get(S) ;
154 %nbsf = nbsf+1 ; if nbsf == 1 ; hold on ; view(0,90) ; end
155 nbsf = nbsf+1 ; if nbsf == 1 ; hold on ; view(0,90) ; end
156 %axis([-180 0 -90 30]) ; % work only without coast-line
157 %axis([90 180 -60 0]) ; % work only without coast-line
158 axis([-180 180 -90 90]) ; % work only without coast-line
159 %axis([30 60 -45 -25]) ; % work only without coast-line
160 return
161 %----------------------------------------------------------------------
162

  ViewVC Help
Powered by ViewVC 1.1.22