示例#1
0
    def __init__(self):
        super(CulvertUnitOutlet, self).__init__()
        self._unit_type = CulvertUnitOutlet.UNIT_TYPE
        self._unit_category = CulvertUnitOutlet.UNIT_CATEGORY

        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 0, dtype=dt.STRING),
            'loss_coef':
            HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=3),
            'headloss_type':
            HeadDataItem('STATIC',
                         '{:>10}',
                         2,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('STATIC', 'TOTAL')),
            'reverse_flow_model':
            HeadDataItem('CALCULATED',
                         '{:<10}',
                         2,
                         2,
                         dtype=dt.CONSTANT,
                         choices=('CALCULATED', 'ZERO')),
        }
示例#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})
示例#3
0
    def __init__(self):
        '''Constructor.

        Args:
            file_order (int): the order of this unit in the .dat file.
        '''
        super(InterpolateUnit, self).__init__()
        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),
        }
示例#4
0
    def __init__(self, **kwargs):
        """Constructor.

        Args:
            fileOrder (int): The location of this unit in the file.
        """
        super(ReservoirUnit, self).__init__(**kwargs)

        self._name = 'Res'
        self.head_data = {
            'revision':
            HeadDataItem(0, '{:<1}', 0, 0, dtype=dt.INT, allow_blank=True),
            'comment':
            HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'easting':
            HeadDataItem(0.000, '{:>10}', 1, 0, dtype=dt.FLOAT, dps=3),
            'northing':
            HeadDataItem(0.000, '{:>10}', 1, 1, dtype=dt.FLOAT, dps=3),
            'runoff_factor':
            HeadDataItem(0.000, '{:>10}', 1, 2, dtype=dt.FLOAT, dps=3),
            'lateral1':
            HeadDataItem('', '{:<12}', 2, 0, dtype=dt.STRING),
            'lateral2':
            HeadDataItem('', '{:<12}', 2, 1, dtype=dt.STRING),
            'lateral3':
            HeadDataItem('', '{:<12}', 2, 2, dtype=dt.STRING),
            'lateral4':
            HeadDataItem('', '{:<12}', 2, 3, dtype=dt.STRING),
            'names': []
        }

        self._unit_type = ReservoirUnit.UNIT_TYPE
        self._unit_category = ReservoirUnit.UNIT_CATEGORY

        dobjs = [
            do.FloatData(rdt.ELEVATION,
                         format_str='{:>10}',
                         no_of_dps=3,
                         use_sn=1000000,
                         update_callback=self.checkIncreases),
            do.FloatData(rdt.AREA,
                         format_str='{:>10}',
                         no_of_dps=3,
                         use_sn=1000000,
                         update_callback=self.checkIncreases),
        ]
        self.row_data['main'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['main'].setDummyRow({rdt.ELEVATION: 0, rdt.AREA: 0})
示例#5
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})
示例#6
0
    def __init__(self):
        '''Constructor.

        Args:
            file_order (int): the order of this unit in the .dat file.
        '''
        super(JunctionUnit, self).__init__()
        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)
示例#7
0
    def __init__(self, **kwargs):
        """Constructor.
        """
        super(RefhUnit, self).__init__(**kwargs)

        self._unit_type = RefhUnit.UNIT_TYPE
        self._unit_category = RefhUnit.UNIT_CATEGORY
        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=3),
            '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=3),
            'saar':
            HeadDataItem(0, '{:>10}', 4, 1, dtype=dt.INT),
            'urbext':
            HeadDataItem(0.000, '{:>10}', 4, 2, dtype=dt.FLOAT, dps=5),
            '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'
            # Note: urban involves updating the revision number and published_report as well.
            #       if you want to set it to urban you should use useUrban(True) rather than
            #       set this directly (or useUrban(False) to deactivate it).
            '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('RETURN',
                         '{:>10}',
                         6,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('RETURN', '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=5),
            'c':
            HeadDataItem(0.000, '{:>10}', 10, 3, dtype=dt.FLOAT, dps=5),
            'd1':
            HeadDataItem(0.000, '{:>10}', 10, 4, dtype=dt.FLOAT, dps=5),
            'd2':
            HeadDataItem(0.000, '{:>10}', 10, 5, dtype=dt.FLOAT, dps=5),
            'd2':
            HeadDataItem(0.000, '{:>10}', 10, 6, dtype=dt.FLOAT, dps=5),
            'd3':
            HeadDataItem(0.000, '{:>10}', 10, 7, dtype=dt.FLOAT, dps=5),
            'e':
            HeadDataItem(0.000, '{:>10}', 10, 8, dtype=dt.FLOAT, dps=5),
            'f':
            HeadDataItem(0.000, '{:>10}', 10, 9, dtype=dt.FLOAT, dps=5),
            '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=5),
            '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')),
            'bf0_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})
