def estimate(self, spec_py=None, spec_var=None, spec_file=None):
        t1 = time()
        if spec_py is not None:
            reload(spec_py)
            spec_var = spec_py.specification
        if spec_var is not None:
            self.specification, variables, coefficents, equations, submodels = \
                self.load_specification_from_variable(spec_var)
        elif spec_file is not None:
            self.specification = EquationSpecification(in_storage=self.storage)
            self.specification.load(in_table_name=spec_file)

        self.specification.set_dataset_name_of_variables("land_cover")

        self.model_name = "land_cover_change_model"
        choices = range(1, 15)
        lccm = LandCoverChangeModel(choices, submodel_string="lct")

        ## 4. select (uncomment) from one the following choices of subsetted sampling files (agents_index)
        #        agents_index = where(self.lc1.get_attribute("sall_91_95_0"))[0]
        #        agents_index = where(self.lc1.get_attribute("sall_95_99_0"))[0]
        agents_index = where(self.lc1.get_attribute("sall_99_02_0"))[0]
        #        agents_index = where(self.lc1.get_attribute("suburb91_95sample0"))[0]
        #        agents_index = where(self.lc1.get_attribute("suburb95_99sample0"))[0]
        #        agents_index = where(self.lc1.get_attribute("up91x95_old_samp0"))[0]
        #        agents_index = where(self.lc1.get_attribute("urbsamp95_99_0"))[0]

        ## need to include agents_index_all seperate for the calibration portion
        ##    when using the dataset at the full extent, agents_index_all is needed as it is
        ##    created from the lc1_all agents_set and matches the size of the input data

        ## 5. select (uncomment) from one the following choices of sampling files (agents_index) at full spatial extent
        #        agents_index_all = where(self.lc1_all.get_attribute("sall_91_95_0"))[0]
        #        agents_index_all = where(self.lc1_all.get_attribute("sall_95_99_0"))[0]
        agents_index_all = where(self.lc1_all.get_attribute("sall_99_02_0"))[0]
        #        agents_index_all = where(self.lc1_all.get_attribute("suburb91_95sample0"))[0]
        #        agents_index_all = where(self.lc1_all.get_attribute("suburb95_99sample0"))[0]
        #        agents_index_all = where(self.lc1_all.get_attribute("up91x95_old_samp0"))[0]
        #        agents_index_all = where(self.lc1_all.get_attribute("urbsamp95_99_0"))[0]

        coef, results = lccm.estimate(self.specification,
                                      self.lc1,
                                      self.lc2,
                                      agents_index=agents_index,
                                      debuglevel=4)
        new_coef = lccm.calibrate(self.lc1_all, self.lc2_all, agents_index_all)
        specification = lccm.specification

        #save estimation results
        out_suffix = spec_py.__name__[len(spec_py.__name__) - 11:]
        specification.write(out_storage=self.storage,
                            out_table_name='lccm_specification_%sc' %
                            out_suffix)
        new_coef.write(out_storage=self.storage,
                       out_table_name='lccm_coefficients_%sc' % out_suffix)

        logger.log_status("Estimation done. %s s" % str(time() - t1))
    def estimate(self, spec_py=None, spec_var=None, spec_file=None):
        t1 = time()
        if spec_py is not None:
            reload(spec_py)
            spec_var = spec_py.specification
        if spec_var is not None:
            self.specification, variables, coefficents, equations, submodels = \
                self.load_specification_from_variable(spec_var)
        elif spec_file is not None:
            self.specification = EquationSpecification(in_storage=self.storage)
            self.specification.load(in_table_name=spec_file)

        self.specification.set_dataset_name_of_variables("land_cover")
        
        self.model_name = "land_cover_change_model"
        choices = range(1,15)
        lccm = LandCoverChangeModel(choices, submodel_string="lct")

        ## 4. select (uncomment) from one the following choices of subsetted sampling files (agents_index)
#        agents_index = where(self.lc1.get_attribute("sall_91_95_0"))[0]
        agents_index = where(self.lc1.get_attribute("sall_95_99_0"))[0]
#        agents_index = where(self.lc1.get_attribute("sall_99_02_0b"))[0]
#        agents_index = where(self.lc1.get_attribute("sa9902_9195_0"))[0]
#        agents_index = where(self.lc1.get_attribute("sa9902_9599_0"))[0]
#        agents_index = where(self.lc1.get_attribute("suburb91_95sample0"))[0]
#        agents_index = where(self.lc1.get_attribute("suburb95_99sample0"))[0]
#        agents_index = where(self.lc1.get_attribute("up91x95_old_samp0"))[0]
#        agents_index = where(self.lc1.get_attribute("urbsamp95_99_0"))[0]

        ## need to include agents_index_all seperate for the calibration portion
        ##    when using the dataset at the full extent, agents_index_all is needed as it is
        ##    created from the lc1_all agents_set and matches the size of the input data

        ## 5. select (uncomment) from one the following choices of sampling files (agents_index) at full spatial extent
#        agents_index_all = where(self.lc1_all.get_attribute("sall_91_95_0"))[0]
        agents_index_all = where(self.lc1_all.get_attribute("sall_95_99_0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("sall_99_02_0b"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("sa9902_9195_0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("sa9902_9599_0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("suburb91_95sample0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("suburb95_99sample0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("up91x95_old_samp0"))[0]
#        agents_index_all = where(self.lc1_all.get_attribute("urbsamp95_99_0"))[0]

        coef, results = lccm.estimate(self.specification, self.lc1, self.lc2, agents_index=agents_index, debuglevel=4)
        new_coef = lccm.calibrate(self.lc1_all, self.lc2_all, agents_index_all)
        specification = lccm.specification

        #save estimation results
#        out_suffix = spec_py.__name__[len(spec_py.__name__) - 11:]
        out_suffix = spec_py.__name__[30:]
        specification.write(out_storage=self.storage, out_table_name='lccm_specification_%sc' % out_suffix)
        new_coef.write(out_storage=self.storage, out_table_name='lccm_coefficients_%sc' % out_suffix)
            
        logger.log_status("Estimation done. %s s" % str(time()-t1))