io¶
occulus.io
¶
Point cloud I/O — read and write LAS, LAZ, PLY, PCD, and XYZ formats.
Primary interface:
from occulus.io import read, write
cloud = read("scan.laz")
write(cloud, "output.las")
Delegates to format-specific backends. LAS/LAZ via laspy, PLY/PCD via Open3D (optional), XYZ via NumPy.
read(path, *, platform=Platform.UNKNOWN, subsample=None)
¶
Read a point cloud file and return the appropriate PointCloud subtype.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the point cloud file. Format is inferred from the extension. |
required |
platform
|
Platform | str
|
Acquisition platform hint. When provided, returns the appropriate
subtype (AerialCloud, TerrestrialCloud, UAVCloud). Defaults to
|
UNKNOWN
|
subsample
|
float | None
|
If provided, randomly subsample to this fraction of points (0.0–1.0) after reading. Useful for quickly exploring large files. |
None
|
Returns:
| Type | Description |
|---|---|
PointCloud
|
The loaded point cloud (or platform-specific subtype). |
Raises:
| Type | Description |
|---|---|
OcculusIOError
|
If the file does not exist or cannot be read. |
OcculusValidationError
|
If the file extension is not supported or |
Source code in src/occulus/io/readers.py
write(cloud, path, *, compress=None)
¶
Write a point cloud to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
The point cloud to write. Must have a valid |
required |
path
|
str | Path
|
Output file path. Format is inferred from the extension. |
required |
compress
|
bool | None
|
For LAS output, whether to compress to LAZ format. If |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The resolved path of the written file. |
Raises:
| Type | Description |
|---|---|
OcculusIOError
|
If the file cannot be written. |
OcculusValidationError
|
If the format is not supported. |