time averaging over multiple files

Charles Seman Charles.Seman at NOAA.GOV
Fri Apr 13 13:50:04 EDT 2007


Hi,

Please find attached two pdf files containing time averages of MODIS
Aqua and Terra cloud effective radius for June 2003-2006, and GrADS
"template" ctl files for the Aqua and Terra datasets.

In cerl_avg.pdf, the time-averages were calculated by using the GrADS
"ave" function (the template ctl file spans the individual data files):
-----------------------------------------------------------------------------------------------------------------
    'set x 1 'nx
    'set y 1 'ny
    'set z 1'
    'set t 1'
    'define var = 'obs_var_scale'*ave('obs_var_name',t='ts',t='tf')'
-----------------------------------------------------------------------------------------------------------------
and in cerl_avg_test.pdf the time-averages were calculated using a
"while" loop construct:
-----------------------------------------------------------------------------------------------------------------
*
*  define time-average variable...
*
  tt=ts
  'set x 1 'nx
  'set y 1 'ny
  'set z 1'
  'set t 'tt
  'define varsum = 'obs_var_scale'*'obs_var_name
*
*  increment time-average variable sum over all time levels...
*
  tt=tt+1
  while ( tt <= tf )
    'set x 1 'nx
    'set y 1 'ny
    'set z 1'
    'set t 'tt
    'define varsum = varsum + 'obs_var_scale'*'obs_var_name
    tt=tt+1
  endwhile
*
*  calculate time-average...
*
  nt = tf-ts+1
  'set x 1 'nx
  'set y 1 'ny
  'set z 1'
  'set t 1'
  'define var = varsum/'nt
-----------------------------------------------------------------------------------------------------------------

Why are the time-averages different?  Is it not possible to use a
while-loop construct if there are undefined values?

Thanks,
Chuck

--

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cerl_avg.pdf
Type: application/pdf
Size: 348222 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20070413/6e7b175e/attachment.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cerl_avg_test.pdf
Type: application/pdf
Size: 337265 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20070413/6e7b175e/attachment-0001.pdf 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MYD08_M3.June2003-2006.ctl
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20070413/6e7b175e/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MOD08_M3.June2001-2006.ctl
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20070413/6e7b175e/attachment-0001.pl 


More information about the gradsusr mailing list