1111import patchwork .constants as c
1212from patchwork .patchwork import (
1313 append_points ,
14+ get_common_las_columns ,
1415 get_complementary_points ,
1516 get_field_from_header ,
16- get_common_las_columns ,
1717 get_selected_classes_points ,
1818 get_type ,
1919 patchwork ,
@@ -434,6 +434,11 @@ def test_patchwork_default(tmp_path_factory, recipient_path, expected_nb_added_p
434434 True ,
435435 0 ,
436436 ), # No donor
437+ (
438+ "test/data/lidar_HD_decimated_with_origin_value/Semis_2022_0673_6362_LA93_IGN69_with_origin.laz" ,
439+ True ,
440+ 128675 ,
441+ ), # One donor. Origin dimension already in input file
437442 ],
438443)
439444def test_patchwork_with_origin (tmp_path_factory , recipient_path , donor_use_synthetic_points , expected_nb_added_points ):
@@ -563,25 +568,40 @@ def test_patchwork_with_mount_points(tmp_path_factory, input_shp_path, recipient
563568 assert np .all (output_points .classification [output_points .Origin == 1 ] == 11 )
564569 assert not np .any (output_points .classification [output_points .Origin == 0 ] == 11 )
565570
571+
566572@pytest .mark .parametrize (
567573 "las_liste" ,
568574 [
569- (["test/data/aveyron_lidarBD/data/NUALID_1-0_IAVEY_PTS_0673_6363_LAMB93_IGN69_20170519.laz" , "test/data/aveyron_lidarBD/data/NUALID_1-0_IAVEY_PTS_0673_6364_LAMB93_IGN69_20170519.laz" ]),
570- (['test/data/grand_geneve/grand_geneve_BD/data/NUALID_1-0_DS19RFAN_PTS_0963_6543_LAMB93_IGN69_20191002.laz' , 'test/data/grand_geneve/grand_geneve_BD/data2/0963_6543.laz' ]),
575+ (
576+ [
577+ "test/data/aveyron_lidarBD/data/NUALID_1-0_IAVEY_PTS_0673_6363_LAMB93_IGN69_20170519.laz" ,
578+ "test/data/aveyron_lidarBD/data/NUALID_1-0_IAVEY_PTS_0673_6364_LAMB93_IGN69_20170519.laz" ,
579+ ]
580+ ),
581+ (
582+ [
583+ "test/data/grand_geneve/grand_geneve_BD/data"
584+ + "/NUALID_1-0_DS19RFAN_PTS_0963_6543_LAMB93_IGN69_20191002.laz" ,
585+ "test/data/grand_geneve/grand_geneve_BD/data2/0963_6543.laz" ,
586+ ]
587+ ),
571588 ],
572589)
573590def test_get_common_las_columns (las_liste ):
574591 common_columns = get_common_las_columns (las_liste )
575- assert all (col in common_columns for col in ["x" , "y" , "z" , "classification" , "gps_time" , "intensity" , "return_number" , "number_of_returns" ])
592+ assert all (
593+ col in common_columns
594+ for col in ["x" , "y" , "z" , "classification" , "gps_time" , "intensity" , "return_number" , "number_of_returns" ]
595+ )
576596
577597
578598def test_patchwork_with_different_las_format (tmp_path_factory ):
579599
580- recipient_path = "test/data/grand_geneve/lidar_HD_decimate/Semis_2021_0963_6543_LA93_IGN69_decimate.laz"
600+ recipient_path = "test/data/grand_geneve/lidar_HD_decimate/Semis_2021_0963_6543_LA93_IGN69_decimate.laz"
581601 input_shp_path = "test/data/grand_geneve/geometry_GrandGeneve/zones.geojson"
582602 tmp_file_dir = tmp_path_factory .mktemp ("data" )
583603 tmp_output_las_name = "result_patchwork_different_las.laz"
584-
604+
585605 tmp_output_indices_map_name = "result_patchwork_indices.tif"
586606 donor_class_translation = {2 : 11 , 9 : 11 }
587607
@@ -594,7 +614,7 @@ def test_patchwork_with_different_las_format(tmp_path_factory):
594614 f"filepath.SHP_DIRECTORY={ os .path .dirname (input_shp_path )} " ,
595615 f"filepath.SHP_NAME={ os .path .basename (input_shp_path )} " ,
596616 f"filepath.OUTPUT_DIR={ tmp_file_dir } " ,
597- f "filepath.DONOR_SUBDIRECTORY=''" ,
617+ "filepath.DONOR_SUBDIRECTORY=''" ,
598618 f"filepath.OUTPUT_NAME={ tmp_output_las_name } " ,
599619 f"filepath.OUTPUT_INDICES_MAP_DIR={ tmp_file_dir } " ,
600620 f"filepath.OUTPUT_INDICES_MAP_NAME={ tmp_output_indices_map_name } " ,
@@ -614,7 +634,7 @@ def test_patchwork_with_different_las_format(tmp_path_factory):
614634
615635 with laspy .open (recipient_path ) as recipient_file :
616636 recipient_points = recipient_file .read ().points
617-
637+
618638 with laspy .open (output_path ) as las_file :
619639 output_points = las_file .read ().points
620640 assert {n for n in las_file .header .point_format .dimension_names } == {
@@ -625,4 +645,4 @@ def test_patchwork_with_different_las_format(tmp_path_factory):
625645 assert np .sum (output_points .Origin == 1 ) == expected_nb_added_points
626646
627647 assert np .all (output_points .classification [output_points .Origin == 1 ] == 11 )
628- assert not np .any (output_points .classification [output_points .Origin == 0 ] == 11 )
648+ assert not np .any (output_points .classification [output_points .Origin == 0 ] == 11 )
0 commit comments