.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/visualize/flowvel_streamlines.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_visualize_flowvel_streamlines.py: Flow velocities and streamlines =============================== In this section we will plot flow velocities and streamlines for some model results. .. GENERATED FROM PYTHON SOURCE LINES 8-13 .. code-block:: default import matplotlib.pyplot as plt import numpy as np import xarray as xr .. GENERATED FROM PYTHON SOURCE LINES 14-15 We'll start with the usual imports .. GENERATED FROM PYTHON SOURCE LINES 15-18 .. code-block:: default import imod .. GENERATED FROM PYTHON SOURCE LINES 20-21 Load and unpack the data .. GENERATED FROM PYTHON SOURCE LINES 21-31 .. code-block:: default ds_fluxes = imod.data.fluxes() ds_fluxes = ds_fluxes.isel(time=-1) ds_fluxes lower = ds_fluxes["bdgflf"] right = ds_fluxes["bdgfrf"] front = ds_fluxes["bdgfff"] heads = ds_fluxes["head"] .. GENERATED FROM PYTHON SOURCE LINES 32-39 Calculating flow velocity ------------------------- The imod-python function imod.evaluate.flow_velocity() computes flow velocities in m/d based on the budget results (bdgflf - flow lower face, bdgfrf - flow right face and bdgfff - flow front face). To apply this function, we first need to define a top_bot array. .. GENERATED FROM PYTHON SOURCE LINES 39-45 .. code-block:: default top_bot = xr.full_like(lower, 1.0) top_bot["top"] = top_bot["z"] - 0.5 * top_bot["dz"] top_bot["bot"] = top_bot["z"] + 0.5 * top_bot["dz"] top_bot .. raw:: html
```<xarray.DataArray 'bdgflf' (layer: 49, y: 218, x: 248)>
array([[[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.]],

[[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.]],

[[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
...
...,
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.]],

[[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.]],

[[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
...,
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.],
[1., 1., 1., ..., 1., 1., 1.]]], dtype=float32)
Coordinates:
* x        (x) float64 9.095e+04 9.105e+04 9.115e+04 ... 1.156e+05 1.156e+05
* y        (y) float64 4.676e+05 4.674e+05 4.674e+05 ... 4.46e+05 4.458e+05
dx       float64 100.0
dy       float64 -100.0
time     datetime64[ns] 1979-12-31
* layer    (layer) int32 1 2 3 4 5 6 7 8 9 10 ... 41 42 43 44 45 46 47 48 49
dz       (layer) float64 -2.0 -2.0 -2.0 -2.0 ... -10.0 -10.0 -10.0 -10.0
z        (layer) float64 9.0 7.0 5.0 3.0 1.0 ... -215.0 -225.0 -235.0 -245.0
top      (layer) float64 10.0 8.0 6.0 4.0 ... -210.0 -220.0 -230.0 -240.0
bot      (layer) float64 8.0 6.0 4.0 2.0 0.0 ... -220.0 -230.0 -240.0 -250.0```