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: |
|
---|---|
Returns: |
|
Examples
>>> import libpysal
>>> O = libpysal.weights.lat2W(2,2)
>>> D = libpysal.weights.lat2W(2,2)
>>> OD = libpysal.weights.spintW.ODW(O,D)
>>> OD.weights[0]
[0.25, 0.25, 0.25, 0.25]
>>> OD.neighbors[0]
array([ 5, 6, 9, 10], dtype=int32)
>>> 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. ])