# Path: topoflow/utils/BMI_base.py
# def unit_test():
#     def __init__(self):
#     def get_status(self):
#     def get_attribute(self, att_name):
#     def get_grid_shape(self, long_var_name):
#     def get_grid_spacing(self, long_var_name):
#     def get_grid_origin(self, long_var_name):
#     def get_grid_attribute(self, long_var_name, att_name):
#     def read_grid_info(self):
#     def get_input_var_names(self):
#     def get_output_var_names(self):
#     def get_var_name(self, long_var_name):
#     def get_var_units(self, long_var_name):
#     def get_var_rank(self, long_var_name):
#     def get_var_type(self, long_var_name):
#     def get_var_itemsize(self, long_var_name):
#     def get_var_nbytes(self, long_var_name):
#     def get_values(self, long_var_name):
#     def set_values(self, long_var_name, value):
#     def get_values_at_indices(self, long_var_name, IDs):
#     def set_values_at_indices(self, long_var_name, IDs, values):
#     def get_time_step(self):
#     def get_time_units(self):
#     def get_start_time(self):
#     def get_current_time(self):
#     def get_end_time(self):
#     def initialize(self, cfg_file=None, mode="nondriver"):
#     def finalize(self):
#     def run_model(self, cfg_directory=None, cfg_prefix=None,
#                   n_steps=5):
#     def check_finished(self):
#     def initialize_time_vars(self, units='seconds'):
#     def update_time(self, dt=-1):
#     def print_time_and_value(self, var, var_name='Q_out',
#                              units_name='[m^3/s]',
#                              interval=2.0,
#                              PRINT_INDEX=False):
#     def get_run_time_string(self, proc_name='component',
#                             sec_digits=4, seconds=None,
#                             SILENT=None):
#     def print_run_time(self, proc_name='component',
#                        sec_digits=4, seconds=None,
#                        SILENT=None):
#     def print_final_report(self, comp_name='BMI component',
#                            mode='nondriver'):
#     def print_traceback(self, caller_name='TopoFlow'):
#     def read_path_info(self):
#     def getattr_TF(self, var_name, index):
#     def setattr_TF(self, var_name, value, index):
#     def read_config_file(self):
#     def initialize_config_vars(self):
#     def set_computed_input_vars( self):
#     def initialize_basin_vars( self ):
#     def prepend_directory(self, file_list, INPUT=True):
#     def check_directories(self):
#     def initialize_scalar(self, value=0.0, dtype='float64'):
#     def initialize_grid(self, value=0.0, dtype='float64'):
#     def initialize_var(self, var_type, value=0.0, dtype='float64'):
#     def update_var(self, var_name, value):
#     def is_scalar(self, var_name):
#     def is_vector(self, var_name):
#     def is_grid(self, var_name):
# class BMI_component:
#         COMPUTABLE = (dt_type == 'fixed') and (hasattr(self, 'n_steps'))
#                 COMPUTABLE = False  # (overrides COMPUTABLE above)
#             TIMES_UP = (self.time_index >= self.n_steps)
#             TIMES_UP = (self.time >= self.stop_time)
#             TIMES_UP = (self.dz_max < self.dz_tolerance)
#             COMMENT = (line[0] == '#')
#             COMMENT = (line[0] == '#')
#                 READ_SCALAR   = False
#                 READ_FILENAME = False
#                     SUBSCRIPT = True
#                     SUBSCRIPT = False
#                         READ_SCALAR = True
#                         READ_FILENAME = True
#                         READ_FILENAME = True
#                     SAVE_FLAG = False
#                         SAVE_FLAG = True


import numpy as np
import os
from topoflow.utils import BMI_base
    def theta_residual(self, REPORT=False):

        #------------------------------------------------------------
        #Note:  (3/18/08)  This is based on Equation 6-19 (p. 235),
        #       and Figure 6-13 (p. 237) in Dingman (2002), but
        #       uses a pressure head value of -1000000.  See also
        #       Dingman's Table 6-1 (p. 235).

        #       Recall that Lambda = (1 / b).

        #       This is called by Get_Soil_Params in GUI_infil.pro.
        #------------------------------------------------------------
        
        #---------------------------------
        # Compute "residual" theta value
        #---------------------------------
        psi_r = -np.float64(1000000)        # [cm]
        psi_r = (psi_r / np.float64(100))   # [cm -> meters]
        
        #--------------------------------------
        # Note:  Both psi's < 0, so ratio > 0
        #--------------------------------------
        theta_r = self.theta_s * (self.psi_B / psi_r) ** self.Lambda
 
        #------------------
        # Optional report
        #------------------
        if (REPORT):    
            print 'psi_B    = ', self.psi_B
            print 'theta_s  = ', self.theta_s

