This PR adds a new function, max-p, that analyzes a polygon dataset with numeric attributes and produces a set of contiguous regions according to properties that the user can define. For instance, it can find states which have similar per capita income, group counties into larger regions such that each formed region has approximately the same population aggregated from the counties, and so on.
Other changes
This code also contains some refactoring of the pysal_utils submodule which several of the analyses (e.g., moran, getis, markov) rely upon. For example, a utility used solely in markov has been repurposed as a pysal_utils function for getting multiple attributes and packing them into a NumPy array. The query-generating functions for where and selects continue to become more abstract as they're used in slightly different cases.
TODOs
[x] All declared geometries are geometry(Geometry, 4326) for general geoms, or geometry(Point, 4326)
[x] Existing functions in crankshaft python library called from the extension are kept at least from version N to version N+1 (to avoid breakage during upgrades).
[ ] Docs for public-facing functions are written
[x] New functions follow the naming conventions: CDB_NameOfFunction. Where internal functions begin with an underscore
Description
This PR adds a new function, max-p, that analyzes a polygon dataset with numeric attributes and produces a set of contiguous regions according to properties that the user can define. For instance, it can find states which have similar per capita income, group counties into larger regions such that each formed region has approximately the same population aggregated from the counties, and so on.
Other changes
This code also contains some refactoring of the
pysal_utils
submodule which several of the analyses (e.g., moran, getis, markov) rely upon. For example, a utility used solely in markov has been repurposed as apysal_utils
function for getting multiple attributes and packing them into a NumPy array. The query-generating functions for where and selects continue to become more abstract as they're used in slightly different cases.TODOs
geometry(Geometry, 4326)
for general geoms, orgeometry(Point, 4326)
CDB_NameOfFunction
. Where internal functions begin with an underscoreOther tasks:
floor_variable
to allow for more nuanced constraints