Create soil zones control

Create soil zones control#

Estimated time to run the notebook = 5min

# !! run preprocessor change the DEM shape !
# dtm_13 does not have the same shape anymore!

import os

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

import pyCATHY.meshtools as mt
from pyCATHY import cathy_tools
from pyCATHY.importers import cathy_inputs as in_CT
from pyCATHY.importers import cathy_outputs as out_CT
from pyCATHY.plotters import cathy_plots as cplt

path2prj = "../SSHydro/"  # add your local path here
simu = cathy_tools.CATHY(dirName=path2prj,
                         prj_name="soil_withzones",
                         clear_src=False
                         )

rootpath = os.path.join(simu.workdir + simu.project_name)
simu.run_preprocessor(verbose=False)
simu.run_processor(IPRT1=3,verbose=True)
🏁 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 [10s]
🍳 gfortran compilation [19s]
❌ Linker error:
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status

👟 Run processor
b''
simu.DEM
zones = np.ones(np.shape(simu.DEM))
zones[:,0:2] = 2
zones[:,2:4] = 3
zones[:,4:6] = 4

simu.update_zone(zones)


fig, ax = plt.subplots()
simu.show_input('zone',ax=ax)
🔄 update zone file
🔄 Update dem_parameters file
🔄 Update parm file
df_SPP_map = simu.init_soil_SPP_map_df(nzones=4,nstr=15)
df_SPP_map = simu.set_SOIL_defaults(SPP_map_default=True)
simu.update_soil(SPP_map=df_SPP_map)

print(df_SPP_map.head())
🔄 Update soil
homogeneous soil
             PERMX     PERMY     PERMZ  ... VGNCELL VGRMCCELL VGPSATCELL
zone str                                ...
1    1    0.000188  0.000188  0.000188  ...    1.46      0.15    0.03125
     2    0.000188  0.000188  0.000188  ...    1.46      0.15    0.03125
     3    0.000188  0.000188  0.000188  ...    1.46      0.15    0.03125
     4    0.000188  0.000188  0.000188  ...    1.46      0.15    0.03125
     5    0.000188  0.000188  0.000188  ...    1.46      0.15    0.03125

[5 rows x 8 columns]

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

Gallery generated by Sphinx-Gallery