May-14-2018, 10:35 PM
You can use the max function from numpy, choosing the axis where you want to perform the operation:
# Create a dummy array of 5 x 3 x 3 where 1st dimension is time and the others are space position. >>> import numpy as np >>> q = np.array(range(5*3*3)) >>> q.shape = (5, 3, 3) # Get the maximum for all the elements >>> np.max(q) 44 # Get the max for each lat, lon >>> np.max(q, axis=0) array([[36, 37, 38], [39, 40, 41], [42, 43, 44]]) # Get the max for only the times 2 and 3: >>> np.max(q[2:4, ...]) 35Try using array selection operations (slices, masks) and playing with the axis parameter to obtain the values you want.