[Numpy-discussion] f2py with int8

Sturla Molden sturla at molden.no
Thu Apr 19 08:17:09 EDT 2012


On 17.04.2012 07:32, John Mitchell wrote:
> Hi,
>
> I am using f2py to pass a numpy array of type numpy.int8 to fortran.  It
> seems like I am misunderstanding something because I just can't make it
> work.
>
> Here is what I am doing.
>
> PYTHON
> b=numpy.array(numpy.zeros(shape=(10,),dtype=numpy.int8),order='F')

This returns an array with dtype int.

You want:

b = numpy.zeros(shape=(10,),dtype=numpy.int8,order='F')


Sturla



More information about the NumPy-Discussion mailing list