I have Fortran code which I'd like to feed from Python with f2py. But I am not able to pass Numpy arrays of a known shape via f2py. (I'm on Python 2.7.10 and using gfortran and mingw32 as compilers).
Here is my Fortran code:
Subroutine test(nx,ny,mask)
Integer, intent(inout) :: mask(ny,nx)
!f2py intent(in,out) mask
End
Which is called like this in Python:
from test import test
import numpy as np
nx = 2
ny = 2
mask = np.ones((nx,ny),dtype=int)
maskreturn = test(nx,ny,mask)
Running the script results in:
error: (shape(mask,1)==nx) failed for 1st keyword nx: test:nx=2
I have no clue how to make it running (I'd need the correct passing of grids for a bigger model). Is there some terrible Fortran Noob mistake in there?