Note
Go to the end to download the full example code.
Output plots part 2#
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
if you add True to verbose, the processor log will be printed in the window shell
path2prj = "../SSHydro/" # add your local path here
simu = cathy_tools.CATHY(dirName=path2prj,
prj_name="weil_exemple_outputs_plot"
)
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 [7s]
b''
👟 Run processor
simu.show(prop="hgsfdet")

simu.show(prop="dtcoupling", yprop="Atmpot-d")

/home/z0272571a@CAMPUS.CSIC.ES/Nextcloud/BenCSIC/Codes/BenjMy/pycathy_wrapper/pyCATHY/importers/cathy_outputs.py:322: UserWarning: Input line 3 contained no data and will not be counted towards `max_rows=236`. This differs from the behaviour in NumPy <=1.22 which counted lines rather than rows. If desired, the previous behaviour can be achieved by using `itertools.islice`.
Please see the 1.23 release notes for an example on how to do this. If you wish to ignore this warning, use `warnings.filterwarnings`. This warning is expected to be removed in the future and is given only once per `loadtxt` call.
dtcoupling = np.loadtxt(dtcoupling_file, skiprows=2, max_rows=2 + nstep)
simu.show(prop="hgraph")

simu.show(prop="cumflowvol")

To select another time step change the value in the function argument
cplt.show_vtk(
unit="pressure",
timeStep=1,
notebook=False,
path=simu.workdir + "/weil_exemple_outputs_plot/vtk/",
)

plot pressure
- cplt.show_vtk(
unit=”saturation”, timeStep=1, notebook=False, path=simu.workdir + “/my_cathy_prj/vtk/”,
)
Total running time of the script: (0 minutes 23.141 seconds)