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)
评论列表
文章目录