# Re: Filtering data in multidimensional arrays

• Subject: Re: Filtering data in multidimensional arrays
• From: davidf(at)dfanning.com (David Fanning)
• Date: Thu, 1 Jun 2000 07:57:12 -0600
• Newsgroups: comp.lang.idl-pvwave
• Organization: Fanning Software Consulting
• References: <393668B4.78296CCD@mathstat.dal.ca>
• Xref: news.doit.wisc.edu comp.lang.idl-pvwave:19838

```Simon de Vet (simon@mathstat.dal.ca) writes:

> I have a 3 dimensional array, of size (20,40,13). This represents
> (Flight Number, Point Number, Data Type). The flights range from 3-19.
> Each flight has between 10 and 40 points. They all have the same number
> of data types. Using the replicate command, I have filled the empty
> array locations with -1111.
>
> Now, I want to plot this data, with all the negative values in the first
> two dimensions ('Bad Data') removed entirely. I have fooled around a bit
> with WHERE, but I can only understand it when it's applied to one
> dimensional arrays.
>
> How can I use it in my particular case? Is there another solution?

Oh, the WHERE function applies equally well to multidimensional
arrays. And the beauty of it is, you don't have to understand
it. You just have to use it. :-)

The secret is that you can use one-dimensional subscripts
to subset multi-dimensional arrays. If you really do want
to know how this works (and I wouldn't bother, probably)
here is an article on my web page that shows you how to
convert 1D subscripts of the type returned by WHERE to
multidimensional coordinates:

http://www.dfanning.com/tips/where_to_2d.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

```