NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/colorband_fe.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %-----------------------------------------------------------------------
2 % [smin,smax,ibw]=colorband_fe(in,x,y,bnd,scalar,smin,smax,ibw)
3 % This function creates a color banded plot using
4 % Matlab5.1 commands and the jet color map.
5 %-----------------------------------------------------------------------
6 function [smin,smax,ibw]=colorband_fe(in,x,y,bnd,scalar,smin,smax,ibw)
7 %
8 % Echo scalar range to screen
9 %
10 fprintf(1,'Scalar Range: %f to %f\n',min(min(scalar)),max(max(scalar)))
11 %
12 % Set color banding settings (if 5 arguments are sent to function)
13 %
14 if nargin == 5
15    smin=input('Enter min contour level desired: ');
16    smax=input('Enter max contour level desired: ');
17    ibw  =input('Enter the contour interval:      ');
18 end
19 %
20 % Set color bands
21 %
22 cval=smin:ibw:smax;
23 nband=(2*ibw+smax-smin)/ibw;
24 cmapjet=jet;
25 size(cmapjet);
26 njet=ans(1);
27 clear cmap;
28 cmap(1,:)=[0 0 0];
29 for i=2:nband-1
30    cmap(i,:)=cmapjet(1+round((njet-1)*(i-2)/(nband-3)),:);
31 end
32 cmap(nband,:)=[1 1 1];
33 %
34 % Generate plot
35 %
36 scalara=max(scalar,smin-ibw);
37 scalara=min(scalar,smax+ibw);
38 hpb=plotbnd4(x,y,bnd);set(hpb,'color','k');
39 hl=lcontour4(in,x,y,scalara,cval);
40 hc=colormeshm(in,x,y,scalara);colormap(cmap);caxis([smin-ibw smax+ibw]);
41 hb=colorbar;set(hb,'ytick',cval);set(hb,'ticklength',[0.05 0.025]);
42 set(hb,'FontSize',1.0);
43 for l=1:nband-1
44    if cval(l)>=min(scalara) & cval(l)<=max(scalara)
45       set(hl(l),'color','k');
46    end
47 end
48 clear cmap;
49
Note: See TracBrowser for help on using the browser.