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


Groups > comp.lang.python > #16061

Re: mask one array using another array

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:using': 0.04; 'array.': 0.09; 'callable': 0.09; 'from:addr:python': 0.09; 'error:': 0.10; 'equation.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'numpy': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply-to:addr:python-list': 0.16; 'subject:array': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'this?': 0.19; 'trying': 0.21; 'header:In-Reply-To:1': 0.22; 'mask': 0.23; 'module,': 0.23; 'numeric': 0.23; 'skip:m 30': 0.24; 'says': 0.25; 'module.': 0.29; 'looks': 0.29; "skip:' 10": 0.29; 'error': 0.29; 'array': 0.30; 'typeerror:': 0.30; 'url:au': 0.31; 'does': 0.32; 'values': 0.32; 'header:User-Agent:1': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'received:84': 0.34; 'reply- to:addr:python.org': 0.34; 'something': 0.35; 'greatly': 0.36; 'but': 0.37; 'another': 0.37; 'using': 0.38; 'created': 0.38; 'same.': 0.39; 'url:docs': 0.39; 'appreciated.': 0.39; 'to:addr:python.org': 0.40; 'your': 0.61; 'results': 0.63; 'header :Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'article': 0.74; 'subject:one': 0.77
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=TvRkdUrh c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=9jsOeB20M3cA:10 a=Jlqmuwbh_fMA:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=ef5H16HOAAAA:8 a=--e6yTRJSANREqZ0wvgA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Tue, 22 Nov 2011 00:48:42 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
To python-list@python.org
Subject Re: mask one array using another array
References <CAN_=ogu73n6vTZ0qs=RWKh4bE7pHBqZv=B7GxSdrMsiQ4yJQ1A@mail.gmail.com>
In-Reply-To <CAN_=ogu73n6vTZ0qs=RWKh4bE7pHBqZv=B7GxSdrMsiQ4yJQ1A@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2939.1321922919.27778.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1321922919 news.xs4all.nl 6849 [2001:888:2000:d::a6]:37827
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16061

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web