/[MITgcm]/MITgcm_contrib/mlosch/interp_llc/meanprofile.m
ViewVC logotype

Annotation of /MITgcm_contrib/mlosch/interp_llc/meanprofile.m

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


Revision 1.1 - (hide annotations) (download)
Thu May 3 21:07:21 2007 UTC (18 years, 2 months ago) by mlosch
Branch: MAIN
CVS Tags: HEAD
initial checkin of topography and hydrography interpolation scripts for
the llc-grid, based on old matlab scripts by Alistair Adcroft
Let's hope, they are useful.

1 mlosch 1.1 function [Tm,Tsd] = meanprofile(GRID,T1,varargin);
2    
3     % Remove NaN's
4     T1( find(isnan(T1)) )=0;
5    
6     if nargin==3
7     dTm=(mean(T1,4)-mean(varargin{1},4)).*GRID.mskc;
8     mapmsk=GRID.mskc(:,:,1);
9     elseif nargin==4
10     dTm=(mean(T1,4)-mean(varargin{1},4)).*GRID.mskc;
11     mapmsk=varargin{2};
12     else
13     dTm=mean(T1,4).*GRID.mskc;
14     mapmsk=GRID.mskc(:,:,1);
15     end
16    
17     nxy=prod(size(GRID.rac));
18     nr=prod(size(GRID.mskc,3));
19     ra=reshape((GRID.rac(:).*mapmsk(:))*ones(1,nr),size(GRID.mskc)).*GRID.mskc;
20     dTm=reshape(dTm,[nxy nr]);
21     ra=reshape(ra,[nxy nr]);
22     Tm=squeeze( sum(dTm.*ra) ./ sum(ra) );
23     Tsd=(dTm'-Tm'*ones(1,nxy))';
24     Tsd=sqrt( squeeze( sum((Tsd.^2).*ra) ./ sum(ra) ) );
25    
26     function [F] = impliedflux(GRID,Q);
27     F=mean(Q,3).*GRID.mskc(:,:,1).*GRID.rac;
28     F=-cumsum([0 squeeze( sum(F,1) )]);

  ViewVC Help
Powered by ViewVC 1.1.22