@@ -102,21 +102,29 @@ def get_writer_params(input_file):
102102
103103
104104def pipeline_read_from_cloud (filename ):
105+ print ("source cloud: " , filename )
105106 pipeline_source = pdal .Pipeline ()
106107 pipeline_source |= pdal .Reader .las (filename = filename )
107108 return pipeline_source
108109
109110
110111def pipeline_read_from_DSM (dsm , ground_mask , classification ):
112+ print ("DSM: " , dsm )
113+ print ("ground_mask: " , ground_mask )
114+ print ("classification: " , classification )
115+
111116 # get nodata value
112117 ds = gdal .Open (dsm )
113118 band = ds .GetRasterBand (1 )
114119 nodata_value = band .GetNoDataValue ()
120+ print ("DSM: nodata:" , nodata_value )
115121 ds .Close ()
116122
117123 pipeline = pdal .Pipeline ()
118124 pipeline |= pdal .Reader .gdal (filename = dsm , header = "Z" )
119- pipeline |= pdal .Filter .expression (expression = f"Z != { nodata_value } " )
125+
126+ if nodata_value is not None : # nodata_value may be None and cause bugs
127+ pipeline |= pdal .Filter .expression (expression = f"Z != { nodata_value } " )
120128
121129 pipeline |= pdal .Filter .ferry (dimensions = "=> ground" )
122130 pipeline |= pdal .Filter .assign (assignment = "ground[:]=-1" )
@@ -134,6 +142,11 @@ def pipeline_read_from_DSM(dsm, ground_mask, classification):
134142def replace_area (
135143 target_cloud , pipeline_source , replacement_area , output_cloud , source_pdal_filter = "" , target_pdal_filter = ""
136144):
145+ print ("target cloud: " , target_cloud )
146+ print ("replacement area: " , replacement_area )
147+ print ("output cloud: " , output_cloud )
148+ print ("source pdal filter: " , source_pdal_filter )
149+ print ("target pdal filter: " , target_pdal_filter )
137150 crops = []
138151 # pipeline to read target_cloud and remove points inside the polygon
139152 pipeline_target = pdal .Pipeline ()
0 commit comments