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

Contents 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.5 - (show annotations) (download)
Tue Mar 12 22:38:45 2013 UTC (12 years, 4 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.4: +7 -5 lines
Add 'myUnit' to argument list

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; myUnit=[];
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 strcmp(varargin{ii}{1},'myUnit');
37 eval([varargin{ii}{1} '=varargin{ii}{2};']);
38 else;
39 warning('inputCheck:disp_transport_3',...
40 ['unknown option ''' varargin{ii}{1} ''' was ignored']);
41 end;
42 end;
43 end;
44
45 nt=length(myTimes);
46 if nt==1&size(myTransports,1)==1; myTransports=myTransports'; end;
47
48 if choicePlot==2|choicePlot==4;%compute cumulative sum from bottom
49 if size(myTransports,1)>1;
50 fld=[flipdim(cumsum(flipdim(myTransports,1)),1);zeros(1,nt)];
51 else;
52 fld=[flipdim(cumsum(flipdim(myTransports',1)),1);zeros(1,nt)];
53 end;
54 else;
55 fld=myTransports;
56 end;
57
58 if choicePlot==1; fld=nansum(fld,1); end;
59 if choicePlot==2; fld=nanmax(abs(fld),[],1); end;
60 if choicePlot==3; fld=nanmean(fld,2); z=squeeze(mygrid.RC); end;
61 if choicePlot==4; fld=[nanmean(fld,2);0]; z=squeeze(mygrid.RF); end;
62
63 if choicePlot==1|choicePlot==2;%time series
64 fldmean=1e-2*round(mean(fld)*1e2);
65 if ~isempty(myUnit); unit=[' ' myUnit]; else; unit=' Sv'; end;
66 if nt>1;
67 %myTitle=[myTitle ' mean = ' num2str(fldmean) unit];
68 if nmean>0; plot(myTimes,fld); hold on; end;
69 fld=runmean(fld,nmean,2);
70 myplot=plot(myTimes,fld,'LineWidth',2); title(myTitle); set(gca,'FontSize',14); grid on;
71 if ~isempty(ylim); aa=[min(myTimes) max(myTimes) ylim]; axis(aa); end;
72 aa=axis; xx=aa(1)+(aa(2)-aa(1))/20; yy=aa(4)-(aa(4)-aa(3))/5;
73 cc=text(xx,yy,['(mean = ' num2str(fldmean) unit ')']);
74 else;
75 fprintf([myTitle '-- mean: ' num2str(fldmean) ' Sv\n']);
76 end;
77 elseif choicePlot==3|choicePlot==4;%time mean profile
78 nr=length(z);
79 kk=find(fld==0); if length(kk)>0; kk=[1:min(min(kk)+2,nr)]; else; kk=[1:nr]; end;
80 myplot=plot(fld(kk),z(kk),'LineWidth',2); title(myTitle); set(gca,'FontSize',14); grid on;
81 aa=axis; tmp1=max(abs(aa(1:2))); aa(1:2)=tmp1*[-1 1]; axis(aa);
82 end;
83

  ViewVC Help
Powered by ViewVC 1.1.22