imod.mf6.Modflow6Simulation.open_flow_budget#

Modflow6Simulation.open_flow_budget(flowja: bool = False, simulation_start_time: Optional[datetime64] = None, time_unit: Optional[str] = 'd') Union[DataArray, UgridDataArray, Dataset, UgridDataset][source]#

Open flow budgets of finished simulation, requires that the run method has been called.

The data is lazily read per timestep and automatically converted into (dense) xr.DataArrays or xu.UgridDataArrays, for DIS and DISV respectively. The conversion is done via the information stored in the Binary Grid file (GRB).

The flowja argument controls whether the flow-ja-face array (if present) is returned in grid form as “as is”. By default flowja=False and the array is returned in “grid form”, meaning:

  • DIS: in right, front, and lower face flow. All flows are placed in the cell.

  • DISV: in horizontal and lower face flow.the horizontal flows are placed on the edges and the lower face flow is placed on the faces.

When flowja=True, the flow-ja-face array is returned as it is found in the CBC file, with a flow for every cell to cell connection. Additionally, a connectivity DataArray is returned describing for every cell (n) its connected cells (m).

Parameters

flowja (bool, default value: False) – Whether to return the flow-ja-face values “as is” (True) or in a grid form (False).

Returns

budget – DataArray contains float64 data of the budgets, with dimensions (“time”, “layer”, “y”, “x”).

Return type

Dict[str, xr.DataArray|xu.UgridDataArray]

Examples

Make sure you write and run your model first

>>> simulation.write(path/to/model)
>>> simulation.run()

Then open budgets:

>>> budget = simulation.open_flow_budget()

Check the contents:

>>> print(budget.keys())

Get the drainage budget, compute a time mean for the first layer:

>>> drn_budget = budget["drn]
>>> mean = drn_budget.sel(layer=1).mean("time")