/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_maps/m_map_gcmfaces.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_maps/m_map_gcmfaces.m

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


Revision 1.6 - (hide annotations) (download)
Fri Aug 5 21:48:40 2011 UTC (13 years, 11 months ago) by gforget
Branch: MAIN
Changes since 1.5: +14 -12 lines
- added parameter : {'myCmap',myCmap} is the colormap name ('jet' by default).

1 gforget 1.1 function []=m_map_gcmfaces(fld,varargin);
2 gforget 1.3 %object: gcmfaces front end to m_map
3     %inputs: fld is the 2D field to be mapped
4 gforget 1.4 %optional: proj is either the index (integer; 0 by default) of pre-defined
5     % projection(s) or parameters to pass to m_proj (cell)
6     %more so: other optional paramaters can be provided ONLY AFTER proj,
7     % and must take the following form {'name',param1,param2,...}
8 gforget 1.6 % those that are currently active are
9 gforget 1.4 % {'myCaxis',myCaxis} is the color axis ('auto' by default)
10     % {'do_m_coast',do_m_coast} adds call to m_coast (1; default) or not (0).
11 gforget 1.6 % {'myCmap',myCmap} is the colormap name ('jet' by default)
12 gforget 1.3 %
13 gforget 1.4 %notes: - for proj==0 (i.e. the default) three panels will be plotted :
14     % a mercator projection over mid-latitude, and two polar
15 gforget 1.3 % stereographic projections.
16 gforget 1.4 % - myCaxis can be specified with more than 2 values, in which
17     % case gcmfaces_cb will be used. The other predefined proj are
18 gforget 1.3 % -1 mollweide or cylindrical projection
19     % 1 mercator projection only
20     % 2 arctic stereographic projection only
21     % 3 antarctic stereographic projection only
22 gforget 1.4 %
23     % - myTitle is currently not used; it will take the form
24     % {'myTitle',myTitle} is the title (none by default)
25 gforget 1.1
26 gforget 1.2 %check that m_map is in the path
27     aa=which('m_proj'); if isempty(aa); error('this function requires m_map that is missing'); end;
28    
29 gforget 1.1 global mygrid;
30    
31 gforget 1.4 %get optional parameters
32     if nargin>1; proj=varargin{1}; else; proj=0; end;
33     if iscell(proj);
34     error('not yet implemented');
35     else;
36     choicePlot=proj;
37     end;
38     %set more optional paramaters to default values
39 gforget 1.6 myCaxis=[]; myTitle=''; do_m_coast=1; myCmap='jet';
40 gforget 1.4 %set more optional paramaters to user defined values
41     for ii=2:nargin-1;
42     if ~iscell(varargin{ii});
43     warning('inputCheck:m_map_gcmfaces_1',...
44     ['As of june 2011, m_map_gcmfaces expects \n'...
45     ' its optional parameters as cell arrays. \n'...
46     ' Argument no. ' num2str(ii+1) ' was ignored \n'...
47     ' Type ''help m_map_gcmfaces'' for details.']);
48     elseif ~ischar(varargin{ii}{1});
49     warning('inputCheck:m_map_gcmfaces_2',...
50     ['As of june 2011, m_map_gcmfaces expects \n'...
51     ' its optional parameters cell arrays \n'...
52     ' to start with character string. \n'...
53     ' Argument no. ' num2str(ii+1) ' was ignored \n'...
54     ' Type ''help m_map_gcmfaces'' for details.']);
55     else;
56     if strcmp(varargin{ii}{1},'myCaxis')|...
57 gforget 1.6 strcmp(varargin{ii}{1},'myCmap')|...
58 gforget 1.4 strcmp(varargin{ii}{1},'do_m_coast')|...
59     strcmp(varargin{ii}{1},'myTitle');
60     eval([varargin{ii}{1} '=varargin{ii}{2};']);
61     else;
62     warning('inputCheck:m_map_gcmfaces_3',...
63     ['unknown option ''' varargin{ii}{1} ''' was ignored']);
64     end;
65     end;
66     end;
67     %make parameter inferences
68     if length(myCaxis)==0; plotCBAR=0; elseif length(myCaxis)==2; plotCBAR=1; else; plotCBAR=2; end;
69 gforget 1.5 if choicePlot==0; clf; end;
70 gforget 1.4 % set(gcf,'Units','Normalized','Position',[0.05 0.1 0.4 0.8]);
71     % set(gcf,'Renderer','zbuffer');
72 gforget 1.1
73     if choicePlot==-1;
74     %%m_proj('Miller Cylindrical','lat',[-90 90]);
75 gforget 1.3 %m_proj('Equidistant cylindrical','lat',[-90 90]);
76     %m_proj('mollweide','lon',[-180 180],'lat',[-80 80]);
77     m_proj('mollweide','lon',[-180 180],'lat',[-88 88]);
78 gforget 1.1 [xx,yy,z]=convert2pcol(mygrid.XC,mygrid.YC,fld);
79 gforget 1.3 [x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp;
80 gforget 1.1
81 gforget 1.6 if plotCBAR==0; colormap(myCmap); colorbar; elseif plotCBAR==1; caxis(myCaxis); colormap(myCmap); colorbar;
82     else; cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap}); delete(cbar); end;
83 gforget 1.4 if do_m_coast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('xtick',[]);
84 gforget 1.1 end;%if choicePlot==0|choicePlot==1;
85    
86     if choicePlot==0; subplot(2,1,1); end;
87     if choicePlot==0|choicePlot==1;
88     m_proj('Mercator','lat',[-70 70]);
89     [xx,yy,z]=convert2pcol(mygrid.XC,mygrid.YC,fld);
90 gforget 1.3 [x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp;
91 gforget 1.1
92 gforget 1.6 if plotCBAR==0; colormap(myCmap); colorbar; elseif plotCBAR==1; caxis(myCaxis); colormap(myCmap); colorbar;
93     else; cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap}); delete(cbar); end;
94 gforget 1.4 if do_m_coast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid;
95 gforget 1.1 end;%if choicePlot==0|choicePlot==1;
96    
97 gforget 1.6 %if choicePlot==0; cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap}); title(myTitle); end;
98 gforget 1.3
99 gforget 1.1 if choicePlot==0; subplot(2,2,3); end;
100     if choicePlot==0|choicePlot==2;
101     m_proj('Stereographic','lon',0,'lat',90,'rad',40);
102     xx=convert2arctic(mygrid.XC);
103     yy=convert2arctic(mygrid.YC);
104     z=convert2arctic(fld);
105 gforget 1.3 [x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp;
106 gforget 1.1
107 gforget 1.6 if plotCBAR==0; colormap(myCmap); colorbar; elseif plotCBAR==1; caxis(myCaxis); colormap(myCmap); colorbar;
108     else; cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap}); delete(cbar); end;
109 gforget 1.4 if do_m_coast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('XaxisLocation','bottom');
110 gforget 1.1 end;%if choicePlot==0|choicePlot==1;
111    
112     if choicePlot==0; subplot(2,2,4); end;
113     if choicePlot==0|choicePlot==3;
114     m_proj('Stereographic','lon',0,'lat',-90,'rad',40);
115     xx=convert2southern(mygrid.XC);
116     yy=convert2southern(mygrid.YC);
117     z=convert2southern(fld);
118 gforget 1.3 [x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp;
119 gforget 1.1
120 gforget 1.6 if plotCBAR==0; colormap(myCmap); colorbar; elseif plotCBAR==1; caxis(myCaxis); colormap(myCmap); colorbar;
121     else; cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap}); delete(cbar); end;
122 gforget 1.4 if do_m_coast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('XaxisLocation','top');
123 gforget 1.1 end;%if choicePlot==0|choicePlot==1;
124    
125 gforget 1.3 if plotCBAR==2;
126 gforget 1.6 cbar=gcmfaces_cmap_cbar(myCaxis,{'myCmap',myCmap});
127 gforget 1.3 if choicePlot==0;
128     set(cbar,'Position',[0.92 0.15 0.02 0.75]);
129     elseif choicePlot==-1;
130     set(cbar,'Position',[0.92 0.35 0.02 0.3]);
131     elseif choicePlot==1;
132     set(cbar,'Position',[0.92 0.34 0.02 0.35]);
133     else;
134     set(cbar,'Position',[0.92 0.23 0.02 0.55]);
135     end;
136     end;
137 gforget 1.1
138    

  ViewVC Help
Powered by ViewVC 1.1.22