<div dir="ltr"><div><div><br></div>MN is correct ... maybe you do'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 'delete'<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"><<a href="mailto:xi.chang01@gmail.com" target="_blank">xi.chang01@gmail.com</a>></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"><<a href="mailto:xi.chang01@gmail.com" target="_blank">xi.chang01@gmail.com</a>></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->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"><<a href="mailto:mnotaro@wisc.edu" target="_blank">mnotaro@wisc.edu</a>></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>
> Thanks NCL and Michael,<br>
><br>
> 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>
><br>
><br>
> do j=0,173<br>
> indices=ind(data1(j,:).lt.0.)<br>
> first=indices(0)<br>
> if(first.gt.121) then<br>
> date(j)=(first-121)+365<br>
> else<br>
> date(j)=first+244<br>
> end if<br>
> delete(indices)<br>
> delete(first)<br>
> end do<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
</div><div><div>> On Fri, Aug 22, 2014 at 5:40 AM, Michael Notaro <<a href="mailto:mnotaro@wisc.edu" target="_blank">mnotaro@wisc.edu</a>(javascript:main.compose()> wrote:<br>
><br>
> > I think this should work.<br>
> ><br>
> ><br>
> > Say, the daily time series is x(0:364).<br>
> ><br>
> > indices=ind(x.lt.0.)<br>
> > first=indices(0)<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > On 08/21/14, Xi Chang wrote:<br>
> > > Hallo NCL people,<br>
> > ><br>
> ><br>
> > > I have a question, i have a daily data 1D (point),, i&#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&#39;ll have 20 indices which are associated with first negative value each year.<br>
> > ><br>
> > ><br>
> > > Thank you.<br>
> ><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>