[Numpy-discussion] bug in ma.masked_all()?
Pierre GM
pgmdevlist@gmail....
Tue Dec 2 02:16:02 CST 2008
Eric,
That's quite a handful you have with this dtype...
So yes, the fix I gave works with nested dtypes and flexible dtypes
with a simple name (string, not tuple). I'm a bit surprised with
numpy, here.
Consider:
>>> dt.names
('P', 'D', 'T', 'w', 'S', 'sigtheta', 'theta')
So we lose the tuple and get a single string instead, corresponding to
the right-hand element of the name..
But this single string is one of the keys of dt.fields, whereas the
tuple is not. Puzzling. I'm sure there must be some reference in the
numpy book, but I can't look for it now.
Anyway:
Prior to version 6127, make_mask_descr was substituting the 2nd
element of each tuple of a dtype.descr by a bool. Which failed for
nested dtypes. Now, we check the field corresponding to a name, which
fails in our particular case.
I'll be working on it...
On Dec 2, 2008, at 1:59 AM, Eric Firing wrote:
> dt = np.dtype([((' Pressure, Digiquartz [db]', 'P'), '<f4'), (('
> Depth [salt water, m]', 'D'), '<f4'), ((' Temperature [ITS-90, deg
> C]', 'T'), '<f4'), ((' Descent Rate [m/s]', 'w'), '<f4'), (('
> Salinity [PSU]', 'S'), '<f4'), ((' Density [sigma-theta, Kg/m^3]',
> 'sigtheta'), '<f4'), ((' Potential Temperature [ITS-90, deg C]',
> 'theta'), '<f4')])
>
> np.ma.zeros((2,2), dt)
More information about the Numpy-discussion
mailing list