示例#8
0
 def __init__(self, **kwargs):
     '''Constructor.
     '''
     CulvertUnit.__init__(self, **kwargs)
     self._unit_type = CulvertUnitInlet.UNIT_TYPE
     self._unit_category = CulvertUnitInlet.UNIT_CATEGORY
     
     self.head_data = {
         'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING),
         'k': HeadDataItem(0.000, '{:>10}', 2, 0, dtype=dt.FLOAT, dps=4),
         'm': HeadDataItem(0.000, '{:>10}', 2, 1, dtype=dt.FLOAT, dps=3),
         'c': HeadDataItem(0.000, '{:>10}', 2, 2, dtype=dt.FLOAT, dps=4),
         'y': HeadDataItem(0.000, '{:>10}', 2, 3, dtype=dt.FLOAT, dps=3),
         'ki': HeadDataItem(0.000, '{:>10}', 2, 4, dtype=dt.FLOAT, dps=3),
         'conduit_type': HeadDataItem('A', '{:>10}', 2, 5, dtype=dt.CONSTANT, choices=('A', 'B', 'C')),
         'screen_width': HeadDataItem(0.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
         'bar_proportion': HeadDataItem(0.000, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=3),
         'debris_proportion': HeadDataItem(0.000, '{:>10}', 3, 2, dtype=dt.FLOAT, dps=3),
         'loss_coef': HeadDataItem(0.000, '{:>10}', 3, 3, dtype=dt.FLOAT, dps=3),
         'trashscreen_height': HeadDataItem(0.000, '{:>10}', 3, 4, dtype=dt.FLOAT, dps=3),
         'headloss_type': HeadDataItem('STATIC', '{:>10}', 3, 5, dtype=dt.CONSTANT, choices=('STATIC', 'TOTAL')),
         'reverse_flow_model': HeadDataItem('CALCULATED', '{:<10}', 3, 6, dtype=dt.CONSTANT, choices=('CALCULATED', 'ZERO')),
     }    
示例#9
0
    def __init__(self, **kwargs):
        """Constructor.

        Args:
            fileOrder (int): The location of this unit in the file.
        """
        super(HtbdyUnit, self).__init__(**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})
示例#10
0
    def __init__(self, **kwargs):
        '''Constructor.
        '''
        super(OrificeUnit, self).__init__(**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),
        }
示例#11
0
    def __init__(self, **kwargs):
        """Constructor.

        See Also:
            BridgeUnit
        """
        super(BridgeUnitArch, self).__init__(**kwargs)

        self._unit_type = BridgeUnitArch.UNIT_TYPE
        self._unit_category = BridgeUnit.UNIT_CATEGORY

        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'remote_us':
            HeadDataItem('', '{:<12}', 2, 2, dtype=dt.STRING),
            'remote_ds':
            HeadDataItem('', '{:<12}', 2, 3, dtype=dt.STRING),
            'roughness_type':
            HeadDataItem('MANNING',
                         '{:<8}',
                         3,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('MANNING', )),
            'calibration_coef':
            HeadDataItem(1.000, '{:>10}', 4, 0, dtype=dt.FLOAT, dps=3),
            'skew_angle':
            HeadDataItem(0.000, '{:>10}', 4, 1, dtype=dt.FLOAT, dps=3),
            'width':
            HeadDataItem(0.000, '{:>10}', 4, 2, dtype=dt.FLOAT, dps=3),
            'dual_distance':
            HeadDataItem(0.000, '{:>10}', 4, 3, dtype=dt.FLOAT, dps=3),
            'num_of_orifices':
            HeadDataItem(0, '{:>10}', 4, 4, dtype=dt.INT),
            'orifice_flag':
            HeadDataItem('',
                         '{:>10}',
                         4,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('', 'ORIFICE')),
            'op_lower':
            HeadDataItem(0.000, '{:>10}', 4, 6, dtype=dt.FLOAT, dps=3),
            'op_upper':
            HeadDataItem(0.000, '{:>10}', 4, 7, dtype=dt.FLOAT, dps=3),
            'op_cd':
            HeadDataItem(0.000, '{:>10}', 4, 8, dtype=dt.FLOAT, dps=3),
        }
