imod.mf6.Modflow6Simulation.mask_all_models#
- Modflow6Simulation.mask_all_models(mask: DataArray | UgridDataArray, ignore_time_purge_empty: bool | None = None) None[source]#
This function applies a mask to all models in a simulation, provided they use the same discretization. The method parameter “mask” is an idomain-like array. Masking will overwrite idomain with the mask where the mask is <0. Where the mask is >0, the original value of idomain will be kept. Masking will update the packages accordingly, blanking their input where needed, and is therefore not a reversible operation.
- Parameters:
mask (xr.DataArray, xu.UgridDataArray of ints) – idomain-like integer array. >0 sets cells to active, 0 sets cells to inactive, <0 sets cells to vertical passthrough
ignore_time_purge_empty (bool, default False) – Whether to ignore the time dimension when purging empty packages. Can improve performance when masking models with many time steps. Masking models can cause package data with all nans. These packages are considered empty and need to be removed. However, checking all timesteps for each package is a costly operation. Therefore, this option can be set to True to only check the first timestep. Defaults to False.
Examples
To mask all models in a simulation, you can use the following code:
>>> mf6_sim.mask_all_models(new_idomain)
This masks the model inplace and updates the packages accordingly. The mask should be an idomain-like array, i.e. it should have the same shape as the model and contain integer values.