data = {}
with laspy.file.File(filename) as las:
data["points"] = pd.DataFrame(las.points["point"])
data["points"].columns = (x.lower() for x in data["points"].columns)
// because laspy do something strange with scale
data["points"].loc[:, ["x", "y", "z"]] *= las.header.scale
data = convert_location_to_dtype(data, xyz_dtype)
data = convert_color_to_dtype(data, rgb_dtype)
data["las_header"] = las.header
After Change
if backend == "pylas":
data = read_las_with_pylas(filename)
elif backend == "laspy":
data = read_las_with_laspy(filename)
else:
raise ValueError(f"Unsupported backend. Expected one of ["pylas", "laspy"] but got {backend}")
data = convert_location_to_dtype(data, xyz_dtype)
data = convert_color_to_dtype(data, rgb_dtype)