Cell-Based Association
cell_based_association(cell_size, geodata, output_path, column=None, subset_target_attribute_values=None, add_name=None, add_buffer=None)
Creation of CBA matrix.
Initializes a CBA matrix from a vector file. The mesh is calculated according to the geometries contained in this file and the size of cells. Allows to add multiple vector data to the matrix, based on targeted shapes and/or attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cell_size |
int
|
Size of the cells. |
required |
geodata |
List[GeoDataFrame]
|
GeoDataFrame to create the CBA matrix. Additional GeoDataFrame(s) can be imputed to add to the CBA matrix. |
required |
output_path |
Union[str, PathLike]
|
Name of the saved .tif file. Include file extension (.tif) in the path. |
required |
column |
Optional[List[str]]
|
Name of the column of interest. If no attribute is specified,
then an artificial attribute is created representing the presence
or absence of the geometries of this file for each cell of the CBA
grid. A categorical attribute will generate as many columns (binary)
in the CBA matrix than values considered of interest (dummification).
See parameter |
None
|
subset_target_attribute_values |
Optional[List[Union[None, list, str]]]
|
List of values of interest of the target attribute, in case a categorical target attribute has been specified. Allows to filter a subset of relevant values. Additional values can be imputed for each added GeoDataFrame(s). |
None
|
add_name |
Optional[List[Union[str, None]]]
|
Name of the column(s) to add to the matrix. |
None
|
add_buffer |
Optional[List[Union[Number, bool]]]
|
Allow the use of a buffer around shapes before the intersection with CBA cells for the added GeoDataFrame(s). Minimize border effects or allow increasing positive samples (i.e. cells with mineralization). The size of the buffer is computed using the CRS (if projected CRS in meters: value in meters). |
None
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
CBA matrix is created. |
Source code in eis_toolkit/vector_processing/cell_based_association.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|