After looking around, I decided to write a script to solve this problem. The meat of it is included below for those who wish to use it. As a final note, I really think an inherent Grads function should be made to do this. It could be modeled off of such other functions as aave:<br>
<br>example call:<br>amaxloc( var , lon1, lon2, lat1, lat2)<br><br>Anyway, enjoy!<br><br>*Finding the location of maximum value<br>max = -999999<br>yy = 1<br>while (yy <= yfinal)<br> 'set y 'yy<br> 'd maxloc('ans',x=1,x='xfinal')'<br>
line = sublin(result,3)<br> index = subwrd(line,4)<br> if (index < 1e+10)<br> 'set x 'index<br> 'd 'ans<br> line = sublin(result,2)<br> act_max = subwrd(line,4)<br>*setting index of max value into array<br>
max.yy.1 = index<br>*setting actual max value into array<br> max.yy.2 = act_max<br> 'set x 1 'xfinal<br> if (max.yy.2 > max)<br> max_val = max.yy.2<br> max_locx = max.yy.1<br> max_locy = yy<br> max = max_val<br>
endif<br> endif<br> yy = yy + 1<br>endwhile<br><br>In this script, 'ans' refers to a field name like 'u', 'td', 'hgtprs', etc. This can be easily adapted for finding the location of minimum value by changing 'maxloc' to 'minloc' and reversing the '>' sign in the last if statement. You can choose to change the variable names to include 'min' instead of 'max' as well.<br>
<br>Jeff Duda<br><br><div class="gmail_quote">On Sun, Sep 19, 2010 at 11:32 PM, Jeffrey Duda <span dir="ltr"><<a href="mailto:jdduda@iastate.edu">jdduda@iastate.edu</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;">
Hello,<br>I wish to find the location of the max of a variable (say, theta-e or precipitation) from WRF output. I'm assuming the maxloc function is the way to go, but it only seems to give you the location of max value along one dimension. I want it to give me the lat,lon coords of the max value. How do I do that?<br>
<br>Jeff Duda<br clear="all"><font color="#888888"><br>-- <br>Jeff Duda<br>Iowa State University<br>Meteorology Graduate Student<br>3134 Agronomy Hall<br><a href="http://www.meteor.iastate.edu/%7Ejdduda" target="_blank">www.meteor.iastate.edu/~jdduda</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Jeff Duda<br>Iowa State University<br>Meteorology Graduate Student<br>3134 Agronomy Hall<br><a href="http://www.meteor.iastate.edu/~jdduda">www.meteor.iastate.edu/~jdduda</a><br>