linearfilters.py 文件源码

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

项目:oocgcm 作者: lesommer 项目源码 文件源码
def boundary_weights(self, mode='reflect', drop_dims=None):
        """
        Compute the boundary weights

        Parameters
        ----------
            mode:

            drop_dims:
                Specify dimensions along which the mask is constant

        Returns
        -------
        """
        mask = self.obj.notnull()
        new_dims = copy.copy(self.obj.dims)
        new_coords = copy.copy(self.coords)
        for dim in drop_dims:
            #TODO: Make the function work
            mask = mask.isel({dim:0})
            del(new_dims[dim])
            del(new_coords[dim])
        weights = im.convolve(mask.astype(float), self.coefficients, mode=mode)
        res = xr.DataArray(weights, dims=new_dims, coords=new_coords, name='boundary weights')
        return res.where(mask == 1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号