- imod.mf6.open_cbc(cbc_path: Union[str, Path], grb_path: Union[str, Path], flowja: bool = False) Dict[str, Union[DataArray, UgridDataArray]] [source]#
Open modflow6 cell-by-cell (.cbc) file.
The data is lazily read per timestep and automatically converted into (dense) xr.DataArrays. The conversion is done via the information stored in the Binary Grid file (GRB).
flowjaargument controls whether the flow-ja-face array (if present) is returned in grid form as “as is”. “Grid from” means:
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.
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
connectivityDataArray is returned describing for every cell (n) its connected cells (m).
cbc_path (str, pathlib.Path) – Path to the cell-by-cell flows file
grb_path (str, pathlib.Path) – Path to the binary grid file
flowja (bool, default value: False) – Whether to return the flow-ja-face values “as is” (
True) or in a grid form (
cbc_content – DataArray contains float64 data of the budgets, with dimensions (“time”, “layer”, “y”, “x”).
- Return type:
Open a cbc file:
>>> import imod >>> cbc_content = imod.mf6.open_cbc("budgets.cbc", "my-model.grb")
Check the contents:
Get the drainage budget, compute a time mean for the first layer:
>>> drn_budget = cbc_content["drn] >>> mean = drn_budget.sel(layer=1).mean("time")