imod.msw.MetaSwapModel.mask_all_packages#
- MetaSwapModel.mask_all_packages(mask: DataArray | UgridDataArray)[source]#
This function applies a mask to all packages in a model. The mask must be presented as a GridDataArray, which contains idomain-like integers. The mask is applied to all packages in the model, and the values in the mask determine which cells are active and which are inactive. The mask is applied to all packages, regardless of whether they have a subunit dimension or not.
- mask: GridDataArray
idomain-like integers. >0 sets cells to active, 0 sets cells to inactive, mask is applied on a per-subunit basis if the mask grid has a subunit dimension. If the package does not have a subunit dimension, the combined mask grid over all of its subunits is applied, i.e. a cell is set to active if it is active in any of the subunits.
- Example
>>> mask = xr.DataArray( >>> np.array( >>> [ >>> [[0, 0, 0], [0, 1, 1], [0, 0, 0]], >>> [[1, 1, 1], [0, 1, 1], [0, 0, 0]], >>> ] >>> ).astype(bool), >>> dims=("subunit", "y", "x"), >>> coords = { >>> "x" : [1.0, 2.0, 3.0], >>> "y" : [3.0, 2.0, 1.0], >>> "dx" : 1.0, >>> "dy" : 1.0, >>> "subunit" : [0, 1] >>> } >>> )