# Path: topoflow/utils/BMI_base.py
# def unit_test():
#     def __init__(self):
#     def get_status(self):
#     def get_attribute(self, att_name):
#     def get_grid_shape(self, long_var_name):
#     def get_grid_spacing(self, long_var_name):
#     def get_grid_origin(self, long_var_name):
#     def get_grid_attribute(self, long_var_name, att_name):
#     def read_grid_info(self):
#     def get_input_var_names(self):
#     def get_output_var_names(self):
#     def get_var_name(self, long_var_name):
#     def get_var_units(self, long_var_name):
#     def get_var_rank(self, long_var_name):
#     def get_var_type(self, long_var_name):
#     def get_var_itemsize(self, long_var_name):
#     def get_var_nbytes(self, long_var_name):
#     def get_values(self, long_var_name):
#     def set_values(self, long_var_name, value):
#     def get_values_at_indices(self, long_var_name, IDs):
#     def set_values_at_indices(self, long_var_name, IDs, values):
#     def get_time_step(self):
#     def get_time_units(self):
#     def get_start_time(self):
#     def get_current_time(self):
#     def get_end_time(self):
#     def initialize(self, cfg_file=None, mode="nondriver"):
#     def finalize(self):
#     def run_model(self, cfg_directory=None, cfg_prefix=None,
#                   n_steps=5):
#     def check_finished(self):
#     def initialize_time_vars(self, units='seconds'):
#     def update_time(self, dt=-1):
#     def print_time_and_value(self, var, var_name='Q_out',
#                              units_name='[m^3/s]',
#                              interval=2.0,
#                              PRINT_INDEX=False):
#     def get_run_time_string(self, proc_name='component',
#                             sec_digits=4, seconds=None,
#                             SILENT=None):
#     def print_run_time(self, proc_name='component',
#                        sec_digits=4, seconds=None,
#                        SILENT=None):
#     def print_final_report(self, comp_name='BMI component',
#                            mode='nondriver'):
#     def print_traceback(self, caller_name='TopoFlow'):
#     def read_path_info(self):
#     def getattr_TF(self, var_name, index):
#     def setattr_TF(self, var_name, value, index):
#     def read_config_file(self):
#     def initialize_config_vars(self):
#     def set_computed_input_vars( self):
#     def initialize_basin_vars( self ):
#     def prepend_directory(self, file_list, INPUT=True):
#     def check_directories(self):
#     def initialize_scalar(self, value=0.0, dtype='float64'):
#     def initialize_grid(self, value=0.0, dtype='float64'):
#     def initialize_var(self, var_type, value=0.0, dtype='float64'):
#     def update_var(self, var_name, value):
#     def is_scalar(self, var_name):
#     def is_vector(self, var_name):
#     def is_grid(self, var_name):
# class BMI_component:
#         COMPUTABLE = (dt_type == 'fixed') and (hasattr(self, 'n_steps'))
#                 COMPUTABLE = False  # (overrides COMPUTABLE above)
#             TIMES_UP = (self.time_index >= self.n_steps)
#             TIMES_UP = (self.time >= self.stop_time)
#             TIMES_UP = (self.dz_max < self.dz_tolerance)
#             COMMENT = (line[0] == '#')
#             COMMENT = (line[0] == '#')
#                 READ_SCALAR   = False
#                 READ_FILENAME = False
#                     SUBSCRIPT = True
#                     SUBSCRIPT = False
#                         READ_SCALAR = True
#                         READ_FILENAME = True
#                         READ_FILENAME = True
#                     SAVE_FLAG = False
#                         SAVE_FLAG = True


# Path: topoflow/components/soil_base.py
import numpy as np
import os
from topoflow.utils import BMI_base

    def theta_residual(self, REPORT=False):

        #------------------------------------------------------------
        #Note:  (3/18/08)  This is based on Equation 6-19 (p. 235),
        #       and Figure 6-13 (p. 237) in Dingman (2002), but
        #       uses a pressure head value of -1000000.  See also
        #       Dingman's Table 6-1 (p. 235).

        #       Recall that Lambda = (1 / b).

        #       This is called by Get_Soil_Params in GUI_infil.pro.
        #------------------------------------------------------------
        
        #---------------------------------
        # Compute "residual" theta value
        #---------------------------------
        psi_r = -np.float64(1000000)        # [cm]
        psi_r = (psi_r / np.float64(100))   # [cm -> meters]
        
        #--------------------------------------
        # Note:  Both psi's < 0, so ratio > 0
        #--------------------------------------
        theta_r = self.theta_s * (self.psi_B / psi_r) ** self.Lambda
 
        #------------------
        # Optional report
        #------------------
        if (REPORT):    
            print 'psi_B    = ', self.psi_B
            print 'theta_s  = ', self.theta_s

            print 'theta_r  = ', self.theta_r