[Numpy-discussion] feedback request: proposal to add masks to the core ndarray
Fri Jun 24 20:11:58 CDT 2011
On Fri, Jun 24, 2011 at 2:09 PM, Benjamin Root <firstname.lastname@example.org> wrote:
> Another example of how we use masks in matplotlib is in pcolor(). We have
> to combine the possible masks of X, Y, and V in both the x and y directions
> to find the final mask to use for the final output result (because each
> facet needs valid data at each corner). Having a soft-mask implementation
> allows one to create a temporary mask to use for the operation, and to share
> that mask across all the input data, but then let the data structures retain
> their original masks when done.
This is a situation where I would just... use an array and a mask,
rather than a masked array. Then lots of things -- changing fill
values, temporarily masking/unmasking things, etc. -- come from free,
just from knowing how arrays and boolean indexing work?
Do we really get much advantage by building all these complex
operations in? I worry that we're trying to anticipate and write code
for every situation that users find themselves in, instead of just
giving them some simple, orthogonal tools.
As a corollary, I worry that learning and keeping track of how masked
arrays work is more hassle than just ignoring them and writing the
necessary code by hand as needed. Certainly I can imagine that *if the
mask is a property of the data* then it's useful to have tools to keep
it aligned with the data through indexing and such. But some of these
other things are quicker to reimplement than to look up the docs for,
and the reimplementation is easier to read, at least for me...
(By the way, is this hard-mask/soft-mask stuff documented anywhere? I
spent some time groveling over the numpy docs with google's help, and
I still have no idea what it actually is.)
More information about the NumPy-Discussion