Exemple #1
0
 def setUp(self):
      
     self.flt = do.FloatData(rdt.CHAINAGE, format_str='{:>10}', no_of_dps=3)
     self.sym = do.SymbolData(rdt.PANEL_MARKER, '*', format_str='{:<5}', default=False)
     self.con = do.ConstantData(rdt.BANKMARKER, ('', 'LEFT', 'RIGHT', 'BED'), format_str='{:<10}', default='')
     self.con_nodefault = do.ConstantData(rdt.BANKMARKER, ('', 'LEFT', 'RIGHT', 'BED'), format_str='{:<10}')
     self.txt = do.StringData(rdt.SPECIAL, format_str='{:<10}', default='~')
      
     self.data_objects = [self.flt, self.sym, self.con, self.txt] 
Exemple #2
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 #3
0
    def setupRowData(self):
        """Setup the main geometry and opening RowCollection's.

        These are used by all BridgeUnits, but they're added to a method called
        by the constructor in cases anyone need to override them.
        """
        main_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.ROUGHNESS,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=0.039),
            do.ConstantData(rdt.EMBANKMENT, ('', 'L', 'R'),
                            format_str='{:>11}',
                            default=''),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(
            main_dobjs)
        self.row_data['main'].setDummyRow({
            rdt.CHAINAGE: 0,
            rdt.ELEVATION: 0,
            rdt.ROUGHNESS: 0
        })

        open_dobjs = [
            do.FloatData(rdt.OPEN_START,
                         format_str='{:>10}',
                         no_of_dps=3,
                         update_callback=self.checkOpening),
            do.FloatData(rdt.OPEN_END,
                         format_str='{:>10}',
                         no_of_dps=3,
                         update_callback=self.checkOpening),
            do.FloatData(rdt.SPRINGING_LEVEL,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=0.0),
            do.FloatData(rdt.SOFFIT_LEVEL,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=0.0),
        ]
        self.row_data['opening'] = RowDataCollection.bulkInitCollection(
            open_dobjs)
        self.row_data['opening'].setDummyRow({
            rdt.OPEN_START: 0,
            rdt.OPEN_END: 0
        })