[SciPy-user] help assigning arrays - global model output

Robert Kern robert.kern@gmail....
Fri Jul 18 01:30:10 CDT 2008


On Fri, Jul 18, 2008 at 01:07, John [H2O] <washakie@gmail.com> wrote:
> Robert Kern-2 wrote:
>> Please double-check your shapes by printing out the actual shapes:
>
> Seems I must have been doing something wrong earlier! You're correct, I just
> rewrote it in the 'old' or desired method without using the dict, and it
> works! I must have been doing something wrong earlier... now to just figure
> out which dimensions to sum across.
>
> Mind providing some insight on how to generate the average? What I have is
> an array, with 20 days worth of global model output at three layers
> (180,360,3) so my array is actually shape (180,360,3,20). I want the average
> over the 20 days of the sum of the three vertical layers.

G.sum(axis=2).mean(axis=2)

> I would also like
> the complete sum.

Do you mean the sum over all of the layers and all of the days?

  G.sum(axis=2).sum(axis=2)

Or did you mean something else?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the SciPy-user mailing list