Output plots part 1

Output plots part 1#

Weill, S., et al. « Coupling Water Flow and Solute Transport into a Physically-Based Surface–Subsurface Hydrological Model ». Advances in Water Resources, vol. 34, no 1, janvier 2011, p. 128‑36. DOI.org (Crossref), https://doi.org/10.1016/j.advwatres.2010.10.001.

This example shows how to use pyCATHY object to plot the most common ouputs of the hydrological model.

Estimated time to run the notebook = 5min

Here we need to import cathy_tools class that control the CATHY core files preprocessing and processing We also import cathy_plots to render the results

from pyCATHY import cathy_tools
from pyCATHY.plotters import cathy_plots as cplt
import pyvista as pv
import os
import matplotlib.pyplot as plt

if you add True to verbose, the processor log will be printed in the window shell

path2prj = "weil_exemple_outputs_plot1"  # add your local path here
simu = cathy_tools.CATHY(dirName=path2prj)
simu.run_preprocessor()
simu.run_processor(IPRT1=2,
                    DTMIN=1e-2,
                    DTMAX=1e2,
                    DELTAT=5,
                    TRAFLAG=0,
                    verbose=False
                    )
🏁 Initiate CATHY object
🍳 gfortran compilation
👟 Run preprocessor
🔄 Update parm file
🔄 Update hap.in file
🔄 Update dem_parameters file
🔄 Update dem_parameters file
🛠  Recompile src files [3s]
🍳 gfortran compilation [8s]
b''
👟 Run processor
df_sw, _ = simu.read_outputs('sw')
df_sw.head()
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 ... 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055
Time
0.00000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 ... 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
1895.11582 0.686681 0.688439 0.689260 0.689816 0.690354 0.690762 0.691186 0.691529 0.691910 0.692281 0.692698 0.693121 0.693597 0.694194 0.694924 0.695890 0.697219 0.699154 0.701742 0.708113 0.710240 0.690039 0.690454 0.692535 0.692936 0.693486 0.693991 0.694504 0.694993 0.695479 0.695949 0.696475 0.697041 0.697722 0.698518 0.699569 0.700933 0.702768 0.705330 0.709040 0.716894 0.717059 0.693336 0.694128 0.697336 0.698355 0.699530 0.700637 0.701663 0.702629 0.703622 0.704609 0.705676 0.706831 0.708163 0.709748 0.711744 0.714316 0.717814 0.722730 0.729675 0.741142 0.741958 0.696547 0.696809 0.700912 0.702613 0.704555 0.706306 0.707994 0.709648 0.711287 0.712965 0.714762 0.716771 0.719100 0.721898 0.725429 0.729910 0.735602 0.742991 0.752818 0.768090 0.768884 0.700213 0.700223 0.705341 0.707992 0.710712 0.713329 0.715849 0.718337 0.720903 ... 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
3666.91023 0.655817 0.657207 0.657718 0.658108 0.658493 0.658816 0.659167 0.659469 0.659805 0.660141 0.660514 0.660899 0.661331 0.661849 0.662468 0.663246 0.664281 0.665721 0.667496 0.672289 0.673416 0.658255 0.658917 0.660504 0.660679 0.661049 0.661392 0.661745 0.662091 0.662448 0.662803 0.663199 0.663633 0.664152 0.664765 0.665558 0.666576 0.667943 0.669838 0.672429 0.678055 0.677979 0.660469 0.661455 0.663823 0.664342 0.665115 0.665848 0.666540 0.667205 0.667891 0.668590 0.669355 0.670204 0.671187 0.672381 0.673869 0.675779 0.678311 0.681742 0.686289 0.694210 0.695049 0.662682 0.663039 0.665959 0.666833 0.668044 0.669140 0.670217 0.671313 0.672449 0.673644 0.674947 0.676416 0.678133 0.680202 0.682767 0.685992 0.690094 0.695354 0.702232 0.713315 0.714188 0.665197 0.665172 0.668728 0.670142 0.671789 0.673433 0.675069 0.676728 0.678476 ... 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
7266.91023 0.626298 0.627181 0.627431 0.627604 0.627765 0.627907 0.628082 0.628229 0.628418 0.628599 0.628833 0.629081 0.629383 0.629768 0.630255 0.630890 0.631756 0.632959 0.634299 0.638162 0.638892 0.627849 0.628339 0.629545 0.629491 0.629659 0.629821 0.630007 0.630190 0.630404 0.630632 0.630904 0.631223 0.631619 0.632116 0.632758 0.633594 0.634705 0.636205 0.638076 0.642171 0.642002 0.628964 0.629884 0.631583 0.631679 0.632113 0.632546 0.632980 0.633425 0.633911 0.634429 0.635021 0.635698 0.636498 0.637470 0.638664 0.640157 0.642032 0.644409 0.647318 0.652585 0.653190 0.630067 0.630599 0.632600 0.632933 0.633692 0.634397 0.635123 0.635894 0.636723 0.637620 0.638624 0.639760 0.641078 0.642626 0.644469 0.646707 0.649464 0.652893 0.657107 0.663861 0.664404 0.631466 0.631835 0.634278 0.635007 0.636074 0.637153 0.638266 0.639434 0.640683 ... 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
10866.91020 0.609930 0.610632 0.610809 0.610921 0.611022 0.611111 0.611229 0.611324 0.611452 0.611569 0.611729 0.611895 0.612101 0.612367 0.612711 0.613168 0.613799 0.614689 0.615580 0.618658 0.619467 0.611197 0.611591 0.612642 0.612516 0.612611 0.612698 0.612805 0.612906 0.613033 0.613171 0.613344 0.613556 0.613830 0.614189 0.614665 0.615294 0.616137 0.617280 0.618644 0.621940 0.622089 0.611976 0.612768 0.614192 0.614132 0.614418 0.614695 0.614975 0.615266 0.615592 0.615948 0.616368 0.616859 0.617456 0.618191 0.619108 0.620269 0.621749 0.623652 0.625937 0.630286 0.631040 0.612705 0.613126 0.614744 0.614829 0.615337 0.615799 0.616285 0.616816 0.617403 0.618056 0.618809 0.619676 0.620709 0.621947 0.623454 0.625311 0.627606 0.630431 0.633753 0.639104 0.639579 0.613621 0.613888 0.615838 0.616201 0.616927 0.617664 0.618447 0.619293 0.620224 ... 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0

