imod.mf6.Modflow6Simulation.clip_box#
- Modflow6Simulation.clip_box(time_min: datetime | datetime64 | str | None = None, time_max: datetime | datetime64 | str | None = None, layer_min: int | None = None, layer_max: int | None = None, x_min: float | None = None, x_max: float | None = None, y_min: float | None = None, y_max: float | None = None, states_for_boundary: dict[str, DataArray | UgridDataArray] | None = None, ignore_time_purge_empty: bool | None = None) Modflow6Simulation[source]#
Clip a simulation by a bounding box (time, layer, y, x).
- Parameters:
time_min (optional, np.datetime64) – Start time to select. Data will be forward filled to this date. If time_min is before the start time of the dataset, data is backfilled.
time_max (optional) – End time to select.
layer_min (optional, int) – Minimum layer to select.
layer_max (optional, int) – Maximum layer to select.
x_min (optional, float) – Minimum x-coordinate to select.
x_max (optional, float) – Maximum x-coordinate to select.
y_min (optional, float) – Minimum y-coordinate to select.
y_max (optional, float) – Maximum y-coordinate to select.
states_for_boundary (optional, Dict[str, Union[xr.DataArray, xu.UgridDataArray]]) – A dictionary with model names as keys and grids with states that are used to put as boundary values.
imod.mf6.GroundwaterFlowModelwill get aimod.mf6.ConstantHead,imod.mf6.GroundwaterTransportModelwill get aimod.mf6.ConstantConcentrationpackage.ignore_time_purge_empty (optional, bool, default None) – Whether to ignore the time dimension when purging empty packages. Can improve performance when clipping models with many time steps. Clipping 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. If None, the value of the validation settings of the simulation are used.
- Returns:
clipped
- Return type:
Simulation
Examples
Slicing intervals may be half-bounded, by providing None:
To select 500.0 <= x <= 1000.0:
>>> mf6_sim.clip_box(x_min=500.0, x_max=1000.0)
To select x <= 1000.0:
>>> mf6_sim.clip_box(x_max=1000.0)``
To select x >= 500.0:
>>> mf6_sim.clip_box(x_min=500.0)
To select a time interval, you can use datetime64:
>>> mf6_sim.clip_box(time_min=np.datetime64("2020-01-01"), time_max=np.datetime64("2020-12-31"))
To clip an area and set a boundary condition at the clipped boundary:
>>> states_for_boundary = {"GWF6_model_name": heads} >>> clipped_sim = mf6_sim.clip_box( ... x_min=500.0, x_max=1000.0, y_min=500.0, y_max=1000.0, ... states_for_boundary=states_for_boundary ... )