示例#12
0
    def __init__(self, **kwargs):
        """Constructor.

        See Also:
            BridgeUnit
        """
        super(BridgeUnitUsbpr, self).__init__(**kwargs)

        self._unit_type = BridgeUnitUsbpr.UNIT_TYPE
        self._unit_category = BridgeUnit.UNIT_CATEGORY

        # Fill in the header values these contain the data at the top of the
        # section
        self.head_data = {
            'comment':
            HeadDataItem('', '', 0, 1, dtype=dt.STRING),
            'remote_us':
            HeadDataItem('', '{:<12}', 2, 2, dtype=dt.STRING),
            'remote_ds':
            HeadDataItem('', '{:<12}', 2, 3, dtype=dt.STRING),
            'roughness_type':
            HeadDataItem('MANNING',
                         '{:<7}',
                         3,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('MANNING', )),
            'calibration_coef':
            HeadDataItem(1.000, '{:>10}', 4, 0, dtype=dt.FLOAT, dps=3),
            'skew_angle':
            HeadDataItem(0.000, '{:>10}', 4, 1, dtype=dt.FLOAT, dps=3),
            'width':
            HeadDataItem(0.000, '{:>10}', 4, 2, dtype=dt.FLOAT, dps=3),
            'dual_distance':
            HeadDataItem(0.000, '{:>10}', 4, 3, dtype=dt.FLOAT, dps=3),
            'pier_width':
            HeadDataItem(0, '{:>10}', 4, 4, dtype=dt.FLOAT),
            'orifice_flag':
            HeadDataItem('',
                         '{:>10}',
                         4,
                         5,
                         dtype=dt.CONSTANT,
                         choices=('', 'ORIFICE')),
            'op_lower':
            HeadDataItem(0.000, '{:>10}', 4, 6, dtype=dt.FLOAT, dps=3),
            'op_upper':
            HeadDataItem(0.000, '{:>10}', 4, 7, dtype=dt.FLOAT, dps=3),
            'op_cd':
            HeadDataItem(0.000, '{:>10}', 4, 8, dtype=dt.FLOAT, dps=3),
            'abutment_type':
            HeadDataItem('3',
                         '{:>10}',
                         5,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('1', '2', '3')),
            'num_of_piers':
            HeadDataItem(0, '{:>10}', 6, 0, dtype=dt.INT),
            'pier_shape':
            HeadDataItem('FLAT',
                         '{:<10}',
                         6,
                         1,
                         dtype=dt.CONSTANT,
                         choices=('FLAT', 'ARCH', 'CYLINDER', 'RECTANGLE',
                                  'SQUARE', 'IBEAM')),
            'pier_shape_2':
            HeadDataItem('',
                         '{:<10}',
                         6,
                         2,
                         dtype=dt.CONSTANT,
                         choices=('STREAMLINE', 'SEMICIRCLE', 'TRIANGLE',
                                  'DIAPHRAGM'),
                         allow_blank=True),
            'pier_calibration_coef':
            HeadDataItem('',
                         '{:>10}',
                         6,
                         3,
                         dtype=dt.FLOAT,
                         dps=3,
                         allow_blank=True),
            'abutment_align':
            HeadDataItem('ALIGNED',
                         '{:>10}',
                         7,
                         0,
                         dtype=dt.CONSTANT,
                         choices=('ALIGNED', 'SKEW')),
        }

        # Add an culvert RowCollection to self.row_data dict
        dobjs = [
            do.FloatData(rdt.INVERT, format_str='{:>10}', no_of_dps=3),
            do.FloatData(rdt.SOFFIT, format_str='{:>10}', no_of_dps=3),
            do.FloatData(rdt.AREA,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=0.0),
            do.FloatData(rdt.CD_PART,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=1.0),
            do.FloatData(rdt.CD_FULL,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=1.0),
            do.FloatData(rdt.DROWNING,
                         format_str='{:>10}',
                         no_of_dps=3,
                         default=1.0),
        ]
        self.row_data['culvert'] = RowDataCollection.bulkInitCollection(dobjs)
        self.row_data['culvert'].setDummyRow({rdt.INVERT: 0, rdt.SOFFIT: 0})
