time averaging over multiple files

Eric L. Altshuler ela at COLA.IGES.ORG
Fri Apr 13 21:18:22 EDT 2007


Chuck,

When you use the 'ave' function in grads, undefined values are excluded
from the averaging calculation. In other words, if you have 10 values but
one of them is undefined, the ave function calculates the average of the
9 remaining 'legitimate' values. The result from ave function will only
be undefined if ALL of the values involved in the average are undefined.

On the other hand, if you explicitly refer to an undefined value in an
arithmetic calculation, the result of that calculation is also undefined.
For example, if you calculate the average of 10 values by adding them up and
dividing by 10, the result will be undefined if ANY of the 10 values are
undefined. That is why the white areas are bigger in the figure you made
by calculating the average with a 'while' loop. Unless you have a
compelling reason to calculate an average by explicitly summing up the
values, it's probably best to use the ave function.

Sincerely,
Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
Calverton, MD, USA
ela at cola.iges.org



More information about the gradsusr mailing list