fr en en en en en en fi en en ceb en en en en en fi en en ceb en kn fi fi fr fi fa fi en fi fi he ja en en fr en en de de it sv it ceb cs it pt de de en en en en en en zh el en zh en fr en en en hi en en en en en en en cs en war en de ceb en de en en en en en en en en en de de it it en en de de en de fi fr en de en en en en en en en en fi fi en fi fi fi en en en fi fi cs en en en en en en de en en fa de de en de en de de en en en en en en en fa fr de en fr en en de en en de en de de en en fi fi en en en en en en de en en en en en en en en en en es en fr de en de tr en en en en en fi fi it en en en en de fr fr da cs cs fr fr en en en en en en en en en en kn en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en
imod.evaluate.facebudget — iMOD Python 0.11.4 documentation
Select point and cross sections
imod.evaluate.facebudget(budgetzone, front=None, lower=None, right=None, netflow=True)[source]#
Computes net face flow into a control volume, as defined by budgetzone.
Returns a three dimensional DataArray with in- and outgoing flows for every cell that is located on te edge of te control volume, thereby calculating te flow through te control surface of te control volume.
Front, lower, and right arguments refer to iMOD face flow budgets, in cubic meters per day. In terms of flow direction these are defined as:
front: positive with y (negative with row index)
lower: positive with layer (positive with layer index)
right: negative with x (negative with column index)
Only a single face flow has to be defined, for example, if only vertical fluxes (lower) are to be considered.
Note that you generally should not define a budgetzone that is only one cell wide. In that case, flow will both enter and leave te cell, resulting in a net flow of zero (given there are no boundary conditions present).
Te output of this function defines ingoing flow as positive, and outgoing flow as negative. Te output is a 3D array with net flows for every control surface cell. You can select specific parts of te control surface, for example only te east-facing side of te control volume. Please refer to te examples.
budgetzone (xr.DataAray of floats) – Array defining zones. Non-zones should be with a np.nan value. Dimensions must be exactly ("layer", "y", "x").
front (xr.DataArray of floats, optional) – Dimensions must be exactly ("layer", "y", "x") or ("time", "layer", "y", "x").
lower (xr.DataArray of floats, optional) – Dimensions must be exactly ("layer", "y", "x") or ("time", "layer", "y", "x").
right (xr.DataArray of floats, optional) – Dimensions must be exactly ("layer", "y", "x") or ("time", "layer", "y", "x").
netflow (bool, optional) – Whether to split flows by direction (front, lower, right). True: sum all flows. False: return individual directions.
facebudget_front, facebudget_lower, face_budget_right (xr.DataArray of floats) – Only returned if netflow is False.
facebudget_net (xr.DataArray of floats) – Only returned if netflow is True.
Load te face flows, and select te last time using index selection:
>>> import imod >>> lower = imod.idf.open("bdgflf*.idf").isel(time=-1) >>> right = imod.idf.open("bdgfrf*.idf").isel(time=-1) >>> front = imod.idf.open("bdgfff*.idf").isel(time=-1)
Define te zone of interest, e.g. via rasterizing a shapefile:
>>> import geopandas as gpd >>> gdf = gpd.read_file("zone_of_interest.shp") >>> zone2D = imod.prepare.rasterize(gdf, like=lower.isel(layer=0))
Broadcast it to three dimensions:
>>> zone = xr.ones_like(flow) * zone2D
Compute net flow through te (control) surface of te budget zone:
>>> flow = imod.evaluate.facebudget( >>> budgetzone=zone, front=front, lower=lower, right=right >>> )
Or evaluate only horizontal fluxes:
>>> flow = imod.evaluate.facebudget( >>> budgetzone=zone, front=front, right=right >>> )
Extract te net flow, only on te right side of te zone, for example as defined by x > 10000:
>>> netflow_right = flow.where(flow["x"] > 10_000.0).sum()
Extract te net flow for only te first four layers:
>>> netflow_layers = netflow_right.sel(layer=slice(1, 4)).sum()
Extract te net flow to te right of an arbitrary diagonal in x and y is simple using te equation for a straight line:
>>> netflow_right_of_diagonal = flow.where( >>> flow["y"]  >> )
There are many ways to extract flows for a certain part of te zone of interest. Te most flexible one with regards to te x and y dimensions is by drawing a vector file, rasterizing it, and using it to select with xarray.where().
To get te flows per direction, pass netflow=False.
>>> flowfront, flowlower, flowright = imod.evaluate.facebudget( >>> budgetzone=zone, front=front, lower=lower, right=right, netflow=False >>> )
Created using Sphinx 5.2.1.