imod.select.get_lower_active_grid_cells#

imod.select.get_lower_active_grid_cells(active: DataArray | UgridDataArray) DataArray | UgridDataArray[source]#

Returns grid of booleans designating location of the lowermost active grid cell.

Parameters:

active ({xr.DataArray, xu.UgridDataArray}) – Grid of booleans (…, layer, y, x) designating active cell.

Returns:

lower_active_grid_cells – Grid of booleans (…, layer, y, x) designating location of the lowermost active grid cell.

Return type:

{xr.DataArray, xu.UgridDataArray}

Examples

To get the lowermost active grid cells of an idomain grid:

>>> active = idomain > 0
>>> lower_active = get_lower_active_grid_cells(active)
>>> idomain_lower = idomain.where(lower_active, 0)

To get the lowermost active grid cells of data grid with floats, where np.nan indicates inactive cells:

>>> active = data.notnull()
>>> lower_active = get_lower_active_grid_cells(active)
>>> data_lower = data.where(lower_active)