Re: unexpected behavior for ind

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 26 2010 - 22:02:53 MST

Joel,

The whole expression "a.ne.10.or.ismissing(a)" itself contains a
missing value. Print this without ind() around it, and you will see
what I mean.

The ind() function returns indices only where it finds True values,
not False or missing.

The most conservative formulation for what you requested is this:

   ind (where (ismissing (a), True, a.ne.10))

--Dave

Joel Norris wrote:
> I'd like to use "ind" to find data that does not have a particular value
> or is missing, but it unexpectedly does not return the indices of missing
> data.
>
> Here's a short sample script.
>
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> ncl 0> a = (/10,20,30,-999/)
> ncl 1> a@_FillValue = -999
> ncl 2> print(ind(a.ne.10))
> (0) 1
> (1) 2
> ncl 3> print(ind(ismissing(a)))
> (0) 3
> ncl 4> print(ind(a.ne.10.or.ismissing(a)))
> (0) 1
> (1) 2
>
> Why doesn't "ind" return 1, 2, and 3?
>
> Joel
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 26 22:03:03 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 01 2010 - 08:49:37 MST