Masked arrays in C extensions
![](https://secure.gravatar.com/avatar/56475d2e8acb48b4308f609982f94440.jpg?s=120&d=mm&r=g)
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@lists.sourceforge.net [mailto:numpy-discussion-admin@lists.sourceforge.net] On Behalf Of Kuzminski, Stefan R Sent: Monday, March 17, 2003 11:20 AM To: numpy-discussion@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/56475d2e8acb48b4308f609982f94440.jpg?s=120&d=mm&r=g)
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@lists.sourceforge.net [mailto:numpy-discussion-admin@lists.sourceforge.net] On Behalf Of Kuzminski, Stefan R Sent: Monday, March 17, 2003 11:20 AM To: numpy-discussion@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
participants (2)
-
Kuzminski, Stefan R
-
Paul F Dubois