<div dir="ltr"><div><div><br></div>MN is correct ... maybe you do&#39;t have any values less than 0.0<br><br><div><div>do j=0,173</div><div>  indices=ind(data1(j,:).lt.0.)<br><br></div><div>  if (.not.ismissing(indices(0))) then<br>
</div><div>      first=indices(0) </div><div>       if(first.gt.121) then</div><div>          date(j)=(first-121)+365</div><div>       else</div><div>          date(j)=first+244</div>
<div>       end if</div><div>      delete(first)<br></div><div>  end if<br><br>  delete(indices)</div><div>end do</div></div><br>===<br></div><div>If you have a recent version of NCL, you could use the <br>reassignment operator  :=<br>
<br></div><div>This will eliminate the need for &#39;delete&#39;<br></div><div><br><div><div>do j=0,173</div><div>  indices := ind(data1(j,:).lt.0.)<br><br></div><div>  if (.not.ismissing(indices(0))) then<br></div><div>      first := indices(0) </div>
<div>       if(first.gt.121) then</div><div>          date(j)=(first-121)+365</div><div>       else</div><div>          date(j)=first+244</div>
<div>       end if</div><div>  end if<br><br></div><div>end do</div></div><br></div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 22, 2014 at 3:22 PM, Xi Chang <span dir="ltr">&lt;<a href="mailto:xi.chang01@gmail.com" target="_blank">xi.chang01@gmail.com</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">so that in the end, i would have only as <b>date(station) </b> contain the index pointed to first date having negative value..</div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 23, 2014 at 6:21 AM, Xi Chang <span dir="ltr">&lt;<a href="mailto:xi.chang01@gmail.com" target="_blank">xi.chang01@gmail.com</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">I checked,, they are ok,, Im just afradi that the problem is here<div><br></div><div>...</div><div><div style="font-family:arial,sans-serif;font-size:13px">

<b>  delete(indices)</b></div><div style="font-family:arial,sans-serif;font-size:13px">
<b>  delete(first)</b></div></div><div style="font-family:arial,sans-serif;font-size:13px">end do</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">


I delete them, so the the return value can not be loaded when i=1-&gt;173, as they are deleted when i=0.</div><div style="font-family:arial,sans-serif;font-size:13px">do you have any suggestion,, i just want to save every first date which has negative value from my 2D data (station, time).</div>


<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thank you</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">


<br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 23, 2014 at 6:12 AM, Michael Notaro <span dir="ltr">&lt;<a href="mailto:mnotaro@wisc.edu" target="_blank">mnotaro@wisc.edu</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Perhaps sometimes you never have a negative data value. Then indices would be empty.Try printing indices each time in the 0,173 loop to check.<br>



<div><br>
<br>
On 08/22/14, Xi Chang  wrote:<br>
&gt; Thanks NCL and Michael,<br>
&gt;<br>
&gt; Do you know the source of this following error: fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function<br>
&gt;<br>
&gt;<br>
&gt; do j=0,173<br>
&gt; indices=ind(data1(j,:).lt.0.)<br>
&gt; first=indices(0)<br>
&gt; if(first.gt.121) then<br>
&gt; date(j)=(first-121)+365<br>
&gt; else<br>
&gt; date(j)=first+244<br>
&gt; end if<br>
&gt; delete(indices)<br>
&gt; delete(first)<br>
&gt; end do<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div><div><div>&gt; On Fri, Aug 22, 2014 at 5:40 AM, Michael Notaro &lt;<a href="mailto:mnotaro@wisc.edu" target="_blank">mnotaro@wisc.edu</a>(javascript:main.compose()&gt; wrote:<br>
&gt;<br>
&gt; &gt; I think this should work.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Say, the daily time series is x(0:364).<br>
&gt; &gt;<br>
&gt; &gt; indices=ind(x.lt.0.)<br>
&gt; &gt; first=indices(0)<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On 08/21/14, Xi Chang wrote:<br>
&gt; &gt; &gt; Hallo NCL people,<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; I have a question, i have a daily data 1D (point),, i&amp;#39;d like to get the index which has the first negative value and save the index per year. if i have 20 years, then i&amp;#39;ll have 20 indices which are associated with first negative value each year.<br>



&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thank you.<br>
&gt; &gt;<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<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>