From 7d31845f7654d48142eb86e764d16793dad90cf5 Mon Sep 17 00:00:00 2001 From: isaaccorley <22203655+isaaccorley@users.noreply.github.com> Date: Tue, 30 Nov 2021 20:32:46 -0600 Subject: [PATCH] update test data readme for las files --- tests/data/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/data/README.md b/tests/data/README.md index 35cca49b9d5..3884cbf382a 100644 --- a/tests/data/README.md +++ b/tests/data/README.md @@ -91,3 +91,28 @@ masks = np.random.randint(low=0, high=num_classes, size=(1, 1)).astype(np.uint8) f.create_dataset("images", data=images) f.create_dataset("masks", data=masks) f.close() +``` + +### LAS Point Cloud files + +```python +import laspy + +num_points = 4 + +las = laspy.read("0.las") +las.points = las.points[:num_points] + +points = np.random.randint(low=0, high=100, size=(num_points,), dtype=las.x.dtype) +las.x = points +las.y = points +las.z = points + +if hasattr(las, "red"): + colors = np.random.randint(low=0, high=10, size=(num_points,), dtype=las.red.dtype) + las.red = colors + las.green = colors + las.blue = colors + +las.write("0.las") +```