Thank you, thank you, thank you!<br>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 similar.<br>
Thanks for all your help everyone!<br><br><br>            tmax=TSFC.max(axis=0)<br>            maxindex=TSFC.argmax()<br>            maxtemp=TSFC.ravel()[maxindex] #or maxtemp=TSFC.max()<br>            print maxindex, maxtemp<br>
            val=N.unravel_index(maxindex, TSFC.shape)<br>            listval=list(val)<br>            print listval<br>            timelocation=TIME[listval[0]]<br>            latlocation=LAT[listval[1]]<br>            lonlocation=LON[listval[2]]<br>
            print latlocation, lonlocation<br>            cdftime=utime('seconds since 1970-01-01 00:00:00')<br>            ncfiletime=cdftime.num2date(timelocation)<br>            print ncfiletime<br><br><br><div class="gmail_quote">
On Tue, Jan 10, 2012 at 3:28 PM, Aronne Merrelli <span dir="ltr"><<a href="mailto:aronne.merrelli@gmail.com">aronne.merrelli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br><br><div class="gmail_quote"><div class="im">On Mon, Jan 9, 2012 at 7:59 PM, questions anon <span dir="ltr"><<a href="mailto:questions.anon@gmail.com" target="_blank">questions.anon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
thank you, I seem to have made some progress (with lots of help)!!<br>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. <br>When I run the following code I alwayes receive the first timestamp of the file. Not sure how to get around this:<br>


<br>            tmax=TSFC.max(axis=0)<br>            maxindex=tmax.argmax()<br></blockquote></div><div><br>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.<br>

<br>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 value.<br>

<br>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? <br>

<br><br>Cheers,<br>Aronne<br></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br>