<div>Hello everyone,</div>
<div>I'm struggling with maxloc. For whatever reason - I cannot get valid results out of it</div>
<div></div>
<div>I'm using a simple 0.5 X 0.5 deg grid.</div>
<div></div>
<div>I can find the max value just fine.&nbsp; It's the location of that value that is the issue.</div>
<div>Specifically selecting the correct record to read to obtain the x value (nxp3 in this example):</div>
<div></div>
<div>'d maxloc(max(htsgw,lat='lat1',lat='lat2'),lon='lon1',lon='lon2')'<br />&nbsp;&nbsp; rec=sublin(result,nxp3)</div>
<div></div>
<div>The last valid line of data from maxloc looks like this (the next line is undefined values):</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rec = MAXing.&nbsp; dim = 1, start = 146, end = 286<br /><br />Where is the actual grib point or longitude where the max value is located?</div>
<div>The results I'm getting are the same for every time step in the grib file....&nbsp; dim = 1</div>
<div></div>
<div>Or should I be looking somewhere else?</div>
<div></div>
<div>Thanks for your help.</div>
<div></div>
<div>Here's the whole script:</div>
<div></div>
<div>********************************<br />* Define number of grid points to scan<br />********************************</div>
<div>lon1 = 120<br />lon2 = 255<br />lat1 = -5<br />lat2 = 65</div>
<div></div>
<div>nxp = (lon2-lon1)<br />*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say '&nbsp; nxp = 'nxp<br />nyp = (lat2-lat1)<br />*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say '&nbsp; nyp = 'nyp<br />*&nbsp; Grid dimensions are 0.5 x 0.5<br />nxp1 = nxp/0.5<br />*&nbsp;&nbsp;&nbsp; say 'nxp1 = 'nxp1<br />nyp1 = nyp/0.5<br />*&nbsp;&nbsp;&nbsp; say 'nyp1 = 'nyp1<br />nxp2 = math_int(nxp1)<br />nyp2 = math_int(nyp1)<br />*&nbsp;&nbsp; say 'nxp2 nyp2 = 'nxp2' 'nyp2<br /><br />********************************<br />* Find Max Longitude (x dim)<br />********************************<br />* There are 'nxp1' number of data points over the longitude range plus 1 for MAXLOCing<br />* and 1 for the result value line. So add 2.&nbsp; <br />********************************<br />&nbsp;nxp3 = (nxp2 + 2)<br />&nbsp;&nbsp;&nbsp;&nbsp; say 'nxp3 = 'nxp3<br /><br />'set gxout print'<br />'d maxloc(max(htsgw,lat='lat1',lat='lat2'),lon='lon1',lon='lon2')'<br />&nbsp;&nbsp; rec=sublin(result,nxp3)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'rec = 'rec<br />&nbsp;&nbsp; xc=subwrd(rec,4)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'Max height lon = 'xc<br /><br />********************************<br />* Find max Latitude (y dim)<br />********************************<br />* There are 'nyp1' number of data points over the long range plus 1 for MAXLOCing <br />* and 1 for the result value line. So add 2.&nbsp; <br />********************************<br />&nbsp;nyp3 = (nyp2 + 2)<br />&nbsp;&nbsp;&nbsp;&nbsp; say 'nyp3 = 'nyp3<br />'d maxloc(max(htsgw,lon='lon1',lon='lon2'),lat='lat1',lat='lat2')'<br />&nbsp;&nbsp; rec=sublin(result,nyp3)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'rec = 'rec<br />&nbsp;&nbsp; yc=subwrd(rec,4)<br />&nbsp;&nbsp;&nbsp;&nbsp; say 'Max height lat = 'yc<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'location of max seas = 'xc' 'yc<br /><br />**************<br />*&nbsp; Draw Max Location<br />**************<br />'q gr2xy 'xc' 'yc<br />&nbsp;&nbsp;&nbsp; rec2=sublin(result,1)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'rec2 = 'rec2<br />&nbsp;&nbsp;&nbsp; xc2 = subwrd(result,3)<br />&nbsp;&nbsp;&nbsp; yc2 = subwrd(result,6)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; say 'Max Height coords = 'xc2' 'yc2</div>
<div></div>
<div><span style="font-size: small;" size="2">Thanks,<br />Mark</span></div>