Process Module¶
process_with_tiles(ept_file, tile_size, output_path, metric, voxel_size, voxel_height=1, buffer_size=0.1, srs=None, hag=False, hag_dtm=False, dtm=None, bounds=None, interpolation=None, remove_outliers=False, cover_min_height=2.0, cover_k=0.5, skip_existing=False, verbose=False, thin_radius=None)
¶
Process a large EPT point cloud by tiling, compute CHM or other metrics for each tile, and write the results to the specified output directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ept_file
|
str
|
Path to the EPT file containing the point cloud data. |
required |
tile_size
|
tuple
|
Size of each tile as (tile_width, tile_height). |
required |
output_path
|
str
|
Directory where the output files will be saved. |
required |
metric
|
str
|
Metric to compute for each tile ("chm", "fhd", "pai", or "cover"). |
required |
voxel_size
|
tuple
|
Voxel resolution as (x_resolution, y_resolution, z_resolution). |
required |
voxel_height
|
float
|
Height of each voxel in meters. Required if metric is "pai". |
1
|
buffer_size
|
float
|
Fractional buffer size relative to tile size (e.g., 0.1 for 10% buffer). Defaults to 0.1. |
0.1
|
srs
|
str
|
Spatial Reference System for the output. If None, uses SRS from the EPT file. |
None
|
hag
|
bool
|
If True, compute Height Above Ground using Delaunay triangulation. Defaults to False. |
False
|
hag_dtm
|
bool
|
If True, compute Height Above Ground using a provided DTM raster. Defaults to False. |
False
|
dtm
|
str
|
Path to the DTM raster file. Required if hag_dtm is True. |
None
|
bounds
|
tuple
|
Spatial bounds to crop the data. Must be of the form ([xmin, xmax], [ymin, ymax], [zmin, zmax]) or ([xmin, xmax], [ymin, ymax]). If None, tiling is done over the entire dataset. |
None
|
interpolation
|
str or None
|
Interpolation method for CHM calculation ("linear", "cubic", "nearest", or None). |
None
|
remove_outliers
|
bool
|
Whether to remove statistical outliers before calculating metrics. Defaults to False. |
False
|
cover_min_height
|
float
|
Height threshold (in meters) for canopy cover (used when metric == "cover"). Defaults to 2.0. |
2.0
|
cover_k
|
float
|
Beer–Lambert extinction coefficient for canopy cover. Defaults to 0.5. |
0.5
|
skip_existing
|
bool
|
If True, skip tiles whose output file already exists. Defaults to False. |
False
|
verbose
|
bool
|
If True, print warnings for empty/invalid tiles and buffer adjustments. Defaults to False. |
False
|
thin_radius
|
float or None
|
If provided (> 0), apply Poisson radius-based thinning per tile before metrics. Units are in the same CRS as the data (e.g., meters). Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
Raises:
Type | Description |
---|---|
ValueError
|
If an unsupported metric is requested, if buffer or voxel sizes are invalid, or required arguments are missing. |
FileNotFoundError
|
If the EPT or DTM file does not exist, or a required file for processing is missing. |
Source code in pyforestscan/process.py
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|