grid.py 文件源码

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

项目:pysheds 作者: mdbartos 项目源码 文件源码
def bbox_indices(self, bbox, shape, precision=7):
        """
        Return row and column coordinates of a bounding box at a
        given cellsize.

        Parameters
        ----------
        bbox : tuple of floats or ints (length 4)
               bbox of new data.
        shape : tuple of ints (length 2)
                The shape of the 2D array (rows, columns).
        precision : int
                    Precision to use when matching geographic coordinates.
        """
        rows = np.around(np.linspace(bbox[1], bbox[3],
               shape[0], endpoint=False)[::-1], precision)
        cols = np.around(np.linspace(bbox[0], bbox[2],
               shape[1], endpoint=False), precision)
        return rows, cols
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号