Example #1
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
        })
Example #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})
Example #3
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 (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)
Example #4
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})
Example #5
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})
Example #6
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})
Example #7
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})
Example #8
0
    def __init__(self, **kwargs): 
        """Constructor.
        
        See Also:
            BridgeUnit
        """
        BridgeUnit.__init__(self, **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),
            '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),
            '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')),
            'pier_shape_2': HeadDataItem('', '{:<10}', 6, 2, dtype=dt.CONSTANT, choices=('FLAT', 'ARCH'), 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})
Example #9
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})
Example #10
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})
Example #11
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})
Example #12
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})