cuspaceflight/tawhiri — pull request #22 by danielrichman (2014-04-08 21:09:48+00:00)
Title: Interpolation style

Please merge #20 and #21 first. The actual commit here is [f7eaace](https://github.com/danielrichman/tawhiri/commit/f7eaace9d3b953dab9309a1421cf779eaedc5cd0)
and you can see the new `interpolate.pyx` in all its glory [here](https://github.com/danielrichman/tawhiri/blob/f7eaace9d3b953dab9309a1421cf779eaedc5cd0/tawhiri/interpolate.pyx).

Some notes:

- this a more or less straight translate of the tested [Go](https://github.com/danielrichman/tawhiri-codegolf/blob/go-poc/tawhiri/dataset/interpolate.go) (though now it doesn’t suffer from stupid 32 bit issues!)
- basically no yellow on `cython -a`
- Cython, what with it being based on C, doesn’t seem to like passing around arrays as if they were values at all. Moreover, passing arrays makes having an 'except' value very difficult. So, I've been using pick(...., out). This kinda smells, but I guess if you want to write C in Python your code is eventually going to smell like C.
- A couple of the `cdef double`s are superfluous, since Cython seems to be able to figure them out on its own… however, it can’t figure out corresponding and seemingly otherwise equivalent `int` local variables, so I’ve thrown them all in for completeness.
- [This](https://github.com/danielrichman/tawhiri/blob/f7eaace9d3b953dab9309a1421cf779eaedc5cd0/tawhiri/interpolate.pyx#L140-L141)
is a shame; `for lerp in lerps` doesn’t seem to work (where as it does if lerps is declared in that function, c.f. `for a in lhour` above); Cython complains about not knowing the length of lerps. More C induced array/pointer mushyness I guess? Unless anyone knows how to fix this.