Unsaturated Zone Module Testing

In this notebook we do some tests to validate the unsaturated zone module applied in GWTSA for non-linear time serie models. Two models have been applied,

The following tests are used:

  • Analytical solution versus the numerical solution
  • Use of a numerical model to check emptying and filling of the unsaturated zone (check model logics)
  • Random forcings to check model under different conditions
  • Comparison of the python script and the cythonized script (C-language)

In [3]:
import numpy as np
import matplotlib.pyplot as plt
import timeit
import pstats, cProfile
from GWTSA import *

In [10]:
# Provide the forcings precipitation and potential evapotransapiration
P = 10 * np.ones(100) #np.random.rand(10000)*3
E =10 * np.ones(100) #np.random.rand(10)

# Provide the model parameters for the soil module
S_cap = 0.10
K_sat = -6.0
Beta = 1.0
D = -3.0


# Provide some details for the timesteps to calculate the soil state
Time_Model = np.arange(0,100,1)
dt= 1

In [5]:
cProfile.runctx("Unsat_Zone.percolation(Time_Model, P, E, S_cap, K_sat, Beta, D, dt)", globals(), locals(), "Profile.prof", sort=-1)

s = pstats.Stats("Profile.prof")
s.strip_dirs().sort_stats("time").print_stats()


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-1a59d8d276f1> in <module>()
----> 1 cProfile.runctx("Unsat_Zone.percolation(Time_Model, P, E, S_cap, K_sat, Beta, D, dt)", globals(), locals(), "Profile.prof", sort=-1)
      2 
      3 s = pstats.Stats("Profile.prof")
      4 s.strip_dirs().sort_stats("time").print_stats()

/Applications/anaconda/lib/python2.7/cProfile.pyc in runctx(statement, globals, locals, filename, sort)
     47     try:
     48         try:
---> 49             prof = prof.runctx(statement, globals, locals)
     50         except SystemExit:
     51             pass

/Applications/anaconda/lib/python2.7/cProfile.pyc in runctx(self, cmd, globals, locals)
    138         self.enable()
    139         try:
--> 140             exec cmd in globals, locals
    141         finally:
    142             self.disable()

<string> in <module>()

NameError: name 'Unsat_Zone' is not defined

In [ ]: