def read_sink_data(self):
        
        #------------------------------------------------------------
        # Notes:  Assume that source_file contains key-value pairs,
        #         starting with "n_sinks:", "nt_max" and "dt:",
        #         followed by "n_sinks" blocks of the form:
        #
        #         sink_ID: (sink pixel ID as long integer)
        #         nt:      (number of discharge (Q) values)
        #         Q:       (vector of discharges in m^3/s)
        #------------------------------------------------------------
        if (self.comp_status == 'Disabled'): return
        if not(self.use_sinks): return
    
        #---------------------------
        # Can sink_file be found ?
        #---------------------------
        FOUND = tf_utils.file_exists( self.sink_file )
        if not(FOUND):
            self.use_sinks = False
            return

        #-----------------------
        # Open the "sink_file"
        #-----------------------
        file_unit = open(self.sink_file, 'r')

        #------------------------------------------------
        # Read number of sinks, max number of timesteps
        # for any sink and the common timestep, dt
        #------------------------------------------------
        n_sinks = cfg.read_value(file_unit, dtype='Int32')
        nt_max  = cfg.read_value(file_unit, dtype='Int32')
        sink_dt = cfg.read_value(file_unit, dtype='Float64')
        self.sink_dt = sink_dt
        
        #--------------------
        # Initialize arrays
        #--------------------
        self.sink_IDs     = np.zeros([n_sinks], dtype='Int32')
        self.nt_sinks     = np.zeros([n_sinks], dtype='Int32')
        self.Q_sinks_all  = np.zeros([n_sinks, nt_max], dtype='Float64')
        self.n_sinks      = n_sinks
        self.nt_max_sinks = nt_max
        
        #---------------------------------
        # Read information for each sink
        #---------------------------------
        for k in xrange(n_sinks):
            sink_ID  = cfg.read_value(file_unit, dtype='Int32')
            nt       = cfg.read_value(file_unit, dtype='Int32')
            Q_values = cfg.read_list_after_key(file_unit, dtype='Float64')
            #---------------------------------------------------------------
            nQ        = size(Q_values)
            print 'Diversions component: Read', nQ, 'Q_values for sink.'
            #--------------------------------------------------------------- 
            self.sink_IDs[k]     = sink_ID
            self.nt_sinks[k]     = nt
            self.Q_sinks_all[k,0:nt] = Q_values

        #-----------------------
        # Close the input file
        #-----------------------
        file_unit.close()              

        #-----------------------------------
        # Compute xy coordinates for sinks
        #-----------------------------------
        sink_rows    = (self.sink_IDs / self.nx)
        sink_cols    = (self.sink_IDs % self.nx)
        self.sinks_x = (sink_cols * self.dx)
        self.sinks_y = (sink_rows * self.dy)  
    def read_source_data(self):

        #------------------------------------------------------------
        # Notes:  Assume that source_file contains key-value pairs,
        #         starting with "n_sources:", "nt_max" and "dt:",
        #         followed by "n_sources" blocks of the form:
        #
        #         source_ID: (source pixel ID as long integer)
        #         nt:        (number of discharge (Q) values)
        #         Q:         (vector of discharges in m^3/s)
        #------------------------------------------------------------
        if (self.comp_status == 'Disabled'): return
        if not (self.use_sources): return

        #-----------------------------
        # Can source_file be found ?
        #-----------------------------
        FOUND = tf_utils.file_exists(self.source_file)
        if not (FOUND):
            self.use_sources = False
            return

        #-------------------------
        # Open the "source_file"
        #-------------------------
        file_unit = open(self.source_file, 'r')

        #--------------------------------------------------
        # Read number of sources, max number of timesteps
        # for any source and the common timestep, dt
        #--------------------------------------------------
        n_sources = cfg.read_value(file_unit, dtype='Int32')
        nt_max = cfg.read_value(file_unit, dtype='Int32')
        dt = cfg.read_value(file_unit, dtype='Float64')

        ########################################################
        # (2/3/13) Get "dt" from sink_file vs. channels comp.
        ########################################################
        self.dt = dt

        #--------------------
        # Initialize arrays
        #--------------------
        self.source_IDs = np.zeros([n_sources], dtype='Int32')
        self.nt_sources = np.zeros([n_sources], dtype='Int32')
        self.Q_sources_all = np.zeros([n_sources, nt_max], dtype='Float64')
        self.n_sources = n_sources

        self.nt_max_sources = nt_max

        #-----------------------------------
        # Read information for each source
        #-----------------------------------
        for k in range(n_sources):
            source_ID = cfg.read_value(file_unit, dtype='Int32')
            nt = cfg.read_value(file_unit, dtype='Int32')
            Q_values = cfg.read_list_after_key(file_unit, dtype='Float64')
            #---------------------------------------------------------------
            nQ = np.size(Q_values)
            print('Diversions component: Read', nQ, 'Q_values for source.')
            #---------------------------------------------------------------
            self.source_IDs[k] = source_ID
            self.nt_sources[k] = nt
            self.Q_sources_all[k, 0:nt] = Q_values

        #-----------------------
        # Close the input file
        #-----------------------
        file_unit.close()
    def read_sink_data(self):

        #------------------------------------------------------------
        # Notes:  Assume that source_file contains key-value pairs,
        #         starting with "n_sinks:", "nt_max" and "dt:",
        #         followed by "n_sinks" blocks of the form:
        #
        #         sink_ID: (sink pixel ID as long integer)
        #         nt:      (number of discharge (Q) values)
        #         Q:       (vector of discharges in m^3/s)
        #------------------------------------------------------------
        if (self.comp_status == 'Disabled'): return
        if not (self.use_sinks): return

        #---------------------------
        # Can sink_file be found ?
        #---------------------------
        FOUND = tf_utils.file_exists(self.sink_file)
        if not (FOUND):
            self.use_sinks = False
            return

        #-----------------------
        # Open the "sink_file"
        #-----------------------
        file_unit = open(self.sink_file, 'r')

        #------------------------------------------------
        # Read number of sinks, max number of timesteps
        # for any sink and the common timestep, dt
        #------------------------------------------------
        n_sinks = cfg.read_value(file_unit, dtype='Int32')
        nt_max = cfg.read_value(file_unit, dtype='Int32')
        sink_dt = cfg.read_value(file_unit, dtype='Float64')
        self.sink_dt = sink_dt

        #--------------------
        # Initialize arrays
        #--------------------
        self.sink_IDs = np.zeros([n_sinks], dtype='Int32')
        self.nt_sinks = np.zeros([n_sinks], dtype='Int32')
        self.Q_sinks_all = np.zeros([n_sinks, nt_max], dtype='Float64')
        self.n_sinks = n_sinks
        self.nt_max_sinks = nt_max

        #---------------------------------
        # Read information for each sink
        #---------------------------------
        for k in xrange(n_sinks):
            sink_ID = cfg.read_value(file_unit, dtype='Int32')
            nt = cfg.read_value(file_unit, dtype='Int32')
            Q_values = cfg.read_list_after_key(file_unit, dtype='Float64')
            #---------------------------------------------------------------
            nQ = size(Q_values)
            print 'Diversions component: Read', nQ, 'Q_values for sink.'
            #---------------------------------------------------------------
            self.sink_IDs[k] = sink_ID
            self.nt_sinks[k] = nt
            self.Q_sinks_all[k, 0:nt] = Q_values

        #-----------------------
        # Close the input file
        #-----------------------
        file_unit.close()

        #-----------------------------------
        # Compute xy coordinates for sinks
        #-----------------------------------
        sink_rows = (self.sink_IDs / self.nx)
        sink_cols = (self.sink_IDs % self.nx)
        self.sinks_x = (sink_cols * self.dx)
        self.sinks_y = (sink_rows * self.dy)
    def read_source_data(self):

        #------------------------------------------------------------
        # Notes:  Assume that source_file contains key-value pairs,
        #         starting with "n_sources:", "nt_max" and "dt:",
        #         followed by "n_sources" blocks of the form:
        #
        #         source_ID: (source pixel ID as long integer)
        #         nt:        (number of discharge (Q) values)
        #         Q:         (vector of discharges in m^3/s)
        #------------------------------------------------------------
        if (self.comp_status == 'Disabled'): return
        if not(self.use_sources): return
        
        #-----------------------------
        # Can source_file be found ?
        #-----------------------------
        FOUND = tf_utils.file_exists( self.source_file )
        if not(FOUND):
            self.use_sources = False
            return

        #-------------------------
        # Open the "source_file"
        #-------------------------
        file_unit = open(self.source_file, 'r')

        #--------------------------------------------------
        # Read number of sources, max number of timesteps
        # for any source and the common timestep, dt
        #--------------------------------------------------
        n_sources = cfg.read_value(file_unit, dtype='Int32')
        nt_max    = cfg.read_value(file_unit, dtype='Int32')
        dt        = cfg.read_value(file_unit, dtype='Float64')

        ########################################################
        # (2/3/13) Get "dt" from sink_file vs. channels comp.
        ########################################################
        self.dt = dt
        
        #--------------------
        # Initialize arrays
        #--------------------
        self.source_IDs    = np.zeros([n_sources], dtype='Int32')
        self.nt_sources    = np.zeros([n_sources], dtype='Int32')
        self.Q_sources_all = np.zeros([n_sources, nt_max], dtype='Float64')
        self.n_sources     = n_sources

        self.nt_max_sources = nt_max
        
        #-----------------------------------
        # Read information for each source
        #-----------------------------------
        for k in xrange(n_sources):
            source_ID = cfg.read_value(file_unit, dtype='Int32')
            nt        = cfg.read_value(file_unit, dtype='Int32')
            Q_values  = cfg.read_list_after_key(file_unit, dtype='Float64')
            #---------------------------------------------------------------
            nQ        = np.size(Q_values)
            print 'Diversions component: Read', nQ, 'Q_values for source.'
            #---------------------------------------------------------------            
            self.source_IDs[k]     = source_ID
            self.nt_sources[k]     = nt
            self.Q_sources_all[k,0:nt] = Q_values
 
        #-----------------------
        # Close the input file
        #-----------------------
        file_unit.close()