示例#1
0
def test_read_all_fields():
    data = read(very_small_las)
    out = TEMP_DIR / "out.las"
    data["something_else"] = np.full(len(data["xyz"]), fill_value=1)
    write(data, out)
    data_out = read(out)
    assert sorted(list(data_out)) == [
        "classification",
        "edge_of_flight_line",
        "gps_time",
        "intensity",
        "key_point",
        "number_of_returns",
        "point_source_id",
        "return_number",
        "scan_angle_rank",
        "scan_direction_flag",
        "something_else",
        "synthetic",
        "user_data",
        "withheld",
        "xyz",
    ]
示例#2
0
    def get_data(self, idx):
        pc_path = self.path_list[idx]
        log.debug("get_data called {}".format(pc_path))
        data = jaklas.read(pc_path)

        points = (data["xyz"] - np.mean(data["xyz"], axis=0)).astype("float32")

        labels = data["Label"].astype("int32")

        # feat = np.vstack((data["red"], data["green"], data["blue"])).T.astype("float32")
        feat = None

        data = {'point': points, 'feat': feat, 'label': labels}

        return data
示例#3
0
def test_read_dtype():
    data = read(very_small_las, xyz_dtype="f")
    assert data["xyz"].dtype == np.float32
    data = read(very_small_las)
    assert data["xyz"].dtype == np.float64
示例#4
0
def test_read_wrong_dim():
    with pytest.raises(ValueError):
        data = read(very_small_las, other_dims=["wrong"])
示例#5
0
def test_read_other_dims():
    data = read(very_small_las, other_dims=["classification"])
    assert "gps_time" not in data and "intensity" not in data
    assert "classification" in data
示例#6
0
def test_read_not_combined():
    data = read(very_small_las, combine_xyz=False)
    assert "x" in data and "y" in data and "z" in data
    assert "xyz" not in data
示例#7
0
def test_read_with_offset():
    data1 = read(very_small_las)
    data2 = read(very_small_las, offset=(1, 1, 1))
    assert np.allclose(data1["xyz"], data2["xyz"] + 1)
示例#8
0
def test_read_small_laz():
    data = read(very_small_laz)
    assert len(data["xyz"]) == 71