Exemple #1
0
    def addRow(self, row_vals, rowdata_key='main', index=None, **kwargs):
        """Adds a new row to the spill unit.

        Ensures that certain requirements of the data rows, such as the 
        chainage needing to increase for each row down are met, then call the 
        addNewRow() method in the row_collection.
        
        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=None(int): the row to insert into. The existing row at the
                given index will be moved up by one.

        Returns:
            False if the addNewRow() method is unsuccessful.
        
        Raises:
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObjects. 
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        keys = row_vals.keys()
        if not rdt.CHAINAGE in keys or not rdt.ELEVATION in keys:
            raise AttributeError('row_vals must include CHAINAGE and ELEVATION.')
        
        # Call superclass method to add the new row
        AUnit.addRow(self, row_vals, index=index, **kwargs)
        
    
        
Exemple #2
0
    def __init__(self, **kwargs): 
        """Constructor.
        
        Args:
            fileOrder (int): The location of this unit in the file.
        """
        AUnit.__init__(self, **kwargs)

        self._name = 'Spl'
        self._name_ds = 'SplDS'
        self.head_data = {
            'comment': HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'weir_coef': HeadDataItem(1.700, '{:>10}', 1, 0, dtype=dt.FLOAT, dps=3),
            'modular_limit': HeadDataItem(0.700, '{:>10}', 1, 2, dtype=dt.FLOAT, dps=3),
        }

        self._unit_type = SpillUnit.UNIT_TYPE
        self._unit_category = SpillUnit.UNIT_CATEGORY
        
        dobjs = [
            do.FloatData(rdt.CHAINAGE, format_str='{:>10}', no_of_dps=3, update_callback=self.checkIncreases),
            do.FloatData(rdt.ELEVATION, format_str='{:>10}', no_of_dps=3),
            do.FloatData(rdt.EASTING, format_str='{:>10}', no_of_dps=2, default=0.00),
            do.FloatData(rdt.NORTHING, format_str='{:>10}', no_of_dps=2, default=0.00),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.CHAINAGE: 0, rdt.ELEVATION: 0})
Exemple #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)
Exemple #4
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)
Exemple #5
0
 def __init__(self, **kwargs): 
     """Constructor.
     
     Args:
         fileOrder (int): The location of this unit in the file.
     """
     AUnit.__init__(self, **kwargs)
     
     self._unit_type = HtbdyUnit.UNIT_TYPE
     self._unit_category = HtbdyUnit.UNIT_CATEGORY
     self._name = 'Htbd'
     
     time_units = (
         'SECONDS', 'MINUTES', 'HOURS', 'DAYS', 'WEEKS', 'FORTNIGHTS',
         'LUNAR MONTHS', 'MONTHS', 'QUARTERS', 'YEARS', 'DECADES', 'USER SET',
     )
     self.head_data = {
         'comment': HeadDataItem('', '', 0, 1, dtype=dt.STRING),
         'multiplier': HeadDataItem(1.000, '{:>10}', 0, 1, dtype=dt.FLOAT, dps=3),
         'time_units': HeadDataItem('HOURS', '{:>10}', 2, 0, dtype=dt.CONSTANT, choices=time_units),
         'extending_method': HeadDataItem('EXTEND', '{:>10}', 2, 0, dtype=dt.CONSTANT, choices=('EXTEND', 'NOEXTEND', 'REPEAT')),
         'interpolation': HeadDataItem('LINEAR', '{:>10}', 2, 0, dtype=dt.CONSTANT, choices=('LINEAR', 'SPLINE')),
     }
     
     dobjs = [
         do.FloatData(rdt.ELEVATION, format_str='{:>10}', no_of_dps=3),
         do.FloatData(rdt.TIME, format_str='{:>10}', no_of_dps=3, update_callback=self.checkIncreases),
     ]
     self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
     self.row_data['main'].setDummyRow({rdt.TIME: 0, rdt.ELEVATION: 0})
Exemple #6
0
    def addRow(self, row_vals, rowdata_key='main', index=None, **kwargs):
        """Adds a new row to the spill unit.

        Ensures that certain requirements of the data rows, such as the 
        chainage needing to increase for each row down are met, then call the 
        addNewRow() method in the row_collection.
        
        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=None(int): the row to insert into. The existing row at the
                given index will be moved up by one.

        Returns:
            False if the addNewRow() method is unsuccessful.
        
        Raises:
            IndexError: If the index does not exist.
            ValueError: If the given value is not accepted by the DataObjects. 
            
        See Also:
            ADataObject and subclasses for information on the parameters.
        """
        keys = row_vals.keys()
        if not rdt.CHAINAGE in keys or not rdt.ELEVATION in keys:
            raise AttributeError(
                'row_vals must include CHAINAGE and ELEVATION.')

        # Call superclass method to add the new row
        AUnit.addRow(self, row_vals, index=index, **kwargs)
    def __init__(self, **kwargs):
        """Constructor

        Args:
            node_count (int): The number of nodes in the model. We need this to 
                know how many lines there are to read from the contents list.
            fileOrder (int): The location of the initial conditions in the 
                .DAT file. This will always be at the end but before the 
                GISINFO if there is any.
        """
        AUnit.__init__(self, **kwargs)
        self._unit_type = InitialConditionsUnit.UNIT_TYPE
        self._unit_category = InitialConditionsUnit.UNIT_CATEGORY
        self._name = "initial_conditions"
        self._name_types = {}
        self._node_count = 0
#         self.has_datarows = True
#         self.has_ics = False
        
        dobjs = [
            do.StringData(rdt.LABEL, format_str='{:<12}'),
            do.StringData(rdt.QMARK, format_str='{:>2}', default='y'),
            do.FloatData(rdt.FLOW, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.STAGE, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.FROUDE_NO, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.VELOCITY, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.UMODE, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.USTATE, format_str='{:>10}', default=0.000, no_of_dps=3),
            do.FloatData(rdt.ELEVATION, format_str='{:>10}', default=0.000, no_of_dps=3),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
    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)
Exemple #9
0
    def __init__(self, **kwargs): 
        """Constructor.
        """
        AUnit.__init__(self, **kwargs)

        self._unit_type = BridgeUnit.UNIT_TYPE
        self._unit_category = BridgeUnit.UNIT_CATEGORY
        self._name = 'BrgUS'
        self._name_ds = 'BrgDS'

        self.setupRowData()
Exemple #10
0
    def __init__(self, **kwargs): 
        """Constructor.
        
        Args:
            fileOrder (int): The location of this unit in the file.
            reach_number (int): The reach ID for this unit.
        """
        AUnit.__init__(self, **kwargs)

        self._unit_type = RiverUnit.UNIT_TYPE
        self._unit_category = RiverUnit.UNIT_CATEGORY
        if self._name == 'unknown': self._name = 'RivUS'

        self.reach_number = kwargs.get('reach_number', -1)
        
        self.head_data = {
            'comment': HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'spill1': HeadDataItem('', '{:<12}', 2, 3, dtype=dt.STRING),
            'spill2': HeadDataItem('', '{:<12}', 2, 4, dtype=dt.STRING),
            'lateral1': HeadDataItem('', '{:<12}', 2, 6, dtype=dt.STRING),
            'lateral2': HeadDataItem('', '{:<12}', 2, 7, dtype=dt.STRING),
            'lateral3': HeadDataItem('', '{:<12}', 2, 8, dtype=dt.STRING),
            'lateral4': HeadDataItem('', '{:<12}', 2, 9, dtype=dt.STRING),
            'distance': HeadDataItem(0.0, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
            'slope': HeadDataItem(0.0001, '{:>20}', 3, 1, dtype=dt.FLOAT, dps=4),
            'density': HeadDataItem(1000, '{:>10}', 3, 2, dtype=dt.INT),
        }
        
        '''
            Add the new row data types to the object collection
            All of them must have type, output format, and position
            in the row all other arguments are excepted as **kwargs.
        '''
        dobjs = [
            # update_callback is called every time a value is added or updated
            do.FloatData(rdt.CHAINAGE, format_str='{:>10}', no_of_dps=3, update_callback=self.checkIncreases),
            do.FloatData(rdt.ELEVATION, format_str='{:>10}', no_of_dps=3),
            do.FloatData(rdt.ROUGHNESS, format_str='{:>10}', default=0.039, no_of_dps=3),
            do.SymbolData(rdt.PANEL_MARKER, '*', format_str='{:<5}', default=False),
            do.FloatData(rdt.RPL, format_str='{:>5}', default=1.000, no_of_dps=3),
            do.ConstantData(rdt.BANKMARKER, ('', 'LEFT', 'RIGHT', 'BED'), format_str='{:<10}', default=''),
            do.FloatData(rdt.EASTING, format_str='{:>10}', default=0.0, no_of_dps=2),
            do.FloatData(rdt.NORTHING, format_str='{:>10}', default=0.0, no_of_dps=2),
            do.ConstantData(rdt.DEACTIVATION, ('', 'LEFT', 'RIGHT'), format_str='{:<10}', default=''),
            # Default == '~' means to ignore formatting and apply '' when value is None
            do.StringData(rdt.SPECIAL, format_str='{:<10}', default='~'),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.CHAINAGE: 0, rdt.ELEVATION:0, rdt.ROUGHNESS: 0})
Exemple #11
0
 def __init__(self, **kwargs):
     """Constructor
     
     Args:
         node_count (int): The number of nodes in the model. We need this 
             to know how many lines there are to read from the contents list.
         fileOrder (inti) The location of this unit in the .DAT file. This 
             will always be at the end but for the GisInfoUnit, but we need 
             to pass it to the superclass.
     """
 
     AUnit.__init__(self)
     self._unit_type = GisInfoUnit.UNIT_TYPE
     self._unit_category = GisInfoUnit.UNIT_CATEGORY
     self._name = "GisInfo"
Exemple #12
0
 def __init__(self):
     '''Constructor.
     
     Args:
         file_order (int): the order of this unit in the .dat file.
     '''
     AUnit.__init__(self)
     self._unit_type = JunctionUnit.UNIT_TYPE
     self._unit_category = JunctionUnit.UNIT_CATEGORY
     self.head_data = {
         'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING),
         'type': HeadDataItem('OPEN', '', 0, 0, dtype=dt.CONSTANT, choices=('OPEN', 'ENERGY')),
         'names': [],
     }
     self.name = 'Junc' # Must be after head_data here (see property below)
    def addRow(self, row_vals, unit_type, **kwargs): 
        """Adds a new row to the InitialCondition units row_collection.
        
        The new row will be added at the given index. If no index is given it
        will be appended to the end of the collection.
        
        If no LABEL value is given a AttributeError will be raised as it 
        cannot have a default value. All other values can be ommitted. If they 
        are they will be given defaults.
        
        Examples:
            >>> import ship.fmp.datunits.ROW_DATA_TYPES as rdt
            >>> ics.addRow({rdt.LABEL:UNITNAME, rdt.STAGE:10.2}, index=4)

        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.

        Raises:
            AttributeError: If LABEL is 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.
        """
        if not rdt.LABEL in row_vals.keys(): 
            logger.error('Required values of LABEL not given')
            raise  AttributeError ("Required value 'LABEL' not given") 
        
        # Keep a record of multiple unit types under the same name
        if row_vals[rdt.LABEL] in self._name_types.keys():
            if not unit_type in self._name_types[row_vals[rdt.LABEL]]:
                self._name_types[row_vals[rdt.LABEL]].append(unit_type)
        else:
            self._name_types[row_vals[rdt.LABEL]] = [unit_type]

        # Don't add the same ic's in twice
        labels = self.row_data['main'].dataObjectAsList(rdt.LABEL)
        if row_vals[rdt.LABEL] in labels:
            return self._node_count

        # Call superclass method to add the new row
        AUnit.addRow(self, row_vals=row_vals, index=None, **kwargs)
        self._node_count += 1
        return self._node_count
Exemple #14
0
    def __init__(self):
        '''Constructor.
        
        Args:
            file_order (int): the order of this unit in the .dat file.
        '''
        AUnit.__init__(self)
        self._unit_type = InterpolateUnit.UNIT_TYPE
        self._unit_category = InterpolateUnit.UNIT_CATEGORY
        self._name = 'Interp'

        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 0, dtype=dt.STRING),
            'spill1':
            HeadDataItem('', '{:<12}', 1, 0, dtype=dt.STRING),
            'spill2':
            HeadDataItem('', '{:<12}', 1, 1, dtype=dt.STRING),
            'lateral1':
            HeadDataItem('', '{:<12}', 1, 2, dtype=dt.STRING),
            'lateral2':
            HeadDataItem('', '{:<12}', 1, 3, dtype=dt.STRING),
            'lateral3':
            HeadDataItem('', '{:<12}', 1, 4, dtype=dt.STRING),
            'lateral4':
            HeadDataItem('', '{:<12}', 1, 5, dtype=dt.STRING),
            'distance':
            HeadDataItem(0.00, '{:<10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'easting':
            HeadDataItem(0.00,
                         '{:<10}',
                         2,
                         1,
                         dtype=dt.FLOAT,
                         dps=3,
                         default=0.00),
            'northing':
            HeadDataItem(0.00,
                         '{:<10}',
                         2,
                         2,
                         dtype=dt.FLOAT,
                         dps=3,
                         default=0.00),
        }
Exemple #15
0
    def __init__(self, **kwargs):
        '''Constructor.
        '''
        AUnit.__init__(self, **kwargs)
        self._unit_type = OrificeUnit.UNIT_TYPE
        self._unit_category = OrificeUnit.UNIT_CATEGORY
        self._name = 'orif'

        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 0, dtype=dt.STRING),
            'type':
            HeadDataItem('OPEN',
                         '{:>10}',
                         1,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('OPEN', 'FLAPPED')),
            'invert_level':
            HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'soffit_level':
            HeadDataItem(0.000, '{:>10}', 2, 1, dtype=dt.FLOAT, dps=3),
            'bore_area':
            HeadDataItem(0.000, '{:>10}', 2, 2, dtype=dt.FLOAT, dps=3),
            'us_sill_level':
            HeadDataItem(0.000, '{:>10}', 2, 3, dtype=dt.FLOAT, dps=3),
            'ds_sill_level':
            HeadDataItem(0.000, '{:>10}', 2, 4, dtype=dt.FLOAT, dps=3),
            'shape':
            HeadDataItem('RECTANGLE',
                         '{:>10}',
                         2,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('RECTANGLE', 'CIRCULAR')),
            'weir_flow':
            HeadDataItem(0.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
            'surcharged_flow':
            HeadDataItem(0.000, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=3),
            'modular_limit':
            HeadDataItem(0.000, '{:>10}', 3, 2, dtype=dt.FLOAT, dps=3),
        }
Exemple #16
0
 def __init__(self, **kwargs):
     '''Constructor.
     '''
     AUnit.__init__(self, **kwargs)
     self._unit_type = OrificeUnit.UNIT_TYPE
     self._unit_category = OrificeUnit.UNIT_CATEGORY
     self._name = 'orif'
     
     self.head_data = {
         'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING),
         'type': HeadDataItem('OPEN', '{:>10}', 1, 0, dtype=dt.CONSTANT, choices=('OPEN', 'FLAPPED')),
         'invert_level': HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=3),
         'soffit_level': HeadDataItem(0.000, '{:>10}', 2, 1, dtype=dt.FLOAT, dps=3),
         'bore_area': HeadDataItem(0.000, '{:>10}', 2, 2, dtype=dt.FLOAT, dps=3),
         'us_sill_level': HeadDataItem(0.000, '{:>10}', 2, 3, dtype=dt.FLOAT, dps=3),
         'ds_sill_level': HeadDataItem(0.000, '{:>10}', 2, 4, dtype=dt.FLOAT, dps=3),
         'shape': HeadDataItem('RECTANGLE', '{:>10}', 2, 5, dtype=dt.CONSTANT, choices=('RECTANGLE', 'CIRCULAR')),
         'weir_flow': HeadDataItem(0.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
         'surcharged_flow': HeadDataItem(0.000, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=3),
         'modular_limit': HeadDataItem(0.000, '{:>10}', 3, 2, dtype=dt.FLOAT, dps=3),
     }
Exemple #17
0
    def addRow(self, row_vals, rowdata_key='main', index=None, **kwargs):
        """Adds a new row to one of this bridge units row_collection's.

        The new row will be added at the given index. If no index is given it
        will be appended to the end of the collection.

        If no chainage or elevation values are given an AttributeError will be
        raised as they cannot have default values. All other values can be
        ommitted. If they are they will be given defaults.

        Examples:
            >>> import ship.fmp.datunits.rdt as rdt
            >>> unit.addRow({rdt.CHAINAGE:5.0, rdt.ELEVATION:36.2}, index=4)

        Args:
            row_vals(Dict): keys must be datunits.rdt with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index=None(int): the row to insert into. The existing row at the
                given index will be moved up by one.
            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:
            AttributeError: If required values are not given for the rowdata_key
                collection. See _checkRowKeys().
            KeyError: if the collection_name 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.
        """
        self._checkRowKeys(row_vals, rowdata_key)
        AUnit.addRow(self,
                     row_vals=row_vals,
                     rowdata_key=rowdata_key,
                     index=index,
                     **kwargs)
Exemple #18
0
    def __init__(self, **kwargs):
        """Constructor.
        
        Args:
            fileOrder (int): The location of this unit in the file.
        """
        AUnit.__init__(self, **kwargs)

        self._name = 'Spl'
        self._name_ds = 'SplDS'
        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'weir_coef':
            HeadDataItem(1.700, '{:>10}', 1, 0, dtype=dt.FLOAT, dps=3),
            'modular_limit':
            HeadDataItem(0.700, '{:>10}', 1, 2, dtype=dt.FLOAT, dps=3),
        }

        self._unit_type = SpillUnit.UNIT_TYPE
        self._unit_category = SpillUnit.UNIT_CATEGORY

        dobjs = [
            do.FloatData(rdt.CHAINAGE,
                         format_str='{:>10}',
                         no_of_dps=3,
                         update_callback=self.checkIncreases),
            do.FloatData(rdt.ELEVATION, format_str='{:>10}', no_of_dps=3),
            do.FloatData(rdt.EASTING,
                         format_str='{:>10}',
                         no_of_dps=2,
                         default=0.00),
            do.FloatData(rdt.NORTHING,
                         format_str='{:>10}',
                         no_of_dps=2,
                         default=0.00),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.CHAINAGE: 0, rdt.ELEVATION: 0})
Exemple #19
0
    def addRow(self, row_vals, index=None, **kwargs): 
        """Adds a new row to the river units row_data.
        
        The new row will be added at the given index. If no index is given it
        will be appended to the end of the collection.
        
        If no chainage or elevation values are given a AttributeError will be 
        raised as they cannot have default values. All other values can be
        ommitted. If they are they will be given defaults.
        
        Examples:
            >>> import ship.fmp.datunits.ROW_DATA_TYPES as rdt
            >>> river_unit.addDataRow({rdt.CHAINAGE:5.0, rdt.ELEVATION:36.2}, index=4)

        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=None(int): the row to insert into. The existing row at the
                given index will be moved up by one.

        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.
        """
        keys = row_vals.keys()
        if not rdt.CHAINAGE in keys or not rdt.ELEVATION in keys:
            raise AttributeError('row_vals must include CHAINAGE and ELEVATION.')
        
        # Call superclass method to add the new row
        AUnit.addRow(self, row_vals, index=index, **kwargs)
            

        
        
Exemple #20
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)
Exemple #21
0
 def __init__(self):
     '''Constructor.
     
     Args:
         file_order (int): the order of this unit in the .dat file.
     '''
     AUnit.__init__(self)
     self._unit_type = JunctionUnit.UNIT_TYPE
     self._unit_category = JunctionUnit.UNIT_CATEGORY
     self.head_data = {
         'comment':
         HeadDataItem('', '', 0, 0, dtype=dt.STRING),
         'type':
         HeadDataItem('OPEN',
                      '',
                      0,
                      0,
                      dtype=dt.CONSTANT,
                      choices=('OPEN', 'ENERGY')),
         'names': [],
     }
     self.name = 'Junc'  # Must be after head_data here (see property below)
    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)
Exemple #23
0
    def __init__(self):
        '''Constructor.
        
        Args:
            file_order (int): the order of this unit in the .dat file.
        '''
        AUnit.__init__(self)
        self._unit_type = InterpolateUnit.UNIT_TYPE
        self._unit_category = InterpolateUnit.UNIT_CATEGORY
        self._name = 'Interp'

        self.head_data = {
            'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING),
            'spill1': HeadDataItem('', '{:<12}', 1, 0, dtype=dt.STRING),
            'spill2': HeadDataItem('', '{:<12}', 1, 1, dtype=dt.STRING),
            'lateral1': HeadDataItem('', '{:<12}', 1, 2, dtype=dt.STRING),
            'lateral2': HeadDataItem('', '{:<12}', 1, 3, dtype=dt.STRING),
            'lateral3': HeadDataItem('', '{:<12}', 1, 4, dtype=dt.STRING),
            'lateral4': HeadDataItem('', '{:<12}', 1, 5, dtype=dt.STRING),
            'distance': HeadDataItem(0.00, '{:<10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'easting': HeadDataItem(0.00, '{:<10}', 2, 1, dtype=dt.FLOAT, dps=3, default=0.00),
            'northing': HeadDataItem(0.00, '{:<10}', 2, 2, dtype=dt.FLOAT, dps=3, default=0.00),
        }
Exemple #24
0
    def addRow(self, row_vals, rowdata_key='main', index=None, **kwargs): 
        """Adds a new row to one of this bridge units row_collection's.
        
        The new row will be added at the given index. If no index is given it
        will be appended to the end of the collection.
        
        If no chainage or elevation values are given an AttributeError will be 
        raised as they cannot have default values. All other values can be
        ommitted. If they are they will be given defaults.
        
        Examples:
            >>> import ship.fmp.datunits.rdt as rdt
            >>> unit.addRow({rdt.CHAINAGE:5.0, rdt.ELEVATION:36.2}, index=4)

        Args:
            row_vals(Dict): keys must be datunits.rdt with a legal
                value assigned for the DataType. Chainage and Elevation MUST
                be included.
            index=None(int): the row to insert into. The existing row at the
                given index will be moved up by one.
            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:
            AttributeError: If required values are not given for the rowdata_key
                collection. See _checkRowKeys().
            KeyError: if the collection_name 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.
        """
        self._checkRowKeys(row_vals, rowdata_key)
        AUnit.addRow(self, row_vals=row_vals, rowdata_key=rowdata_key, index=index,
                     **kwargs)
Exemple #25
0
 def __init__(self):
     '''Constructor.
     '''
     AUnit.__init__(self)
     self._unit_type = CulvertUnit.UNIT_TYPE
     self._unit_category = CulvertUnit.UNIT_CATEGORY
Exemple #26
0
    def __init__(self, **kwargs): 
        """Constructor.
        """
        AUnit.__init__(self, **kwargs)
        
        self._unit_type = RefhUnit.UNIT_TYPE
        self._unit_category = RefhUnit.UNIT_CATEGORY
#         self.row_data['main'] = []
        if self._name == 'unknown': self._name = 'Refh_unit'

        # Fill in the header values these contain the data at the top of the
        # section, such as the unit name and labels.
        self.head_data = {
            'revision': HeadDataItem(1, '{:<1}', 0, 0, dtype=dt.INT),
            'comment': HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'z': HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'easting': HeadDataItem('', '{:>10}', 2, 1, dtype=dt.STRING), 
            'northing': HeadDataItem('', '{:>10}', 2, 2, dtype=dt.STRING),
            'time_delay': HeadDataItem(0.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
            'time_step': HeadDataItem(1.0, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=1),
            'bf_only': HeadDataItem('', '{:>10}', 3, 2, dtype=dt.STRING),
            'sc_flag': HeadDataItem('SCALEFACT', '{:<10}', 3, 3, dtype=dt.CONSTANT, choices=('SCALEFACT', 'PEAKVALUE')),
            'scale_factor': HeadDataItem(1.000, '{:>10}', 3, 4, dtype=dt.FLOAT, dps=3),
            'hydrograph_mode': HeadDataItem('HYDROGRAPH', '{:>10}', 3, 5, dtype=dt.CONSTANT, choices=('HYDROGRAPH', 'HYETOGRAPH')),
            'hydrograph_scaling': HeadDataItem('RUNOFF', '{:>10}', 3, 6, dtype=dt.CONSTANT, choices=('RUNOFF', 'FULL')),
            'min_flow': HeadDataItem(1.000, '{:>10}', 3, 7, dtype=dt.FLOAT, dps=3),
            'catchment_area': HeadDataItem(0.00, '{:>10}', 4, 0, dtype=dt.FLOAT, dps=2),
            'saar': HeadDataItem(0, '{:>10}', 4, 1, dtype=dt.INT),
            'urbext': HeadDataItem(0.000, '{:>10}', 4, 2, dtype=dt.FLOAT, dps=3),
            'season': HeadDataItem('DEFAULT', '{:>10}', 4, 3, dtype=dt.CONSTANT, choices=('DEFAULT', 'WINTER', 'SUMMER')),
            'published_report': HeadDataItem('DLL', '{:>10}', 4, 4, dtype=dt.CONSTANT, choices=('DLL', 'REPORT')),
            
            # Urban - only used if 'urban' == 'URBANREFH'
            'urban': HeadDataItem('', '{:>10}', 4, 5, dtype=dt.CONSTANT, choices=('', 'URBANREFH')),
            'subarea_1': HeadDataItem(0.00, '{:>10}', 5, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_1': HeadDataItem(0.000, '{:>10}', 5, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_1': HeadDataItem(0.000, '{:>10}', 5, 2, dtype=dt.FLOAT, dps=3),
            'calibration_1': HeadDataItem(0.000, '{:>10}', 5, 3, dtype=dt.FLOAT, dps=3),
            'subarea_2': HeadDataItem(0.00, '{:>10}', 6, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_2': HeadDataItem(0.000, '{:>10}', 6, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_2': HeadDataItem(0.000, '{:>10}', 6, 2, dtype=dt.FLOAT, dps=3),
            'calibration_2': HeadDataItem(0.000, '{:>10}', 6, 3, dtype=dt.FLOAT, dps=3),
            'subrunoff_2': HeadDataItem(0.000, '{:>10}', 6, 4, dtype=dt.FLOAT, dps=3),
            'sewer_rp_2': HeadDataItem('RUNOFF', '{:>10}', 6, 5, dtype=dt.CONSTANT, choices=('RUNOFF', 'DEPTH')),
            'sewer_depth_2': HeadDataItem(0.000, '{:>10}', 6, 6, dtype=dt.FLOAT, dps=3),
            'sewer_lossvolume_2': HeadDataItem('VOLUME', '{:>10}', 6, 7, dtype=dt.CONSTANT, choices=('VOLUME', 'FLOW')),
            'subarea_3': HeadDataItem(0.00, '{:>10}', 7, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_3': HeadDataItem(0.000, '{:>10}', 7, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_3': HeadDataItem(0.000, '{:>10}', 7, 2, dtype=dt.FLOAT, dps=3),
            'calibration_3': HeadDataItem(0.000, '{:>10}', 7, 3, dtype=dt.FLOAT, dps=3),
            'subrunoff_3': HeadDataItem(0.000, '{:>10}', 7, 4, dtype=dt.FLOAT, dps=3),
            
            'storm_area': HeadDataItem(0.00, '{:>10}', 8, 0, dtype=dt.FLOAT, dps=2),
            'storm_duration': HeadDataItem(0.000, '{:>10}', 8, 1, dtype=dt.FLOAT, dps=3),
            'sn_rate': HeadDataItem(0.000, '{:>10}', 8, 2, dtype=dt.FLOAT, dps=3),
            'rainfall_flag': HeadDataItem('DESIGN', '{:>10}', 9, 0, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'arf_flag': HeadDataItem('DESIGN', '{:>10}', 9, 1, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'rainfall_comment': HeadDataItem('', '', 9, 2, dtype=dt.STRING),
            'rainfall_odepth': HeadDataItem(0.000, '{:>10}', 10, 0, dtype=dt.FLOAT, dps=3),
            'return_period': HeadDataItem(0, '{:>10}', 10, 1, dtype=dt.INT),
            'arf': HeadDataItem(0.000, '{:>10}', 10, 2, dtype=dt.FLOAT, dps=3),
            'c': HeadDataItem(0.000, '{:>10}', 10, 3, dtype=dt.FLOAT, dps=3),
            'd1': HeadDataItem(0.000, '{:>10}', 10, 4, dtype=dt.FLOAT, dps=3),
            'd2': HeadDataItem(0.000, '{:>10}', 10, 5, dtype=dt.FLOAT, dps=3),
            'd2': HeadDataItem(0.000, '{:>10}', 10, 6, dtype=dt.FLOAT, dps=3),
            'd3': HeadDataItem(0.000, '{:>10}', 10, 7, dtype=dt.FLOAT, dps=3),
            'e': HeadDataItem(0.000, '{:>10}', 10, 8, dtype=dt.FLOAT, dps=3),
            'f': HeadDataItem(0.000, '{:>10}', 10, 9, dtype=dt.FLOAT, dps=3),
            'rp_flag': HeadDataItem('DESIGN', '{:>10}', 11, 0, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'scf_flag': HeadDataItem('DESIGN', '{:>10}', 11, 1, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'scf': HeadDataItem(0.000, '{:>10}', 11, 2, dtype=dt.FLOAT, dps=3),
            'use_refined_rainfall': HeadDataItem('0', '{:>10}', 11, 3, dtype=dt.CONSTANT, choices=('0', '1')),

            'cmax_flag': HeadDataItem('DESIGN', '{:>10}', 12, 0, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'cini_flag': HeadDataItem('DESIGN', '{:>10}', 12, 1, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'alpha_flag': HeadDataItem('DESIGN', '{:>10}', 12, 2, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'models_comment': HeadDataItem('', '{}', 12, 3, dtype=dt.STRING),
            'cm_dcf': HeadDataItem(0.000, '{:>10}', 13, 0, dtype=dt.FLOAT, dps=3),
            'cmax': HeadDataItem(0.000, '{:>10}', 13, 1, dtype=dt.FLOAT, dps=3),
            'cini': HeadDataItem(0.000, '{:>10}', 13, 2, dtype=dt.FLOAT, dps=3),
            'alpha': HeadDataItem(0.000, '{:>10}', 13, 3, dtype=dt.FLOAT, dps=3),
            'bfihost': HeadDataItem(0.000, '{:>10}', 13, 4, dtype=dt.FLOAT, dps=3),
            'uh_flag': HeadDataItem('DESIGN', '{:>10}', 14, 0, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'tp_flag': HeadDataItem('DESIGN', '{:>10}', 14, 1, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'up_flag': HeadDataItem('DESIGN', '{:>10}', 14, 3, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'uk_flag': HeadDataItem('DESIGN', '{:>10}', 14, 4, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'tp_dcf': HeadDataItem(0.000, '{:>10}', 15, 0, dtype=dt.FLOAT, dps=3),
            'tp0': HeadDataItem(0.000, '{:>10}', 15, 1, dtype=dt.FLOAT, dps=3),
            'tpt': HeadDataItem(0.000, '{:>10}', 15, 2, dtype=dt.FLOAT, dps=3),
            'dplbar': HeadDataItem(0.000, '{:>10}', 15, 3, dtype=dt.FLOAT, dps=3),
            'dpsbar': HeadDataItem(0.000, '{:>10}', 15, 4, dtype=dt.FLOAT, dps=3),
            'propwet': HeadDataItem(0.000, '{:>10}', 15, 5, dtype=dt.FLOAT, dps=3),
            'up': HeadDataItem(0.000, '{:>10}', 15, 6, dtype=dt.FLOAT, dps=3),
            'uk': HeadDataItem(0.000, '{:>10}', 15, 7, dtype=dt.FLOAT, dps=3),
            'uh_rows': HeadDataItem(0.000, '{:>10}', 16, 0, dtype=dt.INT),
#             'uh_units': HeadDataItem(0.000, '{:>10}', 14, 9, dtype=dt.INT),        # TODO: Find out what the deal with these is
#             'uh_fct': HeadDataItem(0.000, '{:>10}', 14, 10, dtype=dt.FLOAT, dps=3),
            'bl_flag': HeadDataItem('DESIGN', '{:>10}', 17, 0, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'br_flag': HeadDataItem('DESIGN', '{:>10}', 17, 1, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'br0_flag': HeadDataItem('DESIGN', '{:>10}', 17, 2, dtype=dt.CONSTANT, choices=('DESIGN', 'USER')),
            'bl_dcf': HeadDataItem(0.000, '{:>10}', 18, 0, dtype=dt.FLOAT, dps=3),
            'bl': HeadDataItem(0.000, '{:>10}', 18, 1, dtype=dt.FLOAT, dps=3),
            'br_dcf': HeadDataItem(0.000, '{:>10}', 18, 2, dtype=dt.FLOAT, dps=3),
            'br': HeadDataItem(0.000, '{:>10}', 18, 3, dtype=dt.FLOAT, dps=3),
            'bf0': HeadDataItem(0.000, '{:>10}', 18, 4, dtype=dt.FLOAT, dps=3),
        }
        
        dobjs = [
            # update_callback is called every time a value is added or updated
            do.FloatData(rdt.RAIN, format_str='{:>10}', default=0, no_of_dps=3)
        ]
        dummy_row = {rdt.RAIN: 0}
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.RAIN: 0})
Exemple #27
0
    def __init__(self, **kwargs):
        """Constructor.
        """
        AUnit.__init__(self, **kwargs)

        self._unit_type = RefhUnit.UNIT_TYPE
        self._unit_category = RefhUnit.UNIT_CATEGORY
        #         self.row_data['main'] = []
        if self._name == 'unknown': self._name = 'Refh_unit'

        # Fill in the header values these contain the data at the top of the
        # section, such as the unit name and labels.
        self.head_data = {
            'revision':
            HeadDataItem(1, '{:<1}', 0, 0, dtype=dt.INT),
            'comment':
            HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'z':
            HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'easting':
            HeadDataItem('', '{:>10}', 2, 1, dtype=dt.STRING),
            'northing':
            HeadDataItem('', '{:>10}', 2, 2, dtype=dt.STRING),
            'time_delay':
            HeadDataItem(0.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
            'time_step':
            HeadDataItem(1.0, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=1),
            'bf_only':
            HeadDataItem('', '{:>10}', 3, 2, dtype=dt.STRING),
            'sc_flag':
            HeadDataItem('SCALEFACT',
                         '{:<10}',
                         3,
                         3,
                         dtype=dt.CONSTANT,
                         choices=('SCALEFACT', 'PEAKVALUE')),
            'scale_factor':
            HeadDataItem(1.000, '{:>10}', 3, 4, dtype=dt.FLOAT, dps=3),
            'hydrograph_mode':
            HeadDataItem('HYDROGRAPH',
                         '{:>10}',
                         3,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('HYDROGRAPH', 'HYETOGRAPH')),
            'hydrograph_scaling':
            HeadDataItem('RUNOFF',
                         '{:>10}',
                         3,
                         6,
                         dtype=dt.CONSTANT,
                         choices=('RUNOFF', 'FULL')),
            'min_flow':
            HeadDataItem(1.000, '{:>10}', 3, 7, dtype=dt.FLOAT, dps=3),
            'catchment_area':
            HeadDataItem(0.00, '{:>10}', 4, 0, dtype=dt.FLOAT, dps=2),
            'saar':
            HeadDataItem(0, '{:>10}', 4, 1, dtype=dt.INT),
            'urbext':
            HeadDataItem(0.000, '{:>10}', 4, 2, dtype=dt.FLOAT, dps=3),
            'season':
            HeadDataItem('DEFAULT',
                         '{:>10}',
                         4,
                         3,
                         dtype=dt.CONSTANT,
                         choices=('DEFAULT', 'WINTER', 'SUMMER')),
            'published_report':
            HeadDataItem('DLL',
                         '{:>10}',
                         4,
                         4,
                         dtype=dt.CONSTANT,
                         choices=('DLL', 'REPORT')),

            # Urban - only used if 'urban' == 'URBANREFH'
            'urban':
            HeadDataItem('',
                         '{:>10}',
                         4,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('', 'URBANREFH')),
            'subarea_1':
            HeadDataItem(0.00, '{:>10}', 5, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_1':
            HeadDataItem(0.000, '{:>10}', 5, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_1':
            HeadDataItem(0.000, '{:>10}', 5, 2, dtype=dt.FLOAT, dps=3),
            'calibration_1':
            HeadDataItem(0.000, '{:>10}', 5, 3, dtype=dt.FLOAT, dps=3),
            'subarea_2':
            HeadDataItem(0.00, '{:>10}', 6, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_2':
            HeadDataItem(0.000, '{:>10}', 6, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_2':
            HeadDataItem(0.000, '{:>10}', 6, 2, dtype=dt.FLOAT, dps=3),
            'calibration_2':
            HeadDataItem(0.000, '{:>10}', 6, 3, dtype=dt.FLOAT, dps=3),
            'subrunoff_2':
            HeadDataItem(0.000, '{:>10}', 6, 4, dtype=dt.FLOAT, dps=3),
            'sewer_rp_2':
            HeadDataItem('RUNOFF',
                         '{:>10}',
                         6,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('RUNOFF', 'DEPTH')),
            'sewer_depth_2':
            HeadDataItem(0.000, '{:>10}', 6, 6, dtype=dt.FLOAT, dps=3),
            'sewer_lossvolume_2':
            HeadDataItem('VOLUME',
                         '{:>10}',
                         6,
                         7,
                         dtype=dt.CONSTANT,
                         choices=('VOLUME', 'FLOW')),
            'subarea_3':
            HeadDataItem(0.00, '{:>10}', 7, 0, dtype=dt.FLOAT, dps=2),
            'dplbar_3':
            HeadDataItem(0.000, '{:>10}', 7, 1, dtype=dt.FLOAT, dps=3),
            'suburbext_3':
            HeadDataItem(0.000, '{:>10}', 7, 2, dtype=dt.FLOAT, dps=3),
            'calibration_3':
            HeadDataItem(0.000, '{:>10}', 7, 3, dtype=dt.FLOAT, dps=3),
            'subrunoff_3':
            HeadDataItem(0.000, '{:>10}', 7, 4, dtype=dt.FLOAT, dps=3),
            'storm_area':
            HeadDataItem(0.00, '{:>10}', 8, 0, dtype=dt.FLOAT, dps=2),
            'storm_duration':
            HeadDataItem(0.000, '{:>10}', 8, 1, dtype=dt.FLOAT, dps=3),
            'sn_rate':
            HeadDataItem(0.000, '{:>10}', 8, 2, dtype=dt.FLOAT, dps=3),
            'rainfall_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         9,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'arf_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         9,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'rainfall_comment':
            HeadDataItem('', '', 9, 2, dtype=dt.STRING),
            'rainfall_odepth':
            HeadDataItem(0.000, '{:>10}', 10, 0, dtype=dt.FLOAT, dps=3),
            'return_period':
            HeadDataItem(0, '{:>10}', 10, 1, dtype=dt.INT),
            'arf':
            HeadDataItem(0.000, '{:>10}', 10, 2, dtype=dt.FLOAT, dps=3),
            'c':
            HeadDataItem(0.000, '{:>10}', 10, 3, dtype=dt.FLOAT, dps=3),
            'd1':
            HeadDataItem(0.000, '{:>10}', 10, 4, dtype=dt.FLOAT, dps=3),
            'd2':
            HeadDataItem(0.000, '{:>10}', 10, 5, dtype=dt.FLOAT, dps=3),
            'd2':
            HeadDataItem(0.000, '{:>10}', 10, 6, dtype=dt.FLOAT, dps=3),
            'd3':
            HeadDataItem(0.000, '{:>10}', 10, 7, dtype=dt.FLOAT, dps=3),
            'e':
            HeadDataItem(0.000, '{:>10}', 10, 8, dtype=dt.FLOAT, dps=3),
            'f':
            HeadDataItem(0.000, '{:>10}', 10, 9, dtype=dt.FLOAT, dps=3),
            'rp_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         11,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'scf_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         11,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'scf':
            HeadDataItem(0.000, '{:>10}', 11, 2, dtype=dt.FLOAT, dps=3),
            'use_refined_rainfall':
            HeadDataItem('0',
                         '{:>10}',
                         11,
                         3,
                         dtype=dt.CONSTANT,
                         choices=('0', '1')),
            'cmax_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         12,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'cini_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         12,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'alpha_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         12,
                         2,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'models_comment':
            HeadDataItem('', '{}', 12, 3, dtype=dt.STRING),
            'cm_dcf':
            HeadDataItem(0.000, '{:>10}', 13, 0, dtype=dt.FLOAT, dps=3),
            'cmax':
            HeadDataItem(0.000, '{:>10}', 13, 1, dtype=dt.FLOAT, dps=3),
            'cini':
            HeadDataItem(0.000, '{:>10}', 13, 2, dtype=dt.FLOAT, dps=3),
            'alpha':
            HeadDataItem(0.000, '{:>10}', 13, 3, dtype=dt.FLOAT, dps=3),
            'bfihost':
            HeadDataItem(0.000, '{:>10}', 13, 4, dtype=dt.FLOAT, dps=3),
            'uh_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         14,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'tp_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         14,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'up_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         14,
                         3,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'uk_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         14,
                         4,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'tp_dcf':
            HeadDataItem(0.000, '{:>10}', 15, 0, dtype=dt.FLOAT, dps=3),
            'tp0':
            HeadDataItem(0.000, '{:>10}', 15, 1, dtype=dt.FLOAT, dps=3),
            'tpt':
            HeadDataItem(0.000, '{:>10}', 15, 2, dtype=dt.FLOAT, dps=3),
            'dplbar':
            HeadDataItem(0.000, '{:>10}', 15, 3, dtype=dt.FLOAT, dps=3),
            'dpsbar':
            HeadDataItem(0.000, '{:>10}', 15, 4, dtype=dt.FLOAT, dps=3),
            'propwet':
            HeadDataItem(0.000, '{:>10}', 15, 5, dtype=dt.FLOAT, dps=3),
            'up':
            HeadDataItem(0.000, '{:>10}', 15, 6, dtype=dt.FLOAT, dps=3),
            'uk':
            HeadDataItem(0.000, '{:>10}', 15, 7, dtype=dt.FLOAT, dps=3),
            'uh_rows':
            HeadDataItem(0.000, '{:>10}', 16, 0, dtype=dt.INT),
            #             'uh_units': HeadDataItem(0.000, '{:>10}', 14, 9, dtype=dt.INT),        # TODO: Find out what the deal with these is
            #             'uh_fct': HeadDataItem(0.000, '{:>10}', 14, 10, dtype=dt.FLOAT, dps=3),
            'bl_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         17,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'br_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         17,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'br0_flag':
            HeadDataItem('DESIGN',
                         '{:>10}',
                         17,
                         2,
                         dtype=dt.CONSTANT,
                         choices=('DESIGN', 'USER')),
            'bl_dcf':
            HeadDataItem(0.000, '{:>10}', 18, 0, dtype=dt.FLOAT, dps=3),
            'bl':
            HeadDataItem(0.000, '{:>10}', 18, 1, dtype=dt.FLOAT, dps=3),
            'br_dcf':
            HeadDataItem(0.000, '{:>10}', 18, 2, dtype=dt.FLOAT, dps=3),
            'br':
            HeadDataItem(0.000, '{:>10}', 18, 3, dtype=dt.FLOAT, dps=3),
            'bf0':
            HeadDataItem(0.000, '{:>10}', 18, 4, dtype=dt.FLOAT, dps=3),
        }

        dobjs = [
            # update_callback is called every time a value is added or updated
            do.FloatData(rdt.RAIN, format_str='{:>10}', default=0, no_of_dps=3)
        ]
        dummy_row = {rdt.RAIN: 0}
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.RAIN: 0})