[Numpy-discussion] find location of maximum values
Mon Jan 9 22:40:02 CST 2012
Thank you, thank you, thank you!
I needed to find the max value (and corresponding TIME and LAT, LON) for
the entire month but I shouldn't have been using the tmax, instead I needed
to use the entire array. Below code works for those needing to do something
Thanks for all your help everyone!
maxtemp=TSFC.ravel()[maxindex] #or maxtemp=TSFC.max()
print maxindex, maxtemp
print latlocation, lonlocation
cdftime=utime('seconds since 1970-01-01 00:00:00')
On Tue, Jan 10, 2012 at 3:28 PM, Aronne Merrelli
> On Mon, Jan 9, 2012 at 7:59 PM, questions anon <email@example.com>wrote:
>> thank you, I seem to have made some progress (with lots of help)!!
>> I still seem to be having trouble with the time. Because it is hourly
>> data for a whole month I assume that is where my problem lies.
>> When I run the following code I alwayes receive the first timestamp of
>> the file. Not sure how to get around this:
> You are computing max(axis=0) first. So, tmax is an array containing the
> maximum temperature at each lat/lon grid point, over the set of 721 months.
> It will be a [106, 193] array.
> So the argmax of tmax is an element in a shape [106,193] array (the number
> of latitude/number of longitude) not the original three dimension [721,
> 106, 193] array. Thus when you unravel it you can only get the first time
> I re-read your original post but I don't understand what number you need.
> Are you trying to get the single max value over the entire array? Or max
> value for each month? (a 721 element vector)? or something else?
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion