<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. 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 /> 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> rec = MAXing. 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.... 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 />* say ' nxp = 'nxp<br />nyp = (lat2-lat1)<br />* say ' nyp = 'nyp<br />* Grid dimensions are 0.5 x 0.5<br />nxp1 = nxp/0.5<br />* say 'nxp1 = 'nxp1<br />nyp1 = nyp/0.5<br />* say 'nyp1 = 'nyp1<br />nxp2 = math_int(nxp1)<br />nyp2 = math_int(nyp1)<br />* 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. <br />********************************<br /> nxp3 = (nxp2 + 2)<br /> say 'nxp3 = 'nxp3<br /><br />'set gxout print'<br />'d maxloc(max(htsgw,lat='lat1',lat='lat2'),lon='lon1',lon='lon2')'<br /> rec=sublin(result,nxp3)<br /> say 'rec = 'rec<br /> xc=subwrd(rec,4)<br /> 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. <br />********************************<br /> nyp3 = (nyp2 + 2)<br /> say 'nyp3 = 'nyp3<br />'d maxloc(max(htsgw,lon='lon1',lon='lon2'),lat='lat1',lat='lat2')'<br /> rec=sublin(result,nyp3)<br /> say 'rec = 'rec<br /> yc=subwrd(rec,4)<br /> say 'Max height lat = 'yc<br /><br /> say 'location of max seas = 'xc' 'yc<br /><br />**************<br />* Draw Max Location<br />**************<br />'q gr2xy 'xc' 'yc<br /> rec2=sublin(result,1)<br /> say 'rec2 = 'rec2<br /> xc2 = subwrd(result,3)<br /> yc2 = subwrd(result,6)<br /> say 'Max Height coords = 'xc2' 'yc2</div>
<div></div>
<div><span style="font-size: small;" size="2">Thanks,<br />Mark</span></div>