Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16061 > unrolled thread

Re: mask one array using another array

Started byMRAB <python@mrabarnett.plus.com>
First post2011-11-22 00:48 +0000
Last post2011-11-22 00:48 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: mask one array using another array MRAB <python@mrabarnett.plus.com> - 2011-11-22 00:48 +0000

#16061 — Re: mask one array using another array

FromMRAB <python@mrabarnett.plus.com>
Date2011-11-22 00:48 +0000
SubjectRe: mask one array using another array
Message-ID<mailman.2939.1321922919.27778.python-list@python.org>
On 21/11/2011 21:42, questions anon wrote:
> I am trying to mask one array using another array.
>
> I have created a masked array using
> mask=MA.masked_equal(myarray,0),
> that looks something like:
> [1  -  -  1,
>   1  1  -  1,
>   1  1  1  1,
>   -   1  -  1]
>
> I have an array of values that I want to mask whereever my mask has a a '-'.
> how do I do this?
> I have looked at
> http://www.cawcr.gov.au/bmrc/climdyn/staff/lih/pubs/docs/masks.pdf but
> the command:
>
> d = array(a, mask=c.mask()
>
> results in this error:
> TypeError: 'numpy.ndarray' object is not callable
>
> I basically want to do exactly what that article does in that equation.
>
> Any feedback will be greatly appreciated.
>
The article is using the Numeric module, but your error says that you're 
using
the numpy module. They're not the same.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web