1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
import numpy as np
import pytest
import laspy
from laspy import LazBackend
from tests.test_common import test1_4_las, write_then_read_again
@pytest.fixture(scope="session")
def las():
return laspy.read(test1_4_las)
@pytest.fixture(params=LazBackend.detect_available())
def laz_backend(request):
return request.param
def test_classification(las):
las.classification[:] = 234
assert np.all(las.classification == 234)
res = write_then_read_again(las)
assert np.all(las.classification == res.classification)
def test_intensity(las):
las.intensity[:] = 89
assert np.all(las.intensity == 89)
res = write_then_read_again(las)
assert np.all(las.intensity == res.intensity)
def test_writing_las_with_evlrs():
las = laspy.read(test1_4_las)
assert las.evlrs == []
evlr = laspy.VLR(
user_id="test",
record_id=42,
description="Just a test",
record_data=b"And so he grinds his own hands",
)
las.evlrs.append(evlr)
las_1 = write_then_read_again(las, do_compress=False)
assert las_1.evlrs == [evlr]
def test_writing_laz_with_evlrs(laz_backend):
las = laspy.read(test1_4_las)
assert las.evlrs == []
evlr = laspy.VLR(
user_id="test",
record_id=42,
description="Just a test",
record_data=b"And so he grinds he own hands",
)
las.evlrs.append(evlr)
las_1 = write_then_read_again(las, do_compress=True, laz_backend=laz_backend)
assert las_1.evlrs == [evlr]
|