Parses <Unit>

        @param node: Node containing the <Unit> element
        @type node: xml.etree.Element

        @raise ParseError: When the name is not a string or the unit
        specfications are incorrect.

        @raise ModelError: When the unit refers to an undefined dimension.

def parse_unit(self, node):
        """
        Parses <Unit>

        @param node: Node containing the <Unit> element
        @type node: xml.etree.Element

        @raise ParseError: When the name is not a string or the unit
        specfications are incorrect.

        @raise ModelError: When the unit refers to an undefined dimension.
        """

        try:
            symbol = node.lattrib['symbol']
            dimension = node.lattrib['dimension']
        except:
            self.raise_error('Unit must have a symbol and dimension.')

        if 'power' in node.lattrib:
            power = int(node.lattrib['power'])
        else:
            power = 0

        if 'name' in node.lattrib:
            name = node.lattrib['name']
        else:
            name = ''
            
        if 'scale' in node.lattrib:
            scale = float(node.lattrib['scale'])
        else:
            scale = 1.0
            
        if 'offset' in node.lattrib:
            offset = float(node.lattrib['offset'])
        else:
            offset = 0.0

        self.model.add_unit(Unit(name, symbol, dimension, power, scale, offset))