Skip to content

Commit

Permalink
Some small edits, tweaks to testing suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
brycefrank committed Oct 20, 2019
1 parent ea58cfa commit dc6a41e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pyfor/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def from_pdal(cls, ins):
df = df.rename(
columns={"X": "x", "Y": "y", "Z": "z", "ReturnNumber": "return_num"}
)
cloud_data = pyfor.cloud.CloudData(df, header=None)
cloud_data = CloudData(df, header=None)
return cls(cloud_data)

def _get_las_points(self, las):
Expand Down Expand Up @@ -414,7 +414,7 @@ def chm(self, cell_size, interp_method=None, pit_filter=None, kernel_size=3):
def standard_metrics(self, heightbreak=0):
from pyfor.metrics import standard_metrics_cloud

return standard_metrics_cloud(self.data.points)
return standard_metrics_cloud(self.data.points, heightbreak)

@property
def convex_hull(self):
Expand Down
1 change: 0 additions & 1 deletion pyfor/rasterizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def force_extent(self, bbox):
self.array = self.array[:bot_diff, :]

# Handle the affine transformation
# new_affine = from_origin(old_left + ((-left_diff) * self.grid.cell_size), old_top - (top_diff * self.grid.cell_size), self.grid.cell_size, self.grid.cell_size)
new_affine = from_origin(
new_left, new_top, self.grid.cell_size, self.grid.cell_size
)
Expand Down
16 changes: 3 additions & 13 deletions pyfortest/test_pyfor.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ def test_update(self):
self.test_grid.cloud.data.points = self.test_grid.cloud.data.points.iloc[1:50]
self.test_grid._update()
post = self.test_grid.m
self.assertEqual(pre, 200)
self.assertEqual(post, 1)


class GridMetricsTestCase(unittest.TestCase):
Expand Down Expand Up @@ -271,6 +273,7 @@ def test_total_returns(self):

def test_standard_metrics(self):
metrics_dict = metrics.standard_metrics_grid(self.test_grid, 2)
self.assertEqual(len(metrics_dict), 25)


class CloudMetrcsTestCase(unittest.TestCase):
Expand Down Expand Up @@ -391,19 +394,6 @@ def test_array_to_raster_writes(self):
self.assertTrue(os.path.exists(os.path.join(data_dir, "temp_raster_array.tif")))
os.remove(os.path.join(data_dir, "temp_raster_array.tif"))

def test_raster_output_transform(self):
"""
Tests if the written raster output was rotated and transformed correctly.
:return:
"""
pass

def test_array_to_polygon(self):
array = np.random.randint(1, 5, size=(99, 99)).astype(np.int32)
gisexport.array_to_polygons(array, self.test_raster._affine)
gisexport.array_to_polygons(array)


class VoxelGridTestCase(unittest.TestCase):
def setUp(self):
self.test_voxel_grid = voxelizer.VoxelGrid(cloud.Cloud(test_las), cell_size=2)
Expand Down

0 comments on commit dc6a41e

Please sign in to comment.