Warning, /utils/matlab/cs_grid/bk_line/grph_CS_6t.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 4ec37fd8 on 2023-10-03 22:00:32 UTC
aaa179f648 Jean*0001 function grph_CS_6t(var,c1,c2,nc,titv,Cgrd)
0002 % grph_CS_6t(var,c1,c2,[nc],[titv]) : plot 1 field on the 6 faces of the CS-grid
0003 % c1 < c2 = min & max for the color graph
0004 % c1 > c2 = scale with min,max of the field, + c1/100 and + c2/100
0005 % nc = nb of grid pts (interior only) in 1 direction for 1 face of the cube
4ec37fd829 Jean*0006 % (default: nc=32); if halo are included => size(var) > nc*nc*6
aaa179f648 Jean*0007 % titv = title
0008 % Cgrd : C-grid position: 0 = center ; 1 = U-vel ; 2 = V-vel ; 3 = Z-point
0009
0010 if nargin < 6, Cgrd=0; end
0011 if nargin < 5, ktit=0; titv=' '; else ktit=1; end
0012 if nargin < 4, nc=32; end
4ec37fd829 Jean*0013
aaa179f648 Jean*0014 dim=length(size(var));
4ec37fd829 Jean*0015 if dim==2,
0016 n1h=size(var,1); n2h=size(var,2);
0017 if n1h == 6*n2h, nx=n2h;
0018 var=permute(reshape(var,[nx 6 nx]),[1 3 2]);
0019 elseif n1h*6 == n2h, nx=n1h;
0020 var=reshape(var,[nx nx 6]);
0021 else
0022 error([' var size: ',int2str(n1h),' x ',int2str(n2h),' does not fit regular cube !']);
0023 end
0024 ny=nx;
0025 else
0026 nx=size(var,1); ny=size(var,2);
0027 end
aaa179f648 Jean*0028
4ec37fd829 Jean*0029 olx=nx-nc; oly=ny-nc;
0030 if rem(olx,2) == 0,
0031 %- symmetric overlap in X:
0032 olx=olx/2;
0033 else
0034 %- non-symmetric: if centered, larger overlap at the beginning; if edge, at the end :
0035 if rem(Cgrd,2) == 0, olx=ceil(olx/2);
0036 else olx=floor(olx/2); end
0037 end
0038 if rem(oly,2) == 0,
0039 %- symmetric overlap in U:
0040 oly=oly/2;
aaa179f648 Jean*0041 else
4ec37fd829 Jean*0042 %- non-symmetric: if centered, larger overlap at the beginning; if edge, at the end :
0043 if Cgrd < 2, oly=ceil(oly/2);
0044 else oly=floor(oly/2); end
aaa179f648 Jean*0045 end
4ec37fd829 Jean*0046 xax=[1:nx]-.5-olx; yax=[1:ny]-.5-oly;
0047 if rem(Cgrd,2) == 1, xax=xax-.5; end
0048 if Cgrd > 1, yax=yax-.5; end
0049 fprintf(' nx,ny= %i, %i ; olx,oly= %4.1f,%4.1f ; xax range: %5.1f,%5.1f ; yax: %5.1f,%5.1f\n', ...
0050 nx,ny,olx,oly,xax(1),xax(end),yax(1),yax(end));
0051 j1=0; j2=nc;
0052
0053 mn=min(var(:)); mx=max(var(:));
aaa179f648 Jean*0054 if c1 >= c2
0055 mb=(mx-mn)*0.01;
0056 c1=mn+mb*c1;
0057 c2=mx+mb*c2;
0058 end
4ec37fd829 Jean*0059 fprintf(' min,max %8.3e %8.3e ; Cmin,max %8.3e %8.3e \n',mn,mx,c1,c2)
0060 have_subP=exist('def_subP');
0061 if have_subP == 2, [xyP]=def_subP(6,0.04,0.08); end
0062 xtxt=xax(4); ytxt=yax(1)-ny/8;
aaa179f648 Jean*0063 %------
0064 for n=1:6
4ec37fd829 Jean*0065 if have_subP == 2, axes('position',xyP(n,:)); else subplot(320+n); end
0066 v1t=var(:,:,n);
aaa179f648 Jean*0067 imagesc(xax,yax,v1t') ; caxis([c1 c2]);set(gca,'YDir','normal') ;
0068 grid;
4ec37fd829 Jean*0069 if nx > nc || ny > nc,
aaa179f648 Jean*0070 hold on;
0071 [L]=line([j1 j2 j2 j1 j1],[j1 j1 j2 j2 j1]);
0072 hold off; set(L,'color',[0 0 0]);
0073 end
0074 title(['Face Nb : ',int2str(n)]);
4ec37fd829 Jean*0075 if n == 5, text(xtxt,ytxt,sprintf('min= %9.5g ', mn)); end
0076 if n == 6, text(xtxt,ytxt,sprintf('Max= %9.5g ', mx)); end
aaa179f648 Jean*0077 end
0078 %------
0079 H=colorbar('WestOutside');
4ec37fd829 Jean*0080 set(H,'position',[0.510 0.036 0.008 0.25]);
aaa179f648 Jean*0081 if ktit == 1,
0082 axes('position',[.01,.01,.99,.99],'Visible','off');
0083 [T]=text(0.5,0.97,titv);
0084 set(T,'HorizontalAlignment','center','FontSize',12);
0085 end
0086 return