示例#13
0
    def readUnitData(self, unit_data, file_line):
        """Reads the given data into the object.

        Args:
            unit_data (list): The raw file data to be processed.
        """
        self.head_data = {
            'name':
            HeadDataItem(unit_data[0].strip(), '', 0, 0, dtype=dt.STRING),
            'revision':
            HeadDataItem(unit_data[1].strip(), '{:>10}', 1, 0,
                         dtype=dt.STRING),
            'node_count':
            HeadDataItem(unit_data[2][:10].strip(),
                         '{:>10}',
                         2,
                         0,
                         dtype=dt.INT),
            'fr_lower':
            HeadDataItem(unit_data[2][10:20].strip(),
                         '{:>10}',
                         2,
                         1,
                         dtype=dt.FLOAT,
                         dps=3),
            'fr_upper':
            HeadDataItem(unit_data[2][20:30].strip(),
                         '{:>10}',
                         2,
                         2,
                         dtype=dt.FLOAT,
                         dps=3),
            'min_depth':
            HeadDataItem(unit_data[2][30:40].strip(),
                         '{:>10}',
                         2,
                         3,
                         dtype=dt.FLOAT,
                         dps=3),
            'direct_method':
            HeadDataItem(unit_data[2][40:50].strip(),
                         '{:>10}',
                         2,
                         4,
                         dtype=dt.FLOAT,
                         dps=3),
            'unknown':
            HeadDataItem(unit_data[2][50:60].strip(),
                         '{:>10}',
                         2,
                         5,
                         dtype=dt.STRING),
            'water_temp':
            HeadDataItem(unit_data[3][:10].strip(),
                         '{:>10}',
                         3,
                         0,
                         dtype=dt.FLOAT,
                         dps=3),
            'flow':
            HeadDataItem(unit_data[3][10:20].strip(),
                         '{:>10}',
                         3,
                         1,
                         dtype=dt.FLOAT,
                         dps=3),
            'head':
            HeadDataItem(unit_data[3][20:30].strip(),
                         '{:>10}',
                         3,
                         2,
                         dtype=dt.FLOAT,
                         dps=3),
            'math_damp':
            HeadDataItem(unit_data[3][30:40].strip(),
                         '{:>10}',
                         3,
                         3,
                         dtype=dt.FLOAT,
                         dps=3),
            'pivot':
            HeadDataItem(unit_data[3][40:50].strip(),
                         '{:>10}',
                         3,
                         4,
                         dtype=dt.FLOAT,
                         dps=3),
            'relax':
            HeadDataItem(unit_data[3][50:60].strip(),
                         '{:>10}',
                         3,
                         5,
                         dtype=dt.FLOAT,
                         dps=3),
            'dummy':
            HeadDataItem(unit_data[3][60:70].strip(),
                         '{:>10}',
                         3,
                         6,
                         dtype=dt.FLOAT,
                         dps=3),
            'roughness':
            HeadDataItem(unit_data[5].strip(), '{:>10}', 5, 0,
                         dtype=dt.STRING),
        }

        return file_line + 7
示例#14
0
 def __init__(self, **kwargs):
     """Constructor.
     """
     super(HeaderUnit, self).__init__(**kwargs)
     self._unit_type = HeaderUnit.UNIT_TYPE
     self._unit_category = HeaderUnit.UNIT_CATEGORY
     self._name = 'header'
     self.head_data = {
         'name':
         HeadDataItem('', '', 0, 0, dtype=dt.STRING),
         'revision':
         HeadDataItem('#REVISION#1', '{:>10}', 1, 0, dtype=dt.STRING),
         'node_count':
         HeadDataItem(0, '{:>10}', 2, 0, dtype=dt.INT),
         'fr_lower':
         HeadDataItem(0.750, '{:>10}', 2, 1, dtype=dt.FLOAT, dps=3),
         'fr_upper':
         HeadDataItem(0.900, '{:>10}', 2, 2, dtype=dt.FLOAT, dps=3),
         'min_depth':
         HeadDataItem(0.100, '{:>10}', 2, 3, dtype=dt.FLOAT, dps=3),
         'direct_method':
         HeadDataItem(0.001, '{:>10}', 2, 4, dtype=dt.FLOAT, dps=3),
         'unknown':
         HeadDataItem('12', '{:>10}', 2, 5, dtype=dt.STRING),
         'water_temp':
         HeadDataItem(10.000, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3),
         'flow':
         HeadDataItem(0.010, '{:>10}', 3, 1, dtype=dt.FLOAT, dps=3),
         'head':
         HeadDataItem(0.010, '{:>10}', 3, 2, dtype=dt.FLOAT, dps=3),
         'math_damp':
         HeadDataItem(0.700, '{:>10}', 3, 3, dtype=dt.FLOAT, dps=3),
         'pivot':
         HeadDataItem(0.100, '{:>10}', 3, 4, dtype=dt.FLOAT, dps=3),
         'relax':
         HeadDataItem(0.700, '{:>10}', 3, 5, dtype=dt.FLOAT, dps=3),
         'dummy':
         HeadDataItem(0.000, '{:>10}', 3, 6, dtype=dt.FLOAT, dps=3),
         'roughness':
         HeadDataItem('', '{:>10}', 5, 0, dtype=dt.STRING),
     }