def CalcBufferGridPoints(x_buffer, y_buffer, polygon_buffer, spacing_grid):
"""Finds the grid points for our buffer around the fault."""
x_fill_vec = np.arange(np.min(x_buffer), np.max(x_buffer), spacing_grid)
y_fill_vec = np.arange(np.min(y_buffer), np.max(y_buffer), spacing_grid)
x_buffer_fill_grid, y_buffer_fill_grid = np.meshgrid(x_fill_vec, y_fill_vec)
# Select only those grid points inside of buffered region.
x_buffer_fill_grid = x_buffer_fill_grid.flatten()
y_buffer_fill_grid = y_buffer_fill_grid.flatten()
indices_to_delete = []
for i in range(len(x_buffer_fill_grid)):
candidate = Point(x_buffer_fill_grid[i], y_buffer_fill_grid[i])
if not polygon_buffer.contains(candidate):
indices_to_delete.append(i)
x_buffer_fill_grid = np.delete(x_buffer_fill_grid, indices_to_delete)
y_buffer_fill_grid = np.delete(y_buffer_fill_grid, indices_to_delete)
return (x_buffer_fill_grid, y_buffer_fill_grid)
评论列表
文章目录