diff --git a/pdaltools/standardize_format.py b/pdaltools/standardize_format.py index 073826c..aa62213 100644 --- a/pdaltools/standardize_format.py +++ b/pdaltools/standardize_format.py @@ -74,7 +74,7 @@ def get_writer_parameters(new_parameters: Dict) -> Dict: return params -def remove_points_from_class(points, class_points_removed: []) -> None: +def remove_points_from_class(points, class_points_removed: []) : input_dimensions = list(points.dtype.fields.keys()) dim_class = input_dimensions.index("Classification") @@ -97,6 +97,8 @@ def rewrite_with_pdal(input_file: str, output_file: str, params_from_parser: Dic if class_points_removed: points = remove_points_from_class(points, class_points_removed) + #ToDo : it seems that the forward="all" doesn't work because we use a new pipeline + params = get_writer_parameters(params_from_parser) pipeline_end = pdal.Pipeline(arrays=[points]) pipeline_end |= pdal.Writer.las(output_file, forward="all", **params) diff --git a/script/test/test_run_remove_classes_in_las.sh b/script/test/test_run_remove_classes_in_las.sh index 113da24..94d356d 100755 --- a/script/test/test_run_remove_classes_in_las.sh +++ b/script/test/test_run_remove_classes_in_las.sh @@ -2,4 +2,4 @@ python -m pdaltools.standardize_format \ --input_file test/data/classified_laz/test_data_77050_627755_LA93_IGN69.laz \ --output_file test/tmp/replaced_cmdline.laz \ --record_format 6 \ - --remove_class 2 \ \ No newline at end of file + --class_points_removed 2 \ \ No newline at end of file diff --git a/test/test_las_remove_dimensions.py b/test/test_las_remove_dimensions.py index 1914d55..09e05a5 100644 --- a/test/test_las_remove_dimensions.py +++ b/test/test_las_remove_dimensions.py @@ -60,8 +60,7 @@ def test_remove_one_dimension(): assert list(points_end.dtype.fields.keys()).index("DIM_2") >= 0 # should still contains DIM_2 - with pytest.raises(ValueError): - list(points_end.dtype.fields.keys()).index("DIM_1") # should not have DIM_1 + assert "DIM_1" not in points_end.dtype.fields.keys(), "LAS should not have dimension DIM_1" with pytest.raises(TypeError): numpy.array_equal(points_ini, points_end) # output data should not be the same