geo3d.io.file_io

Functions

list_files(→ List[str])

List files in a directory.

read_point_cloud(→ numpy.typing.NDArray[numpy.floating])

Read a point cloud file.

write_point_cloud(→ None)

Write a point cloud file in las format.

class_weights_file(→ dict)

Compute the class weigths (counts) of a point cloud file.

class_weights_dataset(→ Dict[int, int | float])

Compute the class weights of a dataset of point clouds.

Module Contents

geo3d.io.file_io.list_files(directory: str, ext: str = 'las') List[str]

List files in a directory.

Parameters:
  • directory (str) – The directory containing the files.

  • ext (str, optional) – The extension of the files. Defaults to “las”.

Returns:

A list of filenames.

geo3d.io.file_io.read_point_cloud(filename: str) numpy.typing.NDArray[numpy.floating]

Read a point cloud file.

Parameters:

filename (str) – The point cloud file.

Returns:

The point cloud array.

Return type:

np.ndarray

geo3d.io.file_io.write_point_cloud(array: numpy.ndarray, filename: str) None

Write a point cloud file in las format.

Parameters:
  • array (np.ndarray) – The point cloud array.

  • filename (str) – The filename to write (las format).

geo3d.io.file_io.class_weights_file(filename: str) dict

Compute the class weigths (counts) of a point cloud file.

Parameters:

filename (str) – The point cloud file.

Returns:

A dictionary containing the classes and their relative counts.

geo3d.io.file_io.class_weights_dataset(directory: str, ext: str = 'las', normalize: bool = True, classes: List[int] = [1, 2, 3], n_jobs: int = -1) Dict[int, int | float]

Compute the class weights of a dataset of point clouds.

Parameters:
  • directory (str) – The directory containing the point clouds.

  • ext (str, optional) – The extension of the point cloud files. Defaults to “las”.

  • normalize (bool, optional) – Give percentages if True. Defaults to True.

  • classes (list) – The list of classes to get their counts.

  • n_jobs (int) – The number of workers. Defaults to -1.

Returns:

A dictionary with keys the classes and values their counts.