Python- np.mean() giving wrong means? Python- np.mean() giving wrong means? numpy numpy

Python- np.mean() giving wrong means?


In the line

alltas[:,:,:,50] = np.mean(alltas,axis=3,dtype=np.float64)

the argument to mean should be alltas[:,:,:,:50]:

alltas[:,:,:,50] = np.mean(alltas[:,:,:,:50], axis=3, dtype=np.float64)

Otherwise you are including those final zeros in the calculation of the ensemble means.