libpysal.weights.ODW¶
-
libpysal.weights.
ODW
(Wo, Wd, transform='r', silence_warnings=True)[source]¶ Constructs an o*d by o*d origin-destination style spatial weight for o*d flows using standard spatial weights on o origins and d destinations. Input spatial weights must be binary or able to be sutiably transformed to binary.
- Parameters
- WoW object for origin locations
o x o spatial weight object amongst o origins
- WdW object for destination locations
d x d spatial weight object amongst d destinations
- transformTransformation for standardization of final OD spatial weight; default
is ‘r’ for row standardized
- Returns
- Wspatial contiguity W object for assocations between flows
o*d x o*d spatial weight object amongst o*d flows between o origins and d destinations
Examples
>>> import libpysal >>> O = libpysal.weights.lat2W(2,2) >>> D = libpysal.weights.lat2W(2,2) >>> OD = libpysal.weights.ODW(O,D) >>> OD.weights[0] [0.25, 0.25, 0.25, 0.25] >>> OD.neighbors[0] [5, 6, 9, 10] >>> OD.full()[0][0] array([0. , 0. , 0. , 0. , 0. , 0.25, 0.25, 0. , 0. , 0.25, 0.25, 0. , 0. , 0. , 0. , 0. ])