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