subroutine gridloop_vec(a, xcoor, ycoor, nx, ny, func1) integer nx, ny real*8 a(0:nx-1,ny-1), xcoor(0:nx-1), ycoor(0:ny-1) Cf2py intent(in,out) a Cf2py intent(in) xcoor Cf2py intent(in) ycoor external func1 C fill array a with values taken from a Python function, C do that without loop and point-wise callback, do a C vectorized callback instead: call func1(a, xcoor, ycoor, nx, ny) C could work further with array a here... return end