Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_metadata(self):
"""Can we fetch PDAL metadata"""
json = self.fetch_json('sort.json')
r = pdal.Pipeline(json)
r.validate()
r.execute()
metadata = r.metadata
import json
j = json.loads(metadata)
self.assertEqual(j["metadata"]["readers.las"][0]["count"], 1065)
def test_merged_arrays(self):
"""Can we fetch multiple point views from merged PDAL data """
json = self.fetch_json('chip.json')
r = pdal.Pipeline(json)
r.validate()
r.execute()
arrays = r.arrays
self.assertEqual(len(arrays), 43)
def test_execution(self):
"""Can we execute a PDAL pipeline"""
x = self.fetch_json('sort.json')
r = pdal.Pipeline(x)
r.validate()
r.execute()
self.assertGreater(len(r.pipeline), 200)
def test_validate(self):
"""Do we complain with bad pipelines"""
r = pdal.Pipeline(bad_json)
with self.assertRaises(RuntimeError):
r.validate()
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
self.assertEqual(auto_reader.prefix, "readers")
self.assertEqual(auto_writer.prefix, "writers")
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
self.assertEqual(auto_reader.prefix, "readers")
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
self.assertEqual(auto_reader.prefix, "readers")
self.assertEqual(auto_writer.prefix, "writers")
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
self.assertEqual(auto_reader.prefix, "readers")
self.assertEqual(auto_writer.prefix, "writers")
def test_pipeline_construction(self):
pipeline = (pio.readers.ply(filename="dummyinput.ply") +
pio.filters.outlier(method="statistical", mean_k=16, multiplier=1.0) +
pio.filters.range(limits="Classification![7:7]") +
pio.filters.normal() + pio.writers.ply(storage_mode="ascii", precision=4, filename="dummyoutput.ply",
dims="X,Y,Z,Red,Green,Blue,NormalX,NormalY,NormalZ"))
self.assertIsInstance(pipeline, pio.PipelineSpec)
self.assertEqual(len(list(pipeline.stages)), 5)
self.assertEqual(json.dumps(pipeline.spec, indent=2), dummy_pipeline)
auto_reader = pio.readers.auto(filename="dummyinput.las")
auto_writer = pio.writers.auto(filename="dummyoutput.las")
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_reader.spec)
self.assertIn("filename", auto_reader.spec)
self.assertNotIn("type", auto_writer.spec)
self.assertEqual(auto_reader.prefix, "readers")
self.assertEqual(auto_writer.prefix, "writers")