gdal_compute_sum.py 文件源码

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

项目:gdal-api 作者: roblabs 项目源码 文件源码
def computeSumWithThreshold( dataNumpyArray, threshold):

  # convert to a mesh grid
  grid = numpy.meshgrid(dataNumpyArray)

  # Logical comparison
  #  1)  compute a boolean array of values less than the threshold
  compareThreshold = numpy.less (grid , threshold)

  #  2) compare and extract # TODO Not elegant, but works.  found this at http://stackoverflow.com/a/26511354
  boolThreshold = numpy.logical_and(compareThreshold , grid)

  # Create new array
  lowPlank = numpy.extract(boolThreshold, grid)
  return numpy.sum(lowPlank)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号