regrid_mask#
- echopype.mask.regrid_mask(mask_da: DataArray, range_da: DataArray, range_bin: str = '20m', ping_time_bin: str = '20s', third_dim: str = None, func: Literal['logical-AND', 'logical-OR'] = 'logical-AND', method: str = 'map-reduce', reindex: bool = False, closed: Literal['left', 'right'] = 'left', range_var_max: str = None, **flox_kwargs) DataArray#
Regrid mask through downsampling via a logical AND operation.
- Parameters:
- mask_daxr.DataArray
Mask DataArray. Must be binary 0/1 or True/False. Must have two dimensions: ‘depth’ and ‘ping_time’.
- range_binstr, default ‘20m’
bin size along ‘range_sample’ or ‘depth’ in meters.
- ping_time_binstr, default ’20s’
bin size along ‘ping_time’
- third_dimstr, default None
Name for non-binned region. If None, use ‘xarray_reduce’ to operate on 2D array. Else, use ‘xarray_reduce’ to operate on 3D array with unbinned 3rd dimension.
- func: {‘logical-AND’, ‘logical-OR’}, default ‘logical-AND’
When func == ‘logical-AND’, the output value is set to 1 or
Trueonly if all values in the regrid bin are 1 orTrue. When func == ‘logical-OR’, the output value is set to 1 orTrueif any value in the regrid bin is 1 orTrue.- method: str, default ‘map-reduce’
The flox strategy for reduction of dask arrays only. See flox documentation for more details.
- reindex: bool, default False
If False, reindex after the blockwise stage. If True, reindex at the blockwise stage. Generally, reindex=False results in less memory usage at the cost of computation speed. Can only be used when method=’map-reduce’. See flox documentation for more details.
- closed: {‘left’, ‘right’}, default ‘left’
Which side of bin interval is closed.
- range_var_max: str, default None
Maximum value of the range variable. If this value is known, it is recommended to provide it as an input as it makes the underlying computation more efficient (by skipping a max computation and keeping the data lazily-loaded).
- **flox_kwargs
Additional keyword arguments to be passed to flox reduction function.
- Returns:
- A DataArray containing a regridded mask.