ANSWER:
Because this was flagged, I can't answer my own question. As @JRR noted, the key aspect is to be mindful of the datatype. lidR will read the extra attribute. I hope this helps someone in the future.
So in python
import laspy
def write_label(point_cloud, path):
#Create laspy object
outFile1 = laspy.file.File(path, mode = "w",header = inFile.header)
#First define the new types
outFile1.define_new_dimension(
name="label",
data_type=5, #Data types may matter
description = "Integer Tree Label"
)
# copy fields from laspy object
for dimension in inFile.point_format:
dat = inFile.reader.get_dimension(dimension.name)
outFile1.writer.set_dimension(dimension.name, dat)
outFile1.label = <label column from pandas here>
outFile1.close()
lidR sees a new integer column "label"
> colnames(a@data)
[1] "X" "Y" "Z" "gpstime"
[5] "Intensity" "ReturnNumber" "NumberOfReturns" "ScanDirectionFlag"
[9] "EdgeOfFlightline" "Classification" "Synthetic_flag" "Keypoint_flag"
[13] "Withheld_flag" "ScanAngle" "UserData" "PointSourceID"
[17] "R" "G" "B" "reversible index (lastile)"
[21] "label"