/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_calc/disp_transport.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_calc/disp_transport.m

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


Revision 1.1 - (hide annotations) (download)
Fri Jul 8 13:23:39 2011 UTC (14 years ago) by gforget
Branch: MAIN
- new routine to display transport time series and/or time mean.

1 gforget 1.1 function [myplot]=disp_transport(myTransports,myTimes,myTitle,varargin);
2     %object: display transport time series and/or time mean
3     %inputs: myTransports contains the transports as a function of depth and time
4     % myTitle is the transport name to be displayed
5     % myTimes is the time vector
6     %optional: must take the following form {'name',param1,param2,...} where name may be
7     % nmean is a running mean window length (0 by default)
8     % ylim is the y axis range for plotting
9     % choicePlot is the type of plot (1 by default)
10     % 1) time series of vertical integral
11     % 2) time series of overturning magnitude (>0)
12     % 3) time mean profile of transport per grid point
13     % 4) time mean profile of bottom-to-top cumulated transport
14    
15     global mygrid;
16    
17    
18     %set more optional paramaters to default values
19     ylim=[]; nmean=0; choicePlot=1;
20     %set more optional paramaters to user defined values
21     for ii=1:nargin-3;
22     if ~iscell(varargin{ii});
23     warning(inputCheck:disp_transport_1',...
24     ['disp_transport optional parameters must be spc. as cell arrays. \n'...
25     ' Argument no. ' num2str(ii+1) ' was ignored \n'...
26     ' Type ''help disp_transport'' for details.']);
27     elseif ~ischar(varargin{ii}{1});
28     warning('inputCheck:disp_transport_2',...
29     ['disp_transport opt. param. cells must start with a char. string. \n'...
30     ' Argument no. ' num2str(ii+1) ' was ignored \n'...
31     ' Type ''help disp_transport'' for details.']);
32     else;
33     if strcmp(varargin{ii}{1},'nmean')|...
34     strcmp(varargin{ii}{1},'ylim')|...
35     strcmp(varargin{ii}{1},'choicePlot');
36     eval([varargin{ii}{1} '=varargin{ii}{2};']);
37     else;
38     warning('inputCheck:disp_transport_3',...
39     ['unknown option ''' varargin{ii}{1} ''' was ignored']);
40     end;
41     end;
42     end;
43    
44     nt=length(myTimes);
45    
46     if choicePlot==2|choicePlot==4;%compute cumulative sum from bottom
47     fld=[flipdim(cumsum(flipdim(myTransports,1)),1);zeros(1,nt)];
48     else;
49     fld=myTransports;
50     end;
51    
52     if choicePlot==1; fld=nansum(fld,1); end;
53     if choicePlot==2; fld=nanmax(abs(fld),[],1); end;
54     if choicePlot==3; fld=nanmean(fld,2); z=squeeze(mygrid.RC); end;
55     if choicePlot==4; fld=[nanmean(fld,2);0]; z=squeeze(mygrid.RF); end;
56    
57     if choicePlot==1|choicePlot==2;%time series
58     fldmean=1e-2*round(mean(fld)*1e2);
59     if nt>1;
60     %myTitle=[myTitle ' mean=' num2str(fldmean) 'Sv'];
61     fld=runmean(fld,nmean,2);
62     myplot=plot(myTimes,fld,'LineWidth',2); title(myTitle); set(gca,'FontSize',14); grid on;
63     if ~isempty(ylim); aa=[min(myTimes) max(myTimes) ylim]; axis(aa); end;
64     aa=axis; xx=aa(1)+(aa(2)-aa(1))/20; yy=aa(4)-(aa(4)-aa(3))/5;
65     cc=text(xx,yy,['(mean=' num2str(fldmean) 'Sv)']);
66     else;
67     fprintf([myTitle '-- mean: ' num2str(fldmean) 'Sv\n']);
68     end;
69     elseif choicePlot==3|choicePlot==4;%time mean profile
70     nr=length(z);
71     kk=find(fld==0); if length(kk)>0; kk=[1:min(min(kk)+2,nr)]; else; kk=[1:nr]; end;
72     myplot=plot(fld(kk),z(kk),'LineWidth',2); title(myTitle); set(gca,'FontSize',14); grid on;
73     aa=axis; tmp1=max(abs(aa(1:2))); aa(1:2)=tmp1*[-1 1]; axis(aa);
74     end;
75    

  ViewVC Help
Powered by ViewVC 1.1.22