Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit c8ded9cb on 2015-02-27 18:41:33 UTC
5b87528e9c Dimi*0001 function mycrossmap(fld,cx,label,mask,col)
5c8ebfdb00 Dimi*0002 
c8ded9cb75 Dimi*0003 % Function mycrossmap(fld,cx,label,mask,col)
5c8ebfdb00 Dimi*0004 % plot a cube sphere field as a cross
                0005 % fixes a discontinuity at edges of cube faces
                0006 % requires mypcolor.m
                0007 %
                0008 % INPUTS
                0009 % fld   input cube sphere field (n,6,n) where n is the face dimension
                0010 % cx    two element vector [cmin cmax] sets scaling for caxis
                0011 % label colorbar label
5b87528e9c Dimi*0012 % mask  landmask: 0 is land, 1 is ocean
5c8ebfdb00 Dimi*0013 
b2bfaeeabf Dimi*0014 clf reset
                0015 
                0016 for f=1:6
                0017   eval(['a' int2str(f) '=squeeze(fld(:,' int2str(f) ',:));']);
                0018 end
                0019 
5c8ebfdb00 Dimi*0020 if nargin<2
5b87528e9c Dimi*0021   cx=[min(fld(:)) max(fld(:))];
5c8ebfdb00 Dimi*0022 end
                0023 
                0024 if nargin<3
5b87528e9c Dimi*0025   label='';
5c8ebfdb00 Dimi*0026 end
                0027 
b2bfaeeabf Dimi*0028 cm=colormap;
5b87528e9c Dimi*0029 if nargin>3
                0030   if nargin<5
                0031     col=[1 1 1]*.5;
                0032   end
                0033   fld(find(fld<cx(1)))=cx(1);
                0034   fld(find(fld>cx(2)))=cx(2);
                0035   cm=[col; cm; col];
                0036   colormap(cm)
                0037   fld(find(mask==0))=nan;
                0038 end
                0039 
                0040 c1=cx(1)-2*(cx(2)-cx(1))/length(cm);
                0041 c2=cx(2)+2*(cx(2)-cx(1))/length(cm);  
                0042 
b2bfaeeabf Dimi*0043 if nargin>3
                0044   for f=1:6
                0045     eval(['in=find(isnan(a' int2str(f) '));']);
                0046     eval(['a' int2str(f) '(in(1))=c1;']);
                0047     eval(['a' int2str(f) '(in(2:end))=c2;']);
                0048   end
5b87528e9c Dimi*0049 end
5c8ebfdb00 Dimi*0050 
                0051 tmp=cat(1,a2,rot90(a4,-1),rot90(a5,-1),a1);
                0052 
                0053 subplot('position',[.05 .35 .9 .3])
                0054 h1=mypcolor(tmp');
                0055 pos=get(gca,'position');
                0056 set(gca,'visible','off')
                0057 
                0058 ax3=axes('position',[pos(1)+pos(3)/4*2 pos(2)+pos(4) pos(3)/4 pos(4)]);
                0059 h31=mypcolor(rot90(a3',2));
                0060 set(gca,'visible','off')
                0061 
                0062 ax6=axes('position',[pos(1)+pos(3)/4*2 pos(2)-pos(4) pos(3)/4 pos(4)]);
                0063 h61=mypcolor(rot90(a6'));
                0064 set(gca,'visible','off')
                0065 
                0066 axx=findobj(gcf,'type','axes');
5b87528e9c Dimi*0067 set(axx,'clim',[c1 c2])
5c8ebfdb00 Dimi*0068 
                0069 %old versions
                0070 %ax=colorbar('position',[pos(1)+pos(3)/4/2/2 pos(2)+pos(4)*1.5 pos(3)/4*1.5 pos(4)/5]);
                0071 %colorbar(ax)
                0072 
                0073 %new for R2009
                0074 ax=colorbar('location','southoutside');
                0075 set(ax,'position',[pos(1)+pos(3)/4/2/2 pos(2)+pos(4)*1.5 pos(3)/4*1.5 pos(4)/5]);
                0076 set(get(ax,'xlabel'),'string',label)
5b87528e9c Dimi*0077 set(ax,'XLim',cx)