The Beginnings of a new API

NOTE: A demo of the relevant code I’m referring to for the new labelled array API in pysal.weights in this update is available in this notebook, and the actual code lives in a weights2 module in my gsoc feature branch.

I’ve decided to target our weights module to prototype the labelled array interface. In general, we’ll need extensions built into at least our exploratory spatial data analysis module, esda, our spatial regression module, spreg, and our spatial dynamics module, spatial_dynamics.

So far, I’ve focused on weights because it’s so central to everything else that the library does. It also poses unique challenges to deisgn around, and I’ve already done a bit of work before GSOC in making a labelled array interface for it.

I’ve been building constructors that let us build spatial weights objects from the primitives defined in various other computational geometry packages. Fortunately, what’s required is nothing more than building efficient type conversions &, where possible, relying on duck typing.

I’m somewhat concerned that just relying on duck typing may make this API more fragile than we’d like, so I’m trying to be eager about conversions to our native geometric objects, as long as the conversion is computationally cheap.

Altogether, this means that I’ve done quite a bit of redesigning of the weights module. But, in general, it still supports the same basic interaction style, but now can build weights from arbitrary iterables of shapes or PostGIS-style dataframes.

Trying to balance this work and my own independent work on my dissertation has been challenging so far, but fortunately, the GSOC work has been more forthcoming than I expected. Hopefully, as the project matures, balancing this will be simpler.

imported from: yetanothergeographer