/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/zonalmean.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/zonalmean.m

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


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch: MAIN, initial
CVS Tags: baseline, HEAD
Changes since 1.1: +0 -0 lines
Checking in work done with Dimitri on high-resolution cube gridding and parallel 
communications. 
   o code is in a contrib experiment for now so we can continue collaborating
     on it. However most code is general and will be moved into main branch once 
     it is fully hardened.
   o There are README files in the contrib root and in the subdirectories that
     explain the contents

1 function [Tm] = zonalmean(GRID,T,varargin);
2 % Tm = zonalmean(GRID,T,varargin);
3
4 T( find(isnan(T)) )=0;
5
6 if nargin==3
7 dTm=(mean(T,4)-mean(varargin{1},4)).*GRID.mskc;
8 mapmsk=GRID.mskc(:,:,1);
9 elseif nargin==4
10 dTm=(mean(T,4)-mean(varargin{1},4)).*GRID.mskc;
11 mapmsk=varargin{2};
12 else
13 dTm=mean(T,4).*GRID.mskc;
14 mapmsk=GRID.mskc(:,:,1);
15 end
16
17 Tm=squeeze(sum(dTm.*repmat(mapmsk,[1 1 size(T,3)]),1));
18 N=squeeze(sum( GRID.mskc.*repmat(mapmsk,[1 1 size(T,3)]),1));
19 Tm=Tm./sq(N);

  ViewVC Help
Powered by ViewVC 1.1.22