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

Contents of /MITgcm_contrib/gael/matlab_class/gcmfaces_maps/m_map_1face.m

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


Revision 1.2 - (show annotations) (download)
Sun May 2 22:45:19 2010 UTC (15 years, 2 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.1: +7 -9 lines
several minor improvements

1 function []=m_map_1face(fld,iFace,varargin);
2 %purpose:
3 % use m_map to display one face in a chosen projection
4 %synthax:
5 % m_map_1face(fld,iFace,choiceProj);
6 %inputs:
7 % fld is a 2D field in gcmfaces format
8 % iFace is the face number
9 % choiceProj is the projection choice (0, 1, 2, or 3)
10 % if it is not stated, the default is mollweide (0)
11
12 %check that m_map is in the path
13 aa=which('m_proj'); if isempty(aa); error('this function requires m_map that is missing'); end;
14
15 %get parameters:
16 if nargin>2; choiceProj=varargin{1}; else; choiceProj=0; end;
17 if nargin>3; cc=varargin{2}; else; cc=[]; end;
18 if nargin>4; doPlotCoast=varargin{3}; else; doPlotCoast=1; end;
19
20 global mygrid;
21
22 %extract face:
23 x=mygrid.XC{iFace}(:,:);
24 y=mygrid.YC{iFace}(:,:);
25 z=fld{iFace}(:,:);
26 m1=mygrid.mskC{iFace}(:,:,1);
27 if length(size(z))~=2; error('input must be a 2D field in gcmfaces format'); end;
28
29 %put mask on x and y:
30 x(isnan(m1))=NaN; y(isnan(m1))=NaN;
31
32 %enforce [-180 180] longitude convention;
33 x(find(x>180))=x(find(x>180))-360;
34
35 %select lat/lon range:
36 ii=find(~isnan(m1));
37 ll=[min(x(ii)) max(x(ii))];
38 LL=[min(y(ii)) max(y(ii))];
39
40 if choiceProj==0;
41 %%m_proj('Miller Cylindrical','lon',ll,'lat',LL);
42 %%m_proj('Equidistant cylindrical','lon',ll,'lat',LL);
43 m_proj('mollweide','lon',ll,'lat',LL);
44 elseif choiceProj==1;
45 m_proj('Mercator','lon',ll,'lat',LL);
46 elseif choiceProj==2;
47 m_proj('Stereographic','lon',0,'lat',90,'rad',90-LL(1));
48 elseif choiceProj==3;
49 m_proj('Stereographic','lon',0,'lat',-90,'rad',90+LL(2) );
50 end;
51
52 [x,y]=m_ll2xy(x,y);
53 pcolor(x,y,z); shading flat; if ~isempty(cc); caxis(cc); end; colorbar;
54 if doPlotCoast; m_coast('patch',[1 1 1]*.7,'edgecolor','none'); end; m_grid;
55
56

  ViewVC Help
Powered by ViewVC 1.1.22