xcdat.create_mask#
- xcdat.create_mask(ds, dims=None)[source]#
Create a mask as an xarray.DataArray based on the specified dimensions.
- Parameters:
ds (
xr.Dataset) – The input xarray Dataset containing the data and coordinate information.dims (
list[CFAxisKey]orNone) – A list of dimension keys to include in the mask. If not provided, defaults to None.
- Returns:
xr.DataArray– A DataArray representing the mask, with ones in the shape of the specified dimensions.
Notes
The function uses the cf accessor to retrieve the coordinate names and shapes for the specified dimensions.
Only dimensions present in the cf.axes of the dataset are included in the mask.