Ejemplo n.º 1
0
 def set_attribute_value(self, attribute_name, attribute_value):
     glib.configcheck(self, self.logger)
     self.logger.info("set_attribute_value {} -> {} ".format(
         attribute_name, attribute_value))
     # update config
     glib.configset(self._config, attribute_name, attribute_value)
     # set wfl config
     return self._bmi.set_attribute_value(attribute_name, attribute_value)
Ejemplo n.º 2
0
    def get_attribute_names(self):
        """Provides list with all model attribute names from model config file
        
        Returns:
            list -- list with model attribute names
        """

        glib.configcheck(self, self.logger)
        return glib.configattr(self._config)
Ejemplo n.º 3
0
 def get_attribute_value(self, attribute_name):
     glib.configcheck(self, self.logger)
     # always use "general" as config header; as file has no config header this is hard-coded
     if ':' not in attribute_name:
         attribute_name = 'general:{}'.format(attribute_name)
     else:
         attribute_name = 'general:{}'.format(attribute_name.split(':')[1])
     self.logger.debug("get_attribute_value: {}".format(attribute_name))
     return glib.configget(self._config, attribute_name)
Ejemplo n.º 4
0
 def write_config(self):
     """write adapted config to file. just before initializing
     only for models which do not allow for direct access to model config via bmi"""
     # rename old file if called 'input_flood.nam'
     glib.configcheck(self, self.logger)
     # write new file
     self._config_fn = join(dirname(self._config_fn), 'input_flood.nam')
     if isfile(self._config_fn):
         os.unlink(self._config_fn)
         self.logger.warn("{:s} file overwritten".format(self._config_fn))
     glib.configwrite(self._config, self._config_fn, encoding='utf-8')
     self.logger.info('Ini file written to {:s}'.format(self._config_fn))
Ejemplo n.º 5
0
    def get_attribute_value(self, attribute_name):
        """Gets attribute value in in underlying model;
        attribute_name should use the following convention model_name.section_name:attribute_name
        
        Arguments:
            attribute_name {str} -- Name of BMI attribute
        
        Returns:
            float -- value of attribute
        """

        glib.configcheck(self, self.logger)
        self.logger.debug("get_attribute_value: " + attribute_name)
        return glib.configget(self._config, attribute_name)
Ejemplo n.º 6
0
    def set_attribute_value(self, attribute_name, attribute_value):
        """sets attribute value in in underlying model;
        attribute_name should use the following convention model_name.section_name:attribute_name
        
        Arguments:
            attribute_name {str} -- Name of BMI attribute
            attribute_value {float} -- value to be est
        
        Returns:
            [str] -- [no clue]
        """

        glib.configcheck(self, self.logger)
        self.logger.debug("set_attribute_value: " + attribute_value)
        return glib.configset(self._config, attribute_name, attribute_value)
Ejemplo n.º 7
0
 def get_attribute_value(self, attribute_name):
     glib.configcheck(self, self.logger)
     self.logger.debug("get_attribute_value: " + attribute_name)
     return self._bmi.get_attribute_value(attribute_name)
Ejemplo n.º 8
0
 def get_attribute_names(self):
     glib.configcheck(self, self.logger)
     return glib.configattr(self._config)
Ejemplo n.º 9
0
 def set_attribute_value(self, attribute_name, attribute_value):
     glib.configcheck(self, self.logger)
     self.logger.debug("set_attribute_value: {} -> {}".format(
         attribute_name, attribute_value))
     return glib.configset(self._config, attribute_name,
                           str(attribute_value))
Ejemplo n.º 10
0
 def get_attribute_value(self, attribute_name):
     glib.configcheck(self, self.logger)
     self.logger.debug("get_attribute_value: {}".format(attribute_name))
     return glib.configget(self._config, attribute_name)