I am taking this example from laspy docs where the new LasData is created and written to a file: import laspy import numpy as np # 0. Creating some dummy data my_data_xx, my_data_yy = np.meshgrid(np.linspace(-20, 20, 15), np.linspace(-20, 20, 15)) my_data_zz = my_data_xx ** 2 + 0.25 * my_data_yy ** 2 my_data = np.hstack((my_data_xx.reshape((-1, 1)), my_data_yy.reshape((-1, 1)), my_data_zz.reshape((-1, 1)))) # 1. Create a new header header = laspy.LasHeader(point_format=3, version="1.2") header.add_extra_dim(laspy.ExtraBytesParams(name="random", type=np.int32)) header.offsets = np.min(my_data, axis=0) header.scales = np.array([0.1, 0.1, 0.1]) # 2. Create a Las las = laspy.LasData(header) las.x = my_data[:, 0] las.y = my_data[:, 1] las.z = my_data[:, 2] las.random = np.random.randint(-1503, 6546, len(las.points), np.int32) las.write("new_file.las") My use case is just slightly different: my_data comes itself from a laz file (let's say, each 10th point), which has its own LasHeader. I have seen the possibility to create new LasData based on the existing header as: header = copy(las.header) d_las = laspy.LasData(header) However, then I get unmatching array dimensions error due to the fact (I suppose) that point_count in the old header does not match the new data. Question is then: if I create a laz by taking 10th point of the already-existing laz, should I manually recompute offsets and scales as in example below & manually adjust the point_count in the header? Or is there some more elegant way which updates those automatically based on the new x/y/z data I provide? Continue reading...