/[MITgcm]/MITgcm_contrib/gael/matlab_class/sample_analysis/plot_one_field.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/sample_analysis/plot_one_field.m

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


Revision 1.11 - (hide annotations) (download)
Thu Jun 23 19:02:50 2011 UTC (15 years, 4 months ago) by gforget
Branch: MAIN
Changes since 1.10: +10 -0 lines
gcmfaces_misc	added headers to all routines
				added depthStretch.m and depthStretchPlot.m
				> removed myverticaldeform.m, verticalplot.m
				and runmean_cycle.m
				rewritten runmean.m
				> removed nanrunmean.m, nanrunmean_cycle.m and runmean_cycle.m
gcmfaces_legacy	added nanrunmean.m, nanrunmean_cycle.m, runmean_cycle.m
				myverticaldeform.m, verticalplot.m
plot_one_field	added example of depthStretchPlot
basic_diags_display_transport	added header

1 gforget 1.9 function []=plot_one_field(choiceV3orV4,plotMethod);
2     %object: illustrate several methods to plot fields within gcmfaces.
3     %inputs: choiceV3orV4 ('v3' or 'v4') selects the sample GRID
4     % plotMethod selects the plotting method
5     % 0) all, one after the other
6     % 1) plot a gcmfaces object face by face
7     % 2) use convert2array then plot in array coordinates.
8     % 3) use convert2pcol then plot in lat-lon coordinates.
9     % 4) use the gcmfaces front end to m_map.
10    
11     input_list_check('plot_one_field',nargin);
12 gforget 1.1
13     %%%%%%%%%%%%%%%%%
14     %load parameters:
15     %%%%%%%%%%%%%%%%%
16 gforget 1.9 gcmfaces_path;
17     dir0=[gcmfaces_dir '/sample_input/'];
18     dirGrid=[dir0 '/GRID' choiceV3orV4 '/'];
19     dirIn=[dir0 '/SAMPLE' choiceV3orV4 '/'];
20     if strcmp(choiceV3orV4,'v4'); nF=5; fileFormat='compact'; else; nF=1; fileFormat='straight'; end;
21     global mygrid; mygrid=[]; grid_load(dirGrid,nF,fileFormat);
22 gforget 1.1
23     %%%%%%%%%%%
24     %get field:
25     %%%%%%%%%%%
26 gforget 1.2 nameFld='DDtheta'; tt=0; if strcmp(choiceV3orV4,'v4'); kk=30; else; kk=14; end; cc=[-2 8];
27 gforget 1.9 fld=rdmds2gcmfaces([dirIn nameFld],tt);
28 gforget 1.1 fld=fld(:,:,kk); msk=mygrid.hFacC(:,:,kk); fld(find(msk==0))=NaN;
29 gforget 1.9
30 gforget 1.1 %%%%%%%%%%%%
31     %plot field:
32     %%%%%%%%%%%%
33 gforget 1.9
34     if plotMethod==0|plotMethod==1;
35     if nF==1;
36     figure; imagescnan(fld{1}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
37     elseif nF==5;
38     figure;
39     subplot(3,3,7); imagescnan(fld{1}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
40     subplot(3,3,8); imagescnan(fld{2}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
41     subplot(3,3,5); imagescnan(fld{3}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
42     subplot(3,3,6); imagescnan(fld{4}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
43     subplot(3,3,3); imagescnan(fld{5}','nancolor',[1 1 1]*0.8); axis xy; caxis(cc);
44     elseif nF==6;
45     error('face by face plot for cude : not yet implemented');
46     end;
47     end;
48    
49     if plotMethod==0|plotMethod==2;
50     figure;
51     FLD=convert2array(fld);
52     imagescnan(FLD','nancolor',[1 1 1]*0.8); axis xy; caxis(cc); colorbar;
53     end;
54    
55     if plotMethod==0|plotMethod==3;
56     figure;
57     [X,Y,FLD]=convert2pcol(mygrid.XC,mygrid.YC,fld); pcolor(X,Y,FLD);
58     if ~isempty(find(X>359)); axis([0 360 -90 90]); else; axis([-180 180 -90 90]); end;
59     shading flat; caxis(cc); colorbar; xlabel('longitude'); ylabel('latitude');
60 gforget 1.2 end;
61 gforget 1.1
62 gforget 1.9 if plotMethod==0|plotMethod==4;
63     if ~isempty(which('m_proj'));
64 gforget 1.10 figure; m_map_gcmfaces(fld,0,{'myCaxis',cc});
65     figure; m_map_gcmfaces(fld,0,{'myCaxis',[-2:0.5:2 3:5 7:2:12]});
66 gforget 1.9 else;
67     fprintf('if you want to use m_map_gcmfaces, you will need to have m_map in your path\n');
68     end;
69     end;
70    
71 gforget 1.11 %test case for depthStretchPlot:
72     if plotMethod==0|plotMethod==5;
73     x=ones(50,1)*[1:200]; z=mygrid.RC*ones(1,200); c=sin(z/2000*pi).*cos(x/50*pi);
74     figure;
75     subplot(1,2,1); pcolor(x,z,c); shading flat; title('standard depth display');
76     subplot(1,2,2); depthStretchPlot('pcolor',{x,z,c}); shading flat; title('stretched depth display');
77     % subplot(1,2,1); plot(c(:,1),z(:,1)); title('standard depth display');
78     % subplot(1,2,2); depthStretchPlot('plot',{c(:,1),z(:,1)}); title('stretched depth display');
79     end;
80    
81 gforget 1.9

  ViewVC Help
Powered by ViewVC 1.1.22