Python Forum
Looping in a 3D matrix - desperate for assistance!
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping in a 3D matrix - desperate for assistance!
#16
Hi killerrex,

As per post #14, here is what I have so far:

Quantity=Q
Quantity2=np.zeros(Quantity.shape)
Year=np.arange(Quantity.shape[0])//365
n_year = max(Year)+1
onedaymax=np.empty((n_year, )+Quantity.shape[1:3])
fivedaymax=np.empty((n_year, )+Quantity2.shape[1:3])
        for time in range(Quantity.shape[0]):
                Prec5[time,...]
                fiveconsecutivedays=np.sum(Quantity[time-2:time+2,...], axis=0) 
                        if time==0, 1, 51099, 51,100
                                continue
                                        for y in range(n_year):
                                                onedaymax[y, ...]=np.max(Quantity[Year==y, ...], axis=0)
                                                fivedaymax[y, ...]=np.max(Quantity2[Year==y, ...], axis=0)
I'm not sure if that first for loop is the right approach (again, as per the goal specified in post #14). The "if time" portion is intended to omit the first two days and last two days of the period, but I'm unsure if that it specified correctly for my purposes. What would you modify there?

Many thanks, and I would appreciate any feedback!
Reply


Messages In This Thread
RE: Looping in a 3D matrix - desperate for assistance! - by Lightning1800 - May-22-2018, 04:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need desperate help needHelpp 2 2,633 Aug-06-2017, 06:02 PM
Last Post: eyn2k

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020