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
Traceback (most recent call last):
  File "/home/runner/work/pycathy_wrapper/pycathy_wrapper/examples/SSHydro/plot_3a_create_soil_withzones.py", line 20, in <module>
    import pyCATHY.meshtools as mt
  File "/home/runner/work/pycathy_wrapper/pycathy_wrapper/pyCATHY/__init__.py", line 4, in <module>
    from . import cathy_utils, meshtools, sensitivity
  File "/home/runner/work/pycathy_wrapper/pycathy_wrapper/pyCATHY/meshtools.py", line 1317, in <module>
    from sklearn.metrics import r2_score
ModuleNotFoundError: No module named 'sklearn'

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)
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)
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())

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

Gallery generated by Sphinx-Gallery