[SciPy-User] numpy mean

questions anon questions.anon at gmail.com
Thu Jul 28 00:44:22 EDT 2011


Hi All,
I thought this would be a relatively easy thing to do but the more I look
the more confused I become!

I have a netcdf file containing hourly temperature data for given region for
a month.
I would like to find the mean/average of particular periods (i.e. 3 hours).

e.g. this is what I would like:

array1=[2,4,8]
array2=[4,8,12]
array3=[9,3,15]

meanofarrays=np.mean(array1,array2,array3)
print meanofarrays
>>>[5,5,11]

Is there a routine that will do what I am after?
If not I seem to be able to sum the arrays together and then divide by
another array, but I will need to produce an array to match the extent and
all values will need to be equal to the number of arrays I have summed. Can
anyone help with producing this array?

i.e.
sumofarray=[15,15,35]
numberofarrays=[3,3,3]
meanofarrays=np.divide[sumofarrays,numberofarrays]
print meanofarrays
>>>[5,5,11]

Any feedback will be greatly appreciated!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110728/7403a38f/attachment.html>


More information about the SciPy-User mailing list