Numercial Reduction question

Sue Giller sag at hydrosphere.com
Mon Nov 19 22:32:22 CET 2001


I am working with Numerical arrays, and I need to be able to do 
some reductions along axis to aggregate data.  The reduction needs 
to be able to skip cells that have a given value in them, denoting a 
missing value.

For example,  I might have a 31 by 12 array (days by months) of 
data.  Some cells have a special value in them to denote that there is 
no data for that day (either it's an invalid date, or there was no data 
for that day).  I want to be able to collapse along the day axis (31) to 
create monthly data, say summing the values, or averaging the 
values.

I could do add.reduce (array), but this will not skip the cells with the 
missing value.

Does anyone have a suggestion on how to do this, other than 
iterating through all the values on a given dimension and doing the 
aggregation that way?

TIA.

sue




More information about the Python-list mailing list