Ejemplo n.º 1
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})
Ejemplo n.º 2
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})
Ejemplo n.º 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)
Ejemplo n.º 4
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()
Ejemplo n.º 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})
Ejemplo n.º 6
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"
Ejemplo n.º 7
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)
Ejemplo n.º 8
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),
        }
Ejemplo n.º 9
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),
        }
Ejemplo n.º 10
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),
     }
Ejemplo n.º 11
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})
Ejemplo n.º 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)
Ejemplo n.º 13
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),
        }
Ejemplo n.º 14
0
 def __init__(self):
     '''Constructor.
     '''
     AUnit.__init__(self)
     self._unit_type = CulvertUnit.UNIT_TYPE
     self._unit_category = CulvertUnit.UNIT_CATEGORY
Ejemplo n.º 15
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})
Ejemplo n.º 16
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})