Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
fix merging file with extra bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Sep 20, 2018
1 parent 3a15a73 commit 5559f3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pylas/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ def merge_las(*las_files):
# scaled x, y, z have to be set manually
# to be sure to have a good offset in the header
merged = create_from_header(header)
# TODO extra dimensions should be manged better here

print(las_files[0].points_data.point_format.extra_dims)
print(las_files[0].points.dtype)

for dim_name, dim_type in las_files[0].points_data.point_format.extra_dims:
merged.add_extra_dim(dim_name, dim_type)

merged.points = np.zeros(num_pts_merged, merged.points.dtype)
merged_x = np.zeros(num_pts_merged, np.float64)
merged_y = np.zeros(num_pts_merged, np.float64)
Expand Down
7 changes: 6 additions & 1 deletion pylastests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def write_then_read_again(las, do_compress=False):
return pylas.read(out)


@pytest.fixture(params=[simple_las, simple_laz, vegetation1_3_las, test1_4_las, plane_laz, extra_bytes_laz, extra_bytes_las])
@pytest.fixture(
params=[simple_las, simple_laz, vegetation1_3_las, test1_4_las, plane_laz, extra_bytes_laz, extra_bytes_las])
def las(request):
return pylas.read(request.param)

Expand Down Expand Up @@ -199,3 +200,7 @@ def test_coords_when_using_create_from_header(las):

def test_slicing(las):
las.points = las.points[len(las.points) // 2:]


def test_can_write_then_re_read_files(las):
las = write_then_read_again(las, do_compress=las.points_data.point_format.id < 6)

0 comments on commit 5559f3c

Please sign in to comment.