[Numpy-discussion] Masked arrays in C extensions

Paul F Dubois paul at pfdubois.com
Tue Mar 18 08:34:10 EST 2003


Using the Python CAPI, you can get the MA module object, then from it the
function isMaskedArray(a), which you then can call with your argument a. You
can do the first two steps just once since they won't change.

-----Original Message-----
From: numpy-discussion-admin at lists.sourceforge.net
[mailto:numpy-discussion-admin at lists.sourceforge.net] On Behalf Of
Kuzminski, Stefan R
Sent: Monday, March 17, 2003 11:20 AM
To: numpy-discussion at lists.sourceforge.net
Subject: [Numpy-discussion] Masked arrays in C extensions



Hi, 

I'm writing a C exenstion which uses Masked Arrays.  Since a MA isn't a
'PyArray_Type', the PyArray_Check macro returns false, regular arrays work
fine.  ( from a SWIG typemap here )

if (!PyArray_Check($input)) { 
    PyErr_SetString(PyExc_TypeError,"$1 is not a Numeric Array"); 
    return NULL; 
  } 

My question is how do I deal with Masked Arrays differently than regular
Array in the C code?  Any sample code would be greatly appreciated!

thanks, 
Stefan Kuzminski 

P.S. this is Python2.2, Numeric-22 

------------------------------------------------------- This SF.net email is
sponsored by:Crypto Challenge is now open! Get cracking and register here
for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________ Numpy-discussion mailing
list Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20030318/ec8316e5/attachment-0001.html>


More information about the NumPy-Discussion mailing list