<div dir="ltr"><div><div><div>The very simple algorithm used does not handle boundary cases.<br><br></div>My suggestion:<br><br></div>Use the function on the global grid, then set all location N/N of 30 to _FillValue.<br><br></div>HTH<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 5, 2015 at 2:33 AM, Teresa Parker <span dir="ltr">&lt;<a href="mailto:tess.parker@monash.edu" target="_blank">tess.parker@monash.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Hi - I&#39;m using the local_max function to find local maxima in a variable field. The variable covers all longitudes, but is calculated for a 30 deg latitude band only. All values outside this latitude band are set to the @_FillValue for the variable.<br><br></div>Where the local maximum for the variable is located well within the latitude band, there is no problem However, when the local maximum is located on the edge of the latitude band (i.e. at either the minimum or maximum latitude of the band), the function fails. This seems to be because the immediately neighbouring points are all &quot;missing&quot; values. However, the function documentation states that missing values are ignored. <br><br></div>This can be seen from a simple example:<br>*************************************************<br></div><div>begin<br><br></div>myvar = new((/3,3/),float)<br></div>myvar@_FillValue = -999.<br></div></div></div></div>myvar = (/ (/-999.0,-999.0,-999.0/),(/60,70,55/),(/43,45,23/)/)<br><div><div><div><div><div><div><div><div><div>print(myvar)<br></div><div>mymax = local_max(myvar, False, 0.0)<br></div><div>print(mymax)<br><br></div><div>mymaxval = mymax@maxval<br></div><div>print(mymaxval)<br><br></div><div>end<br></div><div><br></div><div>However, if the missing values are set to e.g. zero, the function works:<br>*********************************************************************<br>begin<br><br>myvar = new((/3,3/),float)<br>myvar@_FillValue = -999.<br>myvar = (/ (/0.0,0.0,0.0/),(/60,70,55/),(/43,45,23/)/)<br><div>print(myvar)<br></div><div>mymax = local_max(myvar, False, 0.0)<br></div>print(mymax)<br></div><div><div><div><div><br>mymaxval = mymax@maxvalmymaxval = mymax@maxval<br></div><div>print(mymaxval)<br><br></div><div>end<br><br></div><div>While it might seem to be an easy workaround to set the next highest and lowest latitude band values to some miniscule value, this shouldn&#39;t really be necessary for the function to work. Can anyone help?</div><span class="HOEnZb"><font color="#888888"><div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div>-- <br>Tess Parker<br>PhD Candidate<br>School of Earth, Atmosphere and Environment<br>Room 225, Building 28<br></div><div>9 Rainforest Walk<br></div><div>Monash University, Clayton VIC 3800<br>Phone: <a href="tel:%2B61%203%209905%204458" value="+61399054458" target="_blank">+61 3 9905 4458</a> <br></div><a href="http://users.monash.edu.au/~tess/index.html" target="_blank">http://users.monash.edu.au/~tess/index.html</a><br></div></div></div></div></div>
</div></font></span></div></div></div></div></div></div></div></div></div></div></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>