


function taumean(cdfin,cdfout,tind,tout)
TAUMEAN computes mean,max,min of taux, tauy over time steps tind
of a ecomsi model run. cdfin is the ecomsi.cdf run, and
cdfout is a dummy ecomsi.cdf
tind is the indices of time steps to average over (1 is first step)
tout is the index of the time step where you want to write the mean

0001 function taumean(cdfin,cdfout,tind,tout) 0002 %function taumean(cdfin,cdfout,tind,tout) 0003 % 0004 % TAUMEAN computes mean,max,min of taux, tauy over time steps tind 0005 % of a ecomsi model run. cdfin is the ecomsi.cdf run, and 0006 % cdfout is a dummy ecomsi.cdf 0007 % 0008 % tind is the indices of time steps to average over (1 is first step) 0009 % tout is the index of the time step where you want to write the mean 0010 0011 disp('averaging wind stress') 0012 cdfid1=mexcdf('open',cdfin,'nowrite'); 0013 cdfid2=mexcdf('open',cdfout,'write'); 0014 0015 0016 utot=0.; 0017 vtot=0.; 0018 u=mexcdf('varget',cdfid1,'taux',tind(1)-1,length(tind)); 0019 umean=mean(u); 0020 v=mexcdf('varget',cdfid1,'tauy',tind(1)-1,length(tind)); 0021 vmean=mean(v); 0022 0023 % store mean u & v stress components in TOUT time step of cdfout 0024 mexcdf('varput',cdfid2,'taux',tout-1,1,umean); 0025 mexcdf('varput',cdfid2,'tauy',tout-1,1,vmean); 0026 mexcdf('close',cdfid1); 0027 mexcdf('close',cdfid2);