beginnings of making an f2py version of this code