5 rows × 7056 columns



node, node_pos = simu.find_nearest_node([5,5,-1])
node2, node_pos2 = simu.find_nearest_node([5,5,1])
print(node_pos[0])
[ 5.      5.     -1.0725]
pl = pv.Plotter(notebook=False)
cplt.show_vtk(unit="pressure",
              timeStep=1,
              path=os.path.join(simu.workdir,
                                simu.project_name,
                                'vtk'
                                ),
              style='wireframe',
              opacity=0.1,
              ax=pl,
              )
pl.add_points(node_pos[0],
              color='red'
              )
pl.add_points(node_pos2[0],
              color='red'
              )
pl.show()
plot 4 pyCATHY outputs
plot pressure
fig, ax = plt.subplots()
df_sw[node].plot(ax=ax)
df_sw[node2].plot(ax=ax)
ax.set_xlabel('time (s)')
ax.set_ylabel('saturation (-)')
plot 4 pyCATHY outputs
Text(42.722222222222214, 0.5, 'saturation (-)')
df_psi = simu.read_outputs('psi')
# df_psi.head()
fig, ax = plt.subplots()
ax.plot(df_psi.index, df_psi.iloc[:,node[0]])
ax.plot(df_psi.index, df_psi.iloc[:,node2[0]])
ax.set_xlabel('time (s)')
ax.set_ylabel('pressure head (m)')
plot 4 pyCATHY outputs
Text(22.472222222222214, 0.5, 'pressure head (m)')

Total running time of the script: (0 minutes 52.915 seconds)

Gallery generated by Sphinx-Gallery