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_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 pipeline(self):
"""
Promote this stage to a `pdal.pio.PipelineSpec` with one `pdal.pio.StageSpec`
and return it.
"""
output = PipelineSpec()
output.add_stage(self)
return output
def __add__(self, stage_or_pipeline):
assert isinstance(stage_or_pipeline, (StageSpec, PipelineSpec)), "Expected StageSpec or PipelineSpec"
output = self.__class__(self)
if isinstance(stage_or_pipeline, StageSpec):
output.add_stage(stage_or_pipeline)
elif isinstance(stage_or_pipeline, PipelineSpec):
for stage in stage_or_pipeline.stages:
output.add_stage(stage)
return output
def __add__(self, stage_or_pipeline):
assert isinstance(stage_or_pipeline, (StageSpec, PipelineSpec)), "Expected StageSpec or PipelineSpec"
output = self.__class__(self)
if isinstance(stage_or_pipeline, StageSpec):
output.add_stage(stage_or_pipeline)
elif isinstance(stage_or_pipeline, PipelineSpec):
for stage in stage_or_pipeline.stages:
output.add_stage(stage)
return output