@@ -344,7 +344,7 @@ def test_logging_filters_python(self, filename):
344344 reason = "filters.python PDAL plugin is not available" ,
345345 )
346346 def test_filters_python (self ):
347- r = pdal .Reader ("test/data/ autzen-utm.las" )
347+ r = pdal .Reader (os . path . join ( DATADIRECTORY , " autzen-utm.las") )
348348 f = pdal .Filter .python (script = __file__ , function = "a_filter" , module = "anything" )
349349 count = (r | f ).execute ()
350350 assert count == 1065
@@ -364,14 +364,14 @@ def test_only_readers(self):
364364 np .testing .assert_array_equal (np .concatenate ([array1 , array1 ]), array2 )
365365
366366 def test_quickinfo (self ):
367- r = pdal .Reader ("test/data/ autzen-utm.las" )
367+ r = pdal .Reader (os . path . join ( DATADIRECTORY , " autzen-utm.las") )
368368 p = r .pipeline ()
369369 info = p .quickinfo
370370 assert 'readers.las' in info .keys ()
371371 assert info ['readers.las' ]['num_points' ] == 1065
372372
373373 def test_jsonkwarg (self ):
374- pipeline = pdal .Reader ("test/data/ autzen-utm.las" ).pipeline ().toJSON ()
374+ pipeline = pdal .Reader (os . path . join ( DATADIRECTORY , " autzen-utm.las") ).pipeline ().toJSON ()
375375 r = pdal .Pipeline (json = pipeline )
376376 p = r .pipeline
377377 assert 'readers.las' in p
@@ -487,6 +487,45 @@ def test_meshio(self, filename):
487487 assert len (triangles ) == 134
488488 assert triangles [0 ][0 ] == 29
489489
490+ class TestDataFrame :
491+
492+ @pytest .mark .skipif (
493+ not pdal .pipeline .DataFrame ,
494+ reason = "pandas is not available" ,
495+ )
496+ def test_fetch (self ):
497+ r = pdal .Reader (os .path .join (DATADIRECTORY ,"autzen-utm.las" ))
498+ p = r .pipeline ()
499+ p .execute ()
500+ df = p .get_dataframe (0 )
501+ assert df .size == 17040
502+
503+ def test_load (self ):
504+ r = pdal .Reader (os .path .join (DATADIRECTORY ,"autzen-utm.las" ))
505+ p = r .pipeline ()
506+ p .execute ()
507+ data = p .arrays [0 ]
508+ df = pdal .pipeline .DataFrame
509+ dataframes = [df (data ), df (data ), df (data )]
510+ filter_intensity = """{
511+ "pipeline":[
512+ {
513+ "type":"filters.range",
514+ "limits":"Intensity[100:300)"
515+ }
516+ ]
517+ }"""
518+ p = pdal .Pipeline (filter_intensity , dataframes = dataframes )
519+ p .execute ()
520+ arrays = p .arrays
521+ assert len (arrays ) == 3
522+
523+ # We copied the array three times. Sum the Intensity values
524+ # post filtering to see if we had our intended effect
525+ for data in arrays :
526+ assert len (data ) == 387
527+ assert data ["Intensity" ].sum () == 57684
528+
490529
491530class TestPipelineIterator :
492531 @pytest .mark .parametrize ("filename" , ["sort.json" , "sort.py" ])
0 commit comments