ECOdyagnostics/operations.py
def boundary_mask(self, da, axes, index):
        """
        Return a mask of the data array where the boundaries along an axis are set to nan.
        """
        dims = self.grid._get_dims_from_axis(da, axes)
        mask_axes = [np.ones(da.sizes[ax]) for ax in dims]
        if len(dims) > 1:
            for ax in range(len(dims)):
                for i in index[ax]:
                    mask_axes[ax][i] = np.nan
            mask_value = np.prod(np.meshgrid(*mask_axes, indexing='ij'), axis=0)

        else:
            mask_value = mask_axes[0]
            for i in index:
                mask_value[i] = np.nan

        mask = xr.DataArray(mask_value, coords={dims[i]: da[dims[i]].values for i in range(len(dims))}, dims=dims)
        return mask

        Return a mask of the data array where the boundaries along an axis are set to nan.
        
Return a mask of the data array where the boundaries along an axis are set to nan.
Return a mask of the data array where the boundaries along an axis are set to nan .
def boundary_mask(self, da, axes, index):
        dims = self.grid._get_dims_from_axis(da, axes)
        mask_axes = [np.ones(da.sizes[ax]) for ax in dims]
        if len(dims) > 1:
            for ax in range(len(dims)):
                for i in index[ax]:
                    mask_axes[ax][i] = np.nan
            mask_value = np.prod(np.meshgrid(*mask_axes, indexing='ij'), axis=0)
        else:
            mask_value = mask_axes[0]
            for i in index:
                mask_value[i] = np.nan
        mask = xr.DataArray(mask_value, coords={dims[i]: da[dims[i]].values for i in range(len(dims))}, dims=dims)
        return mask
def boundary_mask ( self , da , axes , index ) : dims = self . grid . _get_dims_from_axis ( da , axes ) mask_axes = [ np . ones ( da . sizes [ ax ] ) for ax in dims ] if len ( dims ) > 1 : for ax in range ( len ( dims ) ) : for i in index [ ax ] : mask_axes [ ax ] [ i ] = np . nan mask_value = np . prod ( np . meshgrid ( * mask_axes , indexing = 'ij' ) , axis = 0 ) else : mask_value = mask_axes [ 0 ] for i in index : mask_value [ i ] = np . nan mask = xr . DataArray ( mask_value , coords = { dims [ i ] : da [ dims [ i ] ] . values for i in range ( len ( dims ) ) } , dims = dims ) return mask
Return a mask of the data array where the boundaries along an axis are set to nan.
Return a mask of the data array where the boundaries along an axis are set to nan .
"""
        Return a mask of the data array where the boundaries along an axis are set to nan.
        """
self
da
axes
index