ProcessSrcmod.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:stress_transfer 作者: google 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号