<jupyter_start><jupyter_text>Demonstration of `flopy.utils.get_transmissivities` methodfor computing open interval transmissivities (for weighted averages of heads or fluxes)In practice this method might be used to:  * compute vertically-averaged head target values representative of observation wells of varying open intervals (including variability in saturated thickness due to the position of the water table)* apportion boundary fluxes (e.g. from an analytic element model) among model layers based on transmissivity.* any other analysis where a distribution of transmissivity by layer is needed for a specified vertical interval of the model.<jupyter_code>import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# run installed version of flopy or add local path
try:
    import flopy
except:
    fpth = os.path.abspath(os.path.join('..', '..'))
    sys.path.append(fpth)
    import flopy

print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('matplotlib version: {}'.format(mpl.__version__))
print('flopy version: {}'.format(flopy.__version__))<jupyter_output>flopy is installed in /Users/jdhughes/Documents/Development/flopy_git/flopy_us/flopy
3.7.3 (default, Mar 27 2019, 16:54:48) 
[Clang 4.0.1 (tags/RELEASE_401/final)]
numpy version: 1.16.2
matplotlib version: 3.0.3
flopy version: 3.2.12<jupyter_text>Make up some open interval tops and bottoms and some heads* (these could be lists of observation well screen tops and bottoms)* the heads array contains the simulated head in each model layer,  at the location of each observation well (for example, what you would get back from HYDMOD if you had an entry for each layer at the location of each head target).* make up a model grid with uniform horizontal k of 2.<jupyter_code>sctop = [-.25, .5, 1.7, 1.5, 3., 2.5] # screen tops
scbot = [-1., -.5, 1.2, 0.5, 1.5, -.2] # screen bottoms
# head in each layer, for 6 head target locations
heads = np.array([[1., 2.0, 2.05, 3., 4., 2.5],
                  [1.1, 2.1, 2.2, 2., 3.5, 3.],
                  [1.2, 2.3, 2.4, 0.6, 3.4, 3.2]
        ])
nl, nr = heads.shape
nc = nr
botm = np.ones((nl, nr, nc), dtype=float)
top = np.ones((nr, nc), dtype=float) * 2.1
hk = np.ones((nl, nr, nc), dtype=float) * 2.
for i in range(nl):
    botm[nl-i-1, :, :] = i
botm<jupyter_output><empty_output><jupyter_text>Make a flopy modflow model<jupyter_code>m = flopy.modflow.Modflow('junk', version='mfnwt', model_ws='data')
dis = flopy.modflow.ModflowDis(m, nlay=nl, nrow=nr, ncol=nc, botm=botm, top=top)
upw = flopy.modflow.ModflowUpw(m, hk=hk)<jupyter_output><empty_output><jupyter_text>Get transmissivities along the diagonal cells* alternatively, if a model's coordinate information has been set up, the real-world x and y coordinates could be supplied with the `x` and `y` arguments* if `sctop` and `scbot` arguments are given, the transmissivites are computed for the open intervals only  (cells that are partially within the open interval have reduced thickness, cells outside of the open interval have transmissivities of 0). If no `sctop` or `scbot` arguments are supplied, trasmissivites reflect the full saturated thickness in each column of cells (see plot below, which shows different open intervals relative to the model layering)<jupyter_code>r, c = np.arange(nr), np.arange(nc)
T = flopy.utils.get_transmissivities(heads, m, r=r, c=c, sctop=sctop, scbot=scbot)
np.round(T, 2)
m.dis.botm.array[:, r, c]<jupyter_output><empty_output><jupyter_text>Plot the model top and layer bottoms (colors)open intervals are shown as boxes* well 0 has zero transmissivities for each layer, as it is below the model bottom* well 1 has T values of 0 for layers 1 and 2, and 1 for layer 3 (K=2 x 0.5 thickness)<jupyter_code>fig, ax = plt.subplots()
plt.plot(m.dis.top.array[r, c], label='model top')
for i, l in enumerate(m.dis.botm.array[:, r, c]):
    label = 'layer {} bot'.format(i+1)
    if i == m.nlay -1:
        label = 'model bot'
    plt.plot(l, label=label)
plt.plot(heads[0], label='piezometric surface', color='b', linestyle=':')
for iw in range(len(sctop)):
    ax.fill_between([iw-.25, iw+.25], scbot[iw], sctop[iw], 
                    facecolor='None', edgecolor='k')
ax.legend(loc=2)<jupyter_output><empty_output><jupyter_text>example of transmissivites without `sctop` and `scbot`* well zero has T=0 in layer 1 because it is dry; T=0.2 in layer 2 because the sat. thickness there is only 0.1<jupyter_code>T = flopy.utils.get_transmissivities(heads, m, r=r, c=c)
np.round(T, 2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.118173875054609, 'fraction_numerical': 0.025557011795543906, 'mean_word_length': 4.536880290205563, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '10006', 'license': 'CC0-1.0', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1528, 'n_words': 550, 'path': 'examples/Notebooks/flopy3_get_transmissivities_example.ipynb', 'repo_name': 'briochh/flopy', 'size': '4578'}