[ncl-talk] error: fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function

Dennis Shea shea at ucar.edu
Fri Aug 22 20:43:47 MDT 2014


MN is correct ... maybe you do't have any values less than 0.0

do j=0,173
  indices=ind(data1(j,:).lt.0.)

  if (.not.ismissing(indices(0))) then
      first=indices(0)
       if(first.gt.121) then
          date(j)=(first-121)+365
       else
          date(j)=first+244
       end if
      delete(first)
  end if

  delete(indices)
end do

===
If you have a recent version of NCL, you could use the
reassignment operator  :=

This will eliminate the need for 'delete'

do j=0,173
  indices := ind(data1(j,:).lt.0.)

  if (.not.ismissing(indices(0))) then
      first := indices(0)
       if(first.gt.121) then
          date(j)=(first-121)+365
       else
          date(j)=first+244
       end if
  end if

end do




On Fri, Aug 22, 2014 at 3:22 PM, Xi Chang <xi.chang01 at gmail.com> wrote:

> so that in the end, i would have only as *date(station) * contain the
> index pointed to first date having negative value..
>
>
> On Sat, Aug 23, 2014 at 6:21 AM, Xi Chang <xi.chang01 at gmail.com> wrote:
>
>> I checked,, they are ok,, Im just afradi that the problem is here
>>
>> ...
>> *  delete(indices)*
>> *  delete(first)*
>> end do
>>
>> I delete them, so the the return value can not be loaded when i=1->173,
>> as they are deleted when i=0.
>> do you have any suggestion,, i just want to save every first date which
>> has negative value from my 2D data (station, time).
>>
>> Thank you
>>
>>
>>
>>
>> On Sat, Aug 23, 2014 at 6:12 AM, Michael Notaro <mnotaro at wisc.edu> wrote:
>>
>>> 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.
>>>
>>>
>>> On 08/22/14, Xi Chang  wrote:
>>> > Thanks NCL and Michael,
>>> >
>>> > 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
>>> >
>>> >
>>> > do j=0,173
>>> > indices=ind(data1(j,:).lt.0.)
>>> > first=indices(0)
>>> > if(first.gt.121) then
>>> > date(j)=(first-121)+365
>>> > else
>>> > date(j)=first+244
>>> > end if
>>> > delete(indices)
>>> > delete(first)
>>> > end do
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Fri, Aug 22, 2014 at 5:40 AM, Michael Notaro <mnotaro at wisc.edu(javascript:main.compose()>
>>> wrote:
>>> >
>>> > > I think this should work.
>>> > >
>>> > >
>>> > > Say, the daily time series is x(0:364).
>>> > >
>>> > > indices=ind(x.lt.0.)
>>> > > first=indices(0)
>>> > >
>>> > >
>>> > >
>>> > >
>>> > > On 08/21/14, Xi Chang wrote:
>>> > > > Hallo NCL people,
>>> > > >
>>> > >
>>> > > > 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.
>>> > > >
>>> > > >
>>> > > > Thank you.
>>> > >
>>>
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140822/e3a5812a/attachment.html 


More information about the ncl-talk mailing list