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 |
|
|
%optional: choicePlot (0 by default) selects the projection(s) |
5 |
|
|
% cc is the color axis ([] by default) |
6 |
|
|
% doPlotCoast (1 by default) sets whether to plot the m_map coast line |
7 |
|
|
% title0 ('' by default) is a title to be added to each panel |
8 |
|
|
% |
9 |
|
|
%notes: - the optional parameters need to be specified in that order |
10 |
|
|
% (choicePlot OR choicePlot,cc OR choicePlot,cc,doPlotCoast OR ...) |
11 |
|
|
% - cc can have more than 2 values, in which case gcmfaces_cb will be used. |
12 |
|
|
% - by default (choicePlot==0) three panels will be plotted : a |
13 |
|
|
% mercator projection over mid-latitude, and two polar |
14 |
|
|
% stereographic projections. |
15 |
|
|
% - the other values of choicePlot correspond to |
16 |
|
|
% -1 mollweide or cylindrical projection |
17 |
|
|
% 1 mercator projection only |
18 |
|
|
% 2 arctic stereographic projection only |
19 |
|
|
% 3 antarctic stereographic projection only |
20 |
|
|
% - title0 is currently not used |
21 |
|
|
% - when using gcmfaces_cmap_cbar with m_map I want it horizontal |
22 |
gforget |
1.1 |
|
23 |
gforget |
1.2 |
%check that m_map is in the path |
24 |
|
|
aa=which('m_proj'); if isempty(aa); error('this function requires m_map that is missing'); end; |
25 |
|
|
|
26 |
gforget |
1.1 |
global mygrid; |
27 |
|
|
|
28 |
|
|
if nargin>1; choicePlot=varargin{1}; else; choicePlot=0; end; |
29 |
|
|
if nargin>2; cc=varargin{2}; else; cc=[]; end; |
30 |
|
|
if nargin>3; doPlotCoast=varargin{3}; else; doPlotCoast=1; end; |
31 |
gforget |
1.3 |
if nargin>4; title0=varargin{4}; else; title0=''; end; |
32 |
|
|
|
33 |
|
|
if length(cc)==0; plotCBAR=0; elseif length(cc)==2; plotCBAR=1; else; plotCBAR=2; end; |
34 |
|
|
if choicePlot==0; clf; orient tall; end; |
35 |
|
|
set(gcf,'Units','Normalized','Position',[0.05 0.1 0.4 0.8]); |
36 |
|
|
set(gcf,'Renderer','zbuffer'); |
37 |
gforget |
1.1 |
|
38 |
|
|
if choicePlot==-1; |
39 |
|
|
%%m_proj('Miller Cylindrical','lat',[-90 90]); |
40 |
gforget |
1.3 |
%m_proj('Equidistant cylindrical','lat',[-90 90]); |
41 |
|
|
%m_proj('mollweide','lon',[-180 180],'lat',[-80 80]); |
42 |
|
|
m_proj('mollweide','lon',[-180 180],'lat',[-88 88]); |
43 |
gforget |
1.1 |
[xx,yy,z]=convert2pcol(mygrid.XC,mygrid.YC,fld); |
44 |
gforget |
1.3 |
[x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp; |
45 |
gforget |
1.1 |
|
46 |
gforget |
1.3 |
if plotCBAR==0; colorbar; elseif plotCBAR==1; caxis(cc); colorbar; |
47 |
|
|
else; cbar=gcmfaces_cmap_cbar(cc); delete(cbar); end; |
48 |
|
|
if doPlotCoast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('xtick',[]); |
49 |
gforget |
1.1 |
end;%if choicePlot==0|choicePlot==1; |
50 |
|
|
|
51 |
|
|
if choicePlot==0; subplot(2,1,1); end; |
52 |
|
|
if choicePlot==0|choicePlot==1; |
53 |
|
|
m_proj('Mercator','lat',[-70 70]); |
54 |
|
|
[xx,yy,z]=convert2pcol(mygrid.XC,mygrid.YC,fld); |
55 |
gforget |
1.3 |
[x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp; |
56 |
gforget |
1.1 |
|
57 |
gforget |
1.3 |
if plotCBAR==0; colorbar; elseif plotCBAR==1; caxis(cc); colorbar; |
58 |
|
|
else; cbar=gcmfaces_cmap_cbar(cc); delete(cbar); end; |
59 |
gforget |
1.1 |
if doPlotCoast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid; |
60 |
|
|
end;%if choicePlot==0|choicePlot==1; |
61 |
|
|
|
62 |
gforget |
1.3 |
%if choicePlot==0; cbar=gcmfaces_cmap_cbar(cc); title(title0); end; |
63 |
|
|
|
64 |
gforget |
1.1 |
if choicePlot==0; subplot(2,2,3); end; |
65 |
|
|
if choicePlot==0|choicePlot==2; |
66 |
|
|
m_proj('Stereographic','lon',0,'lat',90,'rad',40); |
67 |
|
|
xx=convert2arctic(mygrid.XC); |
68 |
|
|
yy=convert2arctic(mygrid.YC); |
69 |
|
|
z=convert2arctic(fld); |
70 |
gforget |
1.3 |
[x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp; |
71 |
gforget |
1.1 |
|
72 |
gforget |
1.3 |
if plotCBAR==0; colorbar; elseif plotCBAR==1; caxis(cc); colorbar; |
73 |
|
|
else; cbar=gcmfaces_cmap_cbar(cc); delete(cbar); end; |
74 |
|
|
if doPlotCoast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('XaxisLocation','bottom'); |
75 |
gforget |
1.1 |
end;%if choicePlot==0|choicePlot==1; |
76 |
|
|
|
77 |
|
|
if choicePlot==0; subplot(2,2,4); end; |
78 |
|
|
if choicePlot==0|choicePlot==3; |
79 |
|
|
m_proj('Stereographic','lon',0,'lat',-90,'rad',40); |
80 |
|
|
xx=convert2southern(mygrid.XC); |
81 |
|
|
yy=convert2southern(mygrid.YC); |
82 |
|
|
z=convert2southern(fld); |
83 |
gforget |
1.3 |
[x,y]=m_ll2xy(xx,yy); pcolor(x,y,z); shading interp; |
84 |
gforget |
1.1 |
|
85 |
gforget |
1.3 |
if plotCBAR==0; colorbar; elseif plotCBAR==1; caxis(cc); colorbar; |
86 |
|
|
else; cbar=gcmfaces_cmap_cbar(cc); delete(cbar); end; |
87 |
|
|
if doPlotCoast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid('XaxisLocation','top'); |
88 |
gforget |
1.1 |
end;%if choicePlot==0|choicePlot==1; |
89 |
|
|
|
90 |
gforget |
1.3 |
if plotCBAR==2; |
91 |
|
|
cbar=gcmfaces_cmap_cbar(cc); |
92 |
|
|
if choicePlot==0; |
93 |
|
|
set(cbar,'Position',[0.92 0.15 0.02 0.75]); |
94 |
|
|
elseif choicePlot==-1; |
95 |
|
|
set(cbar,'Position',[0.92 0.35 0.02 0.3]); |
96 |
|
|
elseif choicePlot==1; |
97 |
|
|
set(cbar,'Position',[0.92 0.34 0.02 0.35]); |
98 |
|
|
else; |
99 |
|
|
set(cbar,'Position',[0.92 0.23 0.02 0.55]); |
100 |
|
|
end; |
101 |
|
|
end; |
102 |
gforget |
1.1 |
|
103 |
|
|
|