;+ ; NAME: ; indexcount ; PURPOSE: (one line) ; return the count in an index array, or 0 for -1 ; DESCRIPTION: ; return the count in an index array, or 0 for -1 ; CATEGORY: ; Utility ; CALLING SEQUENCE: ; count = indexcount(index) ; INPUTS: ; index = as returned by where, an array of longs, or -1 ; OUTPUTS: ; 0 if index = -1, n_elements(index) otherwise ; PROCEDURE ; MODIFICATION HISTORY: ; Written 2011 Aug 24, by Leslie Young, SwRI ;- function indexcount, index n_dim_val = size(index, /n_dim) ; not a scalar, return length of array if n_dim_val gt 0 then return, n_elements(index) if long(index) eq -1L then return, 0L else return, 1L end