Python 从numpy读取并另存为las文件

Python 从numpy读取并另存为las文件,python,point-cloud-library,lidar-data,liblas,laspy,Python,Point Cloud Library,Lidar Data,Liblas,Laspy,我想以.las格式保存一些文件,我发现以下代码: import laspy import numpy as np hdr = laspy.header.Header() outfile = laspy.file.File("output.las", mode="w", header=hdr) allx = np.array([1.000, 2.000, 3.000, 3.000]) # Four Points ally = np.array([0.00

我想以.las格式保存一些文件,我发现以下代码:

import laspy
import numpy as np

hdr = laspy.header.Header()

outfile = laspy.file.File("output.las", mode="w", header=hdr)
allx = np.array([1.000, 2.000, 3.000, 3.000]) # Four Points
ally = np.array([0.000, 0.000, 0.000, 3.000])
allz = np.array([10.000, 10.000, 11.000, 11.000])

xmin = np.floor(np.min(allx))
ymin = np.floor(np.min(ally))
zmin = np.floor(np.min(allz))

outfile.header.offset = [xmin,ymin,zmin]
outfile.header.scale = [0.001,0.001,0.001]

outfile.x = allx
outfile.y = ally
outfile.z = allz

outfile.close()  
这可以正常工作但是这是针对只有X Y Z值的数据,我如何才能为带有X Y Z标签的数据写这篇文章呢???。。。我的源数据集为*.txt格式