imod.msw.MetaSwapModel.clip_box#

MetaSwapModel.clip_box(time_min: datetime | datetime64 | str | None = None, time_max: datetime | datetime64 | str | None = None, x_min: float | None = None, x_max: float | None = None, y_min: float | None = None, y_max: float | None = None) MetaSwapModel[source]#

Clip a model by a bounding box (time, y, x). If a package of type imod.msw.MeteoGridCopy is present, packages of type imod.msw.PrecipitationMapping and imod.msw.EvapotranspirationMapping will not be clipped. Otherwise incorrect mappings to meteo grids referenced in mete_grid.inp copied by imod.msw.MeteoGridCopy would be computed.

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.

  • 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.

Returns:

clipped – A new model that is clipped to the specified bounding box.

Return type:

MetaSwapModel

Examples

Slicing intervals may be half-bounded, by providing None:

To select 500.0 <= x <= 1000.0:

>>> msw_model.clip_box(x_min=500.0, x_max=1000.0)

To select x <= 1000.0:

>>> msw_model.clip_box(x_max=1000.0)``

To select x >= 500.0:

>>> msw_model.clip_box(x_min=500.0)

To select a time interval, you can use datetime64:

>>> msw_model.clip_box(time_min=np.datetime64("2020-01-01"), time_max=np.datetime64("2020-12-31"))