<div dir="ltr"><div><br></div><div>The initial ncl-talk question was to determine the first occurrence at or above 0C.</div><div>Then, offline, you indicated that you wanted to the first and last values above 0C. You modified the 'first_occurence_ind.ncl' to return the first and <b>last </b>occurrence above 0C. You then state:<br></div><br><div>"But when I test the last day greater than 0 degree. I found the outcome confusing.<div>I found some "last day" is smaller than "first day".</div><div>===</div><div>My initial ncl-talk response included first_occurence_ind.ncl'. It was tested on a daily climatology. The URL in the test code indicates the download link. <span><br></span></div><div><span><br></span></div><div><span>The attached "first_last_occurrence_ind.ncl" calculates the first and last indices. Again, it is tested on the daily climatology [365,73,144]. It works correctly.<br></span></div><div><span>---<br></span></div><div><span>I am not sure what you mean  by "last day." I<br></span></div><div><span><br></span></div><div><span>However, if you are using this on multiple years of daily data, then it is quite possible the the "last day" would be smaller than the "first day" if you are referring month-day<br></span></div><div><span><br></span></div><div><span>   first occurrence > 0C   :  20000425   [25 April 2000]  last day 201003 15 [15 March 2010]. <br></span></div><div><span><br></span></div><div><span><br></span> </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 7, 2019 at 10:34 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@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 dir="ltr"><div dir="ltr"><div>There is no existing NCL function for what you want. Still, <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_minind.shtml" target="_blank"><b>dim_minind</b></a> can be used if the</div><div>data array is pretreated [tricked].</div><div><br></div><div>See attached. <br></div><div><br></div><div>%> ncl tst.1st_occurence.ncl</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 5, 2019 at 10:15 PM WIND via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">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>Dear all,</div>
<div> </div>
<div>Thanks for reading, I'm dealing with the three-dimensional grid temperature data (ordered by time, lat, lon). I want to confirm the first day (position in the time dimension) in each lat/lon that the temperature is greater than 0. It's hard for me to think about how to write the "if" statement. Are there some relevant statistics function in NCL? It will be so nice that anyone would provide some advice.</div>
<div>Any help would be appreciated!</div>
<div> </div>
<div>Sincerely,</div>
<div>Wind</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></div>
</blockquote></div>