-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ajout d'une fn de surpression de dimensions
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import tempfile | ||
import pdal | ||
import numpy | ||
|
||
from macro.macro import remove_dimensions | ||
|
||
|
||
def test_remove_dimension(): | ||
|
||
ini_las = "test/data/4_6.las" | ||
added_dimensions = ["DIM_1", "DIM_2"] | ||
|
||
tmp_las = tempfile.NamedTemporaryFile(suffix="_add.las").name | ||
|
||
# recuperation des données ini | ||
pipeline_read_ini = pdal.Pipeline() | pdal.Reader.las(ini_las) | ||
pipeline_read_ini.execute() | ||
points_ini = pipeline_read_ini.arrays[0] | ||
|
||
# ajout de dimensions supplémentaires | ||
pipeline = pdal.Pipeline() | ||
pipeline |= pdal.Reader.las(ini_las) | ||
pipeline |= pdal.Filter.ferry(dimensions="=>" + ", =>".join(added_dimensions)) | ||
pipeline |= pdal.Writer.las(tmp_las, extra_dims="all", forward="all",) | ||
pipeline.execute() | ||
|
||
# suppression des dimensions | ||
remove_dimensions(tmp_las, added_dimensions, tmp_las) | ||
|
||
# recuperation des données finales | ||
pipeline_read_end = pdal.Pipeline() | pdal.Reader.las(tmp_las) | ||
pipeline_read_end.execute() | ||
points_end = pipeline_read_end.arrays[0] | ||
|
||
# les données ini et finales doivent être identique | ||
assert numpy.array_equal(points_ini, points_end) | ||
|
||
|