user12285992
user12285992

Reputation:

Numpy Mean element wise over 3D arrays

I want to take the mean of 9 arrays element wise so to have one

I need something fast. The first bit of code takes forever. And with numpy mean without specifying an axis I get one value. I dont want to specify an axis. I want to take the mean element by element.

with output: juneMean['wind'][:,:,:] how do I do this?

Upvotes: 0

Views: 294

Answers (1)

bb1
bb1

Reputation: 7873

Try this:

june = [JunOne.variables['wind'], 
        JunTwo.variables['wind'],
        JunThree.variables['wind'],
        JunFour.variables['wind'],
        JunFive.variables['wind'],
        JunSix.variables['wind'],
        JunSeven.variables['wind'],
        JunEight.variables['wind'],
        JunNine.variables['wind']]

JuneMean = np.mean(np.array(june), axis=0)

Upvotes: 1

Related Questions