Hi there,
I would like to compute all annual maximum values in a 3D matrix using a for loop. To be more specific, the variable "Quantity" is a 3D matrix that is composed of latitude and longitude (both make up latitude and longitude grid cells) and time (expressed in days).
What I would like to do is compute all maximum values by looping all latitudes, all longitudes, and then loop all years in the period. This is done to obtain all maximum values over every grid cell (i.e. composed of latitude and longitude) for every year available (the default time units of "days" must also be converted to "years"), beginning with year 0.
My question is how should I construct a loop to do this? I realize that I would need to use the max() function, but I am uncertain where to use it in the loop.
This is what I have so far:
Thanks, and any assistance would be greatly appreciated!!!!
I would like to compute all annual maximum values in a 3D matrix using a for loop. To be more specific, the variable "Quantity" is a 3D matrix that is composed of latitude and longitude (both make up latitude and longitude grid cells) and time (expressed in days).
What I would like to do is compute all maximum values by looping all latitudes, all longitudes, and then loop all years in the period. This is done to obtain all maximum values over every grid cell (i.e. composed of latitude and longitude) for every year available (the default time units of "days" must also be converted to "years"), beginning with year 0.
My question is how should I construct a loop to do this? I realize that I would need to use the max() function, but I am uncertain where to use it in the loop.
This is what I have so far:
Quantity=Q for lat in range(np.size(Quantity,axis=1)): for lon in range(np.size(Quantity,axis=2)): Quantity[:,lat,lon]How do I account for time in the loop, and convert days to years, so that I may obtain maximum "annual" values for every grid cell?
Thanks, and any assistance would be greatly appreciated!!!!