<div dir="ltr"><div>Hi,</div><div><br></div><div>This is untested: what about something like:</div><div><br></div><div> max_ii = ind(data_mask_1d.eq.1 .and. data_1d.eq.data_max(i))</div><div><br></div><div>(If the data are floats, it always dicey to compare floating-point values to exact values, but presumably the function max() will return a value that exactly matches *at least one* value in the data)</div><div><br></div><div>Hope that helps..</div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020 at 2:59 PM Ehsan Taghizadeh via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div dir="ltr">Dears,<br>I hope you're doing great.</div><div dir="ltr"><br></div><div dir="ltr">I found "shapefiles_13.ncl" and it seems a very useful script. It helps if I want to distinguish each county with the average. But what about if I just want to plot the maximum point in each county. I mean how I could plot just one point in each county which is the maximum point of that county.</div><div dir="ltr"><span>Obviously, I need the following change in "<span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">shapefiles_13.ncl</span></span>"</span></div><div dir="ltr"><span><span><pre style="color:rgb(0,0,0);white-space:pre-wrap">data_avg(i) = avg(where(data_mask_1d.eq.1,data_1d,data_1d@_FillValue))</pre></span>to</span></div><div dir="ltr"><span><span><pre style="color:rgb(0,0,0);white-space:pre-wrap">data_max(i) = max(where(data_mask_1d.eq.1,data_1d,data_1d@_FillValue))</pre></span><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">I think with finding the index of the maximum point I could locate that in the plot wit</span></span>h the following line (from <span>minmax_4.ncl</span>):</span></div><div dir="ltr"><span><span><pre style="color:rgb(0,0,0);white-space:pre-wrap">gsn_add_polymarker(wks,plot,sst&lon(max_ii@xi),sst&lat(max_ii@yi),mkres)</pre></span><br></span></div><div dir="ltr"><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">So, how could I find the index of "dax_max(i)". </span></span>It seems the following line could not be helpful for a script like <span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">"</span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">shapefiles_13.ncl"</span></span>:<br></div><div dir="ltr"><span><br></span></div><div dir="ltr"> <span><pre style="white-space:pre-wrap;color:rgb(0,0,0);font-size:16px">max_ii = ind(data_max(i))</pre></span><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px"><br></span></span></div><div dir="ltr"><span><div><div dir="ltr">The summary of my question is that I need some help to find the maximum point in each geometry of a shapefile and I'll be thankful if I hear from you. <span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">Should I give up </span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px">"shapefiles_13.ncl" and try with "<span style="font-family:verdana,sans-serif;font-size:13.3333px;background-color:rgb(255,231,198)">shapefile_mask_data</span>"?</span></span></div><div dir="ltr"><br style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px"></div></div></span></div><div dir="ltr"><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif;font-size:16px"><br></span></span></div><div dir="ltr"><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif"><i><font size="2">Sincerely</font></i></span></span></div><div dir="ltr"><span><span style="color:rgb(0,0,0);font-family:"bookman old style","new york",times,serif"><i><font size="2">Ehsan Taghizadeh</font></i></span></span></div><div dir="ltr"><i><font size="2">Institute of Geophysics, University of Tehran, Iran</font></i></div><div dir="ltr"><span><br></span></div></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>