metrics¶
occulus.metrics
¶
Point cloud metrics, statistics, and raster products.
Available functions
- :func:
point_density— 2D point density raster (pts/m²) - :func:
canopy_height_model— max-Z raster above ground (aerial/UAV) - :func:
coverage_statistics— summary statistics over the density map - :func:
compute_cloud_statistics— per-cloud elevation and intensity statistics
All functions are pure NumPy and do not require optional dependencies.
CloudStatistics
dataclass
¶
Summary statistics for a point cloud.
Attributes:
| Name | Type | Description |
|---|---|---|
n_points |
int
|
Total point count. |
bounds |
NDArray[float64]
|
Bounding box as (2, 3) array |
centroid |
NDArray[float64]
|
Centroid as (3,) array. |
z_min |
float
|
Minimum elevation. |
z_max |
float
|
Maximum elevation. |
z_mean |
float
|
Mean elevation. |
z_std |
float
|
Standard deviation of elevation. |
z_percentiles |
dict[int, float]
|
Elevation percentiles at 5, 25, 50, 75, 95. |
intensity_mean |
float | None
|
Mean intensity value, or |
intensity_std |
float | None
|
Standard deviation of intensity, or |
Source code in src/occulus/metrics/__init__.py
CoverageStatistics
dataclass
¶
Coverage statistics derived from a point density map.
Attributes:
| Name | Type | Description |
|---|---|---|
mean_density |
float
|
Mean point density over occupied cells (pts/unit²). |
min_density |
float
|
Minimum density over all cells. |
max_density |
float
|
Maximum density over all cells. |
std_density |
float
|
Standard deviation of density. |
gap_fraction |
float
|
Fraction of raster cells with zero density (coverage gaps). |
total_area |
float
|
Total raster area in coordinate units squared. |
covered_area |
float
|
Area of cells with at least one point. |
Source code in src/occulus/metrics/__init__.py
canopy_height_model(cloud, resolution=1.0, *, ground_class=2)
¶
Generate a Canopy Height Model (CHM) raster.
Separates ground (ASPRS class 2) from non-ground points, interpolates a ground surface, and computes height above ground for each raster cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input cloud. Should have a classification array with ground class 2. Must be aerial or UAV platform. |
required |
resolution
|
float
|
Raster cell size in coordinate units, by default 1.0. |
1.0
|
ground_class
|
int
|
ASPRS classification code for ground points, by default 2. |
2
|
Returns:
| Name | Type | Description |
|---|---|---|
chm |
NDArray[float64]
|
CHM raster of shape (ny, nx) — height above ground per cell. Cells with no non-ground points are set to 0. |
x_edges |
NDArray[float64]
|
X bin edges. |
y_edges |
NDArray[float64]
|
Y bin edges. |
Raises:
| Type | Description |
|---|---|
UnsupportedPlatformError
|
If the cloud platform is |
OcculusValidationError
|
If |
Source code in src/occulus/metrics/__init__.py
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 321 322 | |
compute_cloud_statistics(cloud)
¶
Compute summary statistics for a point cloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. Must have at least one point. |
required |
Returns:
| Type | Description |
|---|---|
CloudStatistics
|
Elevation and intensity summary statistics. |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If the cloud is empty. |
Source code in src/occulus/metrics/__init__.py
coverage_statistics(cloud, resolution=1.0)
¶
Compute coverage statistics from a point density map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
resolution
|
float
|
Raster cell size for density computation, by default 1.0. |
1.0
|
Returns:
| Type | Description |
|---|---|
CoverageStatistics
|
Density statistics and gap fraction. |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If |
Source code in src/occulus/metrics/__init__.py
point_density(cloud, resolution=1.0)
¶
Compute a 2D point density raster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
resolution
|
float
|
Raster cell size in coordinate units, by default 1.0. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
density |
NDArray[float64]
|
2D density array of shape (ny, nx) in points per cell.
Divide by |
x_edges |
NDArray[float64]
|
X bin edges of length nx+1. |
y_edges |
NDArray[float64]
|
Y bin edges of length ny+1. |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If |