Home > omviz > hfmean.m

hfmean

PURPOSE ^

HFMEAN averages the heat flux over time steps TIND

SYNOPSIS ^

function hfmean(cdfin,cdfout,tind,tout)

DESCRIPTION ^

 HFMEAN  averages the heat flux over time steps TIND
    of the ecomsi model run CDFIN and saves the resulting
    mean field to time step TOUT in file CDFOUT.
     
  Usage:  fmean(cdfin,cdfout,tind,tout)
  tind is the indices of time steps to average over (1 is first step)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function hfmean(cdfin,cdfout,tind,tout)
0002 % HFMEAN  averages the heat flux over time steps TIND
0003 %    of the ecomsi model run CDFIN and saves the resulting
0004 %    mean field to time step TOUT in file CDFOUT.
0005 %
0006 %  Usage:  fmean(cdfin,cdfout,tind,tout)
0007 %  tind is the indices of time steps to average over (1 is first step)
0008 %
0009 disp('averaging heat_flux')
0010   varin='heat_flux';
0011   varout='heat_flux';
0012 cdfid1=mexcdf('open',cdfin,'nowrite');
0013 cdfid2=mexcdf('open',cdfout,'write');
0014 
0015 [nam,nx]=mexcdf('diminq',cdfid1,'xpos');
0016 [nam,ny]=mexcdf('diminq',cdfid1,'ypos');
0017 [nam,nz]=mexcdf('diminq',cdfid1,'zpos');
0018 
0019   etot=zeros(nx,ny);
0020   for i=tind,
0021     e=mexcdf('varget',cdfid1,varin,[i-1 0 0],[1 ny nx]);
0022     etot=etot+e;
0023   end
0024   hfmean=etot/length(tind);
0025 % store mean heat_fluxation field in time step TOUT of CDFOUT
0026   mexcdf('varput',cdfid2,varout,[tout-1  0 0],[1  ny nx],hfmean);
0027 
0028 mexcdf('close',cdfid1);
0029 mexcdf('close',cdfid2);

Generated on Thu 01-Dec-2005 08:50:35 by m2html © 2003