
gridloop2 could be generated on the fly
def ext_gridloop2_compile(self, fstr):
if not isinstance(fstr, str):
<error>
# generate Fortran source for gridloop2:
import f2py2e
source = """
subroutine gridloop2(a, xcoor, ycoor, nx, ny)
...
do j = 0, ny-1
y = ycoor(j)
do i = 0, nx-1
x = xcoor(i)
a(i,j) = %s
...
""" % fstr # no callback, the expression is hardcoded
f2py2e.compile(source, modulename='ext_gridloop2', ...)
def ext_gridloop2_v2(self):
import ext_gridloop2
return ext_gridloop2.gridloop2(self.xcoor, self.ycoor)


