Block - Poisson Kriging#
- centroid_poisson_kriging(semivariogram_model, blocks, point_support, unknown_block, unknown_block_point_support, number_of_neighbors, is_weighted_by_point_support=True, raise_when_negative_prediction=True, raise_when_negative_error=True, allow_approximate_solutions=False)[source]
Function performs centroid-based Poisson Kriging of blocks (areal) data.
- Parameters:
- semivariogram_modelTheoreticalVariogram
A fitted variogram.
- blocksUnion[Blocks, gpd.GeoDataFrame, pd.DataFrame, np.ndarray]
- Blocks with aggregated data.
Blocks
:Blocks()
class object.GeoDataFrame
andDataFrame
must have columns:centroid_x, centroid_y, ds, index
. Geometry column with polygons is not used.numpy array
:[[block index, centroid x, centroid y, value]]
.
- point_supportUnion[Dict, np.ndarray, gpd.GeoDataFrame, pd.DataFrame, PointSupport]
- The point support of polygons.
Dict
:{block id: [[point x, point y, value]]}
,numpy array
:[[block id, x, y, value]]
,DataFrame
andGeoDataFrame
:columns={x_col, y_col, ds, index}
,PointSupport
.
- unknown_blocknumpy array
[index, centroid x, centroid y]
- unknown_block_point_supportnumpy array
Points within block
[[x, y, point support value]]
- number_of_neighborsint
The minimum number of neighbours that can potentially affect block.
- is_weighted_by_point_supportbool, default = True
Are distances between blocks weighted by the point support?
- raise_when_negative_predictionbool, default=True
Raise error when prediction is negative.
- raise_when_negative_errorbool, default=True
Raise error when prediction error is negative.
- allow_approximate_solutionsbool, default=False
Allows the approximation of kriging weights based on the OLS algorithm. We don’t recommend set it to
True
if you don’t know what are you doing. This parameter can be useful when you have clusters in your dataset, that can lead to singular or near-singular matrix creation.
- Returns:
- resultsList
[unknown block index, prediction, error]
- Raises:
- ValueError
Prediction or prediction error are negative.
- Warns:
- ExperimentalFeatureWarning
Directional Kriging is in early-phase and may contain bugs.
- area_to_area_pk(semivariogram_model, blocks, point_support, unknown_block, unknown_block_point_support, number_of_neighbors, raise_when_negative_prediction=True, raise_when_negative_error=True, log_process=True)[source]
Function predicts areal value in an unknown location based on the area-to-area Poisson Kriging
- Parameters:
- semivariogram_modelTheoreticalVariogram
A fitted variogram.
- blocksUnion[Blocks, gpd.GeoDataFrame, pd.DataFrame, np.ndarray]
- Blocks with aggregated data.
Blocks
:Blocks()
class object.GeoDataFrame
andDataFrame
must have columns:centroid_x, centroid_y, ds, index
. Geometry column with polygons is not used.numpy array
:[[block index, centroid x, centroid y, value]]
.
- point_supportUnion[Dict, np.ndarray, gpd.GeoDataFrame, pd.DataFrame, PointSupport]
- The point support of polygons.
Dict
:{block id: [[point x, point y, value]]}
,numpy array
:[[block id, x, y, value]]
,DataFrame
andGeoDataFrame
:columns={x_col, y_col, ds, index}
,PointSupport
.
- unknown_blocknumpy array
[index, centroid x, centroid y]
- unknown_block_point_supportnumpy array
Points within block
[[x, y, point support value]]
- number_of_neighborsint
The minimum number of neighbours that can potentially affect block.
- raise_when_negative_predictionbool, default=True
Raise error when prediction is negative.
- raise_when_negative_errorbool, default=True
Raise error when prediction error is negative.
- log_processbool, default=True
Log process info and debug info.
- Returns:
- resultsList
[unknown block index, prediction, error]
- Raises:
- ValueError
Prediction or prediction error are negative.
- Warns:
- ExperimentalFeatureWarning
Directional Kriging is in early-phase and may contain bugs.
- area_to_point_pk(semivariogram_model, blocks, point_support, unknown_block, unknown_block_point_support, number_of_neighbors, max_range=None, raise_when_negative_prediction=True, raise_when_negative_error=True, err_to_nan=True)[source]
Function predicts areal value in the unknown location based on the area-to-area Poisson Kriging
- Parameters:
- semivariogram_modelTheoreticalVariogram
A fitted variogram.
- blocksUnion[Blocks, gpd.GeoDataFrame, pd.DataFrame, np.ndarray]
- Blocks with aggregated data.
Blocks
:Blocks()
class object.GeoDataFrame
andDataFrame
must have columns:centroid_x, centroid_y, ds, index
. Geometry column with polygons is not used.numpy array
:[[block index, centroid x, centroid y, value]]
.
- point_supportUnion[Dict, np.ndarray, gpd.GeoDataFrame, pd.DataFrame, PointSupport]
- The point support of polygons.
Dict
:{block id: [[point x, point y, value]]}
,numpy array
:[[block id, x, y, value]]
,DataFrame
andGeoDataFrame
:columns={x_col, y_col, ds, index}
,PointSupport
.
- unknown_blocknumpy array
[index, centroid x, centroid y]
- unknown_block_point_supportnumpy array
Points within block
[[x, y, point support value]]
- number_of_neighborsint
The minimum number of neighbours that can potentially affect block.
- max_rangefloat , default=None
The maximum distance to search for a neighbors, if
None
given then algorithm uses the theoretical variogram’s range.- raise_when_negative_predictionbool, default=True
Raise error when prediction is negative.
- raise_when_negative_errorbool, default=True
Raise error when prediction error is negative.
- err_to_nanbool, default=True
ValueError
toNaN
.
- Returns:
- resultsList
[(unknown point coordinates), prediction, error]
- Raises:
- ValueError
Prediction or prediction error are negative.
- Warns:
- ExperimentalFeatureWarning
Directional Kriging is in early-phase and may contain bugs.