Ejemplo n.º 1
0
    def updateRowByName(self, row_vals, name, **kwargs):
        """Updates the row for the entry with the give name.
        
        Changes the state of the values in the initial conditions list for the
        the .dat file for the unit with the given name.

        Args:
            row_vals(Dict): keys must be datunits.ROW_DATA_TYPES with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            name: the name of the unit who's ic's should be updated.

        Raises:
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObject's. 
            AttributeError: If the given name doesn't exists in the collection.
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        labels = self.row_data['main'].dataObjectAsList(rdt.LABEL)
        try:
            index = labels.index(name)
        except ValueError:
            raise KeyError('Name does not exist in initial conditions: ' + str(name))
        
        # Call superclass method to add the new row
        AUnit.updateRow(self, row_vals=row_vals, index=index, **kwargs)
Ejemplo n.º 2
0
    def updateRow(self, row_vals, index, collection_name=None, **kwargs):
        """Updates the row at the given index in the river units row_collection.

        The row will be updated at the given index.

        Args:
            row_vals(Dict): keys must be datunits.ROW_DATA_TYPES with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index: the row to update.
            collection_name=None(str): If None the self.row_collection
                with the bridges geometry data will be updated. If a string it
                will be looked for in the self.additional_row_collections
                dictionary or raise an AttributeError if it doesn't exist.

        Raises:
            KeyError: If collection_name key does not exist.
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObject's.

        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        if not collection_name is None:
            if not collection_name in self.additional_row_collections.keys():
                raise KeyError(
                    'collection_name %s does not exist in row collection' %
                    (collection_name))

        # Call superclass method to add the new row
        AUnit.updateRow(self, index=index, row_vals=row_vals, **kwargs)
Ejemplo n.º 3
0
    def updateRow(self, row_vals, index, collection_name=None, **kwargs):
        """Updates the row at the given index in the river units row_collection.
        
        The row will be updated at the given index. 

        Args:
            row_vals(Dict): keys must be datunits.ROW_DATA_TYPES with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index: the row to update. 
            collection_name=None(str): If None the self.row_collection
                with the bridges geometry data will be updated. If a string it
                will be looked for in the self.additional_row_collections
                dictionary or raise an AttributeError if it doesn't exist.

        Raises:
            KeyError: If collection_name key does not exist.
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObject's. 
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        if not collection_name is None:
            if not collection_name in self.additional_row_collections.keys():
                raise KeyError ('collection_name %s does not exist in row collection' % (collection_name))
        
        # Call superclass method to add the new row
        AUnit.updateRow(self, index=index, row_vals=row_vals, **kwargs)
Ejemplo n.º 4
0
    def updateRow(self, row_vals, index, **kwargs):
        """Updates the row at the given index in the river units row_data.
        
        The row will be updated at the given index. 

        Args:
            row_vals(Dict): keys must be datunits.ROW_DATA_TYPES with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index: the row to update. 

        Raises:
            AttributeError: If CHAINAGE or ELEVATION are not given.
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObject's. 
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        
        # Call superclass method to add the new row
        AUnit.updateRow(self, row_vals=row_vals, index=index, **kwargs)
Ejemplo n.º 5
0
    def updateRow(self, row_vals, index, **kwargs):
        """Updates the row at the given index in the row_collection.
        
        Changes the state of the values in the initial conditions list of 
        the .dat file at the given index.

        Args:
            row_vals(Dict): keys must be datunits.ROW_DATA_TYPES with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index: the row to update. 

        Raises:
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObject's. 
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        
        # Call superclass method to add the new row
        AUnit.updateRow(self, row_vals=row_vals, index=index, **kwargs)