예제 #1
0
 def read_section(self, project, section_name, section_text):
     section_name_upper = section_name.upper()
     if section_name_upper == project.infiltration.SECTION_NAME.upper():
         infiltration = project.options.infiltration.upper()
         if infiltration == "HORTON":
             self.read_infiltration = SectionReaderAsList(section_name, HortonInfiltrationReader)
         elif infiltration.startswith("GREEN"):
             self.read_infiltration = SectionReaderAsList(section_name, GreenAmptInfiltrationReader)
         elif infiltration.startswith("CURVE"):
             self.read_infiltration = SectionReaderAsList(section_name, CurveNumberInfiltrationReader)
     elif section_name_upper == "[SUBAREAS]":
         self.defer_subareas = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[COORDINATES]":
         self.defer_coordinates = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[SYMBOLS]":
         self.defer_symbols = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[TAGS]":
         self.defer_tags = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[LOSSES]":
         self.defer_losses = section_text
         return
     elif section_name_upper == "[VERTICES]":
         self.defer_vertices = section_text
         return
     elif section_name_upper == "[POLYGONS]":
         self.defer_polygons = section_text
         return
     InputFileReader.read_section(self, project, section_name, section_text)
예제 #2
0
    def __init__(self):
        """Initialize the sections of an EPANET input file.
           Any sections not initialized here will be handled by the generic core.project_base.Section class."""
        self.read_title = TitleReader()
        self.read_junctions = SectionReaderAsList("[JUNCTIONS]", JunctionReader)
        self.read_reservoirs = SectionReaderAsList("[RESERVOIRS]", ReservoirReader)
        self.read_tanks = SectionReaderAsList("[TANKS]", TankReader)
        self.read_pipes = SectionReaderAsList("[PIPES]", PipeReader)
        self.read_pumps = SectionReaderAsList("[PUMPS]", PumpReader)
        self.read_valves = SectionReaderAsList("[VALVES]", ValveReader)
        self.read_patterns = SectionReaderAsListGroupByID("[PATTERNS]", PatternReader)
        self.read_curves = SectionReaderAsListGroupByID("[CURVES]", CurveReader)
        self.read_energy = EnergyOptionsReader()
        self.read_status = SectionReaderAsList("[STATUS]", StatusReader)
        self.read_controls = ControlReader()
        self.read_rules = RuleReader()
        self.read_demands = SectionReaderAsList("[DEMANDS]", DemandReader)
        self.read_reactions = ReactionsReader()
        self.read_sources = SectionReaderAsList("[SOURCES]", SourceReader)
        # self.read_options = MapOptions,
        self.read_options = OptionsReader()
        self.read_times = TimesOptionsReader()
        self.read_report = ReportOptionsReader()
        self.read_labels = SectionReaderAsList("[LABELS]", LabelReader)
        self.read_backdrop = BackdropOptionsReader()

        # temporary storage for sections that need to be read after other sections
        self.defer_quality = None
        self.defer_coordinates = None
        self.defer_vertices = None
        self.defer_tags = None
        self.defer_mixing = None
        self.defer_emitters = None
예제 #3
0
    def __init__(self):
        """Define the fields of a SWMM Project by creating an empty placeholder for each section"""

        self.read_title = TitleReader()               # TITLE         project title
        self.read_options = GeneralReader()           # OPTIONS       analysis options
        self.read_report = ReportReader()             # REPORT        output reporting instructions
        self.read_files = SectionReader()             # FILES         interface file options
        self.read_files.SECTION_NAME = "[FILES]"
        self.read_files.section_type = Files
        self.read_backdrop = BackdropOptionsReader()  # BACKDROP      bounding rectangle and file name of backdrop image
        self.read_map = MapOptionsReader()            # MAP           map's bounding rectangle and units
        self.read_raingages = SectionReaderAsList("[RAINGAGES]", RainGageReader)

        self.read_hydrographs = SectionReaderAsListGroupByID("[HYDROGRAPHS]", UnitHydrographReader)
        # unit hydrograph data used to construct RDII inflows

        self.read_evaporation = EvaporationReader()   # EVAPORATION   evaporation data
        self.read_temperature = TemperatureReader()   # TEMPERATURE   air temperature and snow melt data
        self.read_adjustments = AdjustmentsReader()   # ADJUSTMENTS   monthly climate adjustments
        self.read_subcatchments = SectionReaderAsList("[SUBCATCHMENTS]", SubcatchmentReader)
        # basic subcatchment information

        self.read_infiltration = SectionReaderAsList("[INFILTRATION]", None)
        # This is set to SectionReaderAsListOf HortonInfiltration or GreenAmptInfiltration or CurveNumberInfiltration
        # below in read_section based on subcatchment infiltration parameters

        self.read_lid_controls = SectionReaderAsListGroupByID("[LID_CONTROLS]", LIDControlReader)
        # low impact development control information

        self.read_lid_usage = SectionReaderAsList("[LID_USAGE]", LIDUsageReader)
        # assignment of LID controls to subcatchments

        self.read_aquifers = SectionReaderAsList("[AQUIFERS]", AquiferReader)
        # groundwater aquifer parameters

        self.read_groundwater = SectionReaderAsList("[GROUNDWATER]", GroundwaterReader)
        # subcatchment groundwater parameters

        self.read_snowpacks = SectionReaderAsListGroupByID("[SNOWPACKS]", SnowPackReader)
        # subcatchment snow pack parameters

        self.read_junctions = SectionReaderAsList("[JUNCTIONS]", JunctionReader)
        # junction node information

        self.read_outfalls = SectionReaderAsList("[OUTFALLS]", OutfallReader)
        #  outfall node information

        self.read_dividers = SectionReaderAsList("[DIVIDERS]", DividerReader)
        #  flow divider node information

        self.read_storage = SectionReaderAsList("[STORAGE]", StorageReader)
        #  storage node information

        self.read_conduits = SectionReaderAsList("[CONDUITS]", ConduitReader)
        # conduit link information

        self.read_pumps = SectionReaderAsList("[PUMPS]", PumpReader)
        # pump link information

        self.read_orifices = SectionReaderAsList("[ORIFICES]", OrificeReader)
        # orifice link information

        self.read_weirs = SectionReaderAsList("[WEIRS]", WeirReader)
        # weir link information

        self.read_outlets = SectionReaderAsList("[OUTLETS]", OutletReader)
        # outlet link information

        self.read_xsections = SectionReaderAsList("[XSECTIONS]", CrossSectionReader)
        # conduit, orifice, and weir cross-section geometry

        self.read_transects = TransectsReader()
        # transect geometry for conduits with irregular cross-sections

        self.read_controls = ControlsReader()
        # rules that control pump and regulator operation

        self.read_landuses = SectionReaderAsList("[LANDUSES]", LanduseReader)
        # land use categories

        self.read_buildup = SectionReaderAsList("[BUILDUP]", BuildupReader)
        # buildup functions for pollutants and land uses

        self.read_washoff = SectionReaderAsList("[WASHOFF]", WashoffReader)
        # washoff functions for pollutants and land uses

        self.read_pollutants = SectionReaderAsList("[POLLUTANTS]", PollutantReader)
        # pollutant information

        self.read_coverages = CoveragesReader() # COVERAGES # assignment of land uses to subcatchments
        self.read_treatment = SectionReaderAsList("[TREATMENT]", TreatmentReader)

        # pollutant removal functions at conveyance system nodes

        self.read_inflows = SectionReaderAsList("[INFLOWS]", DirectInflowReader)
        # INFLOWS # external hydrograph/pollutograph inflow at nodes

        self.read_dwf = SectionReaderAsList("[DWF]", DryWeatherInflowReader)
        # baseline dry weather sanitary inflow at nodes

        self.read_patterns = SectionReaderAsListGroupByID("[PATTERNS]", PatternReader)
        # PATTERNS      periodic variation in dry weather inflow

        self.read_rdii = SectionReaderAsList("[RDII]", RDIInflowReader)
        # rainfall-dependent I/I information at nodes

        self.read_loadings = InitialLoadingsReader()
        # initial pollutant loads on subcatchments

        self.read_curves = SectionReaderAsListGroupByID("[CURVES]", CurveReader)
        # CURVES        x-y tabular data referenced in other sections

        self.read_timeseries = SectionReaderAsListGroupByID("[TIMESERIES]", TimeSeriesReader)
        # time series data referenced in other sections

        self.read_labels = SectionReaderAsList("[LABELS]", LabelReader)
        # X, Y coordinates, text, and font details of labels

        # temporary storage for sections that need to be read after other sections
        self.defer_subareas = None
        self.defer_coordinates = None
        self.defer_symbols = None
        self.defer_tags = None
        self.defer_losses = None
        self.defer_vertices = None
        self.defer_polygons = None
 def read_section(self, project, section_name, section_text):
     section_name_upper = section_name.upper()
     if section_name_upper == project.infiltration.SECTION_NAME.upper():
         self.check_valid_subcatchment_id(project, 'INFILTRATION',
                                          section_text)
         infiltration = project.options.infiltration.upper()
         if infiltration == "HORTON":
             self.read_infiltration = SectionReaderAsList(
                 section_name, HortonInfiltrationReader)
         elif infiltration.startswith("GREEN"):
             self.read_infiltration = SectionReaderAsList(
                 section_name, GreenAmptInfiltrationReader)
         elif infiltration.startswith("CURVE"):
             self.read_infiltration = SectionReaderAsList(
                 section_name, CurveNumberInfiltrationReader)
     elif section_name_upper == "[SUBAREAS]":
         # self.check_valid_subcatchment_id(project, 'SUBAREAS', section_text)
         self.defer_subareas = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[COORDINATES]":
         # self.check_valid_node_id(project, 'COORDINATES', section_text)
         self.defer_coordinates = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[SYMBOLS]":
         # self.check_valid_raingage_id(project, 'SYMBOLS', section_text)
         self.defer_symbols = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[TAGS]":
         self.defer_tags = section_text
         return  # Skip read_section, defer until finished_reading is called.
     elif section_name_upper == "[LOSSES]":
         # self.check_valid_link_id(project, 'LOSSES', section_text)
         self.defer_losses = section_text
         return
     elif section_name_upper == "[VERTICES]":
         # self.check_valid_link_id(project, 'VERTICES', section_text)
         self.defer_vertices = section_text
         return
     elif section_name_upper == "[POLYGONS]":
         # self.check_valid_subcatchment_id(project, 'POLYGONS', section_text)
         self.defer_polygons = section_text
         return
     elif section_name_upper == "[GROUNDWATER]":
         self.check_valid_subcatchment_id(project, 'GROUNDWATER',
                                          section_text)
     elif section_name_upper == "[GWF]":
         self.check_valid_subcatchment_id(project, 'GWF', section_text)
     elif section_name_upper == "[COVERAGES]":
         self.check_valid_subcatchment_id(project, 'COVERAGES',
                                          section_text)
         self.check_valid_landuse_id(project, 'COVERAGES', section_text)
     elif section_name_upper == "[LOADINGS]":
         self.check_valid_subcatchment_id(project, 'LOADINGS', section_text)
     elif section_name_upper == "[LID_USAGE]":
         self.check_valid_subcatchment_id(project, 'LID_USAGE',
                                          section_text)
         self.check_valid_lid_id(project, 'LID_USAGE', section_text)
     elif section_name_upper == "[CONDUITS]":
         self.check_valid_node_id(project, 'CONDUITS', section_text)
     elif section_name_upper == "[PUMPS]":
         self.check_valid_node_id(project, 'PUMPS', section_text)
     elif section_name_upper == "[ORIFICES]":
         self.check_valid_node_id(project, 'ORIFICES', section_text)
     elif section_name_upper == "[WEIRS]":
         self.check_valid_node_id(project, 'WEIRS', section_text)
     elif section_name_upper == "[OUTLETS]":
         self.check_valid_node_id(project, 'OUTLETS', section_text)
     elif section_name_upper == "[TREATMENT]":
         self.check_valid_node_id(project, 'TREATMENT', section_text)
         self.check_valid_pollutant_id(project, 'TREATMENT', section_text)
     elif section_name_upper == "[INFLOWS]":
         self.check_valid_node_id(project, 'INFLOWS', section_text)
         self.check_valid_pollutant_id(project, 'INFLOWS', section_text)
     elif section_name_upper == "[DWF]":
         self.check_valid_node_id(project, 'DWF', section_text)
     elif section_name_upper == "[RDII]":
         self.check_valid_node_id(project, 'RDII', section_text)
     elif section_name_upper == "[XSECTIONS]":
         self.check_valid_link_id(project, 'XSECTIONS', section_text)
     elif section_name_upper == "[LOSSES]":
         self.check_valid_link_id(project, 'LOSSES', section_text)
     elif section_name_upper == "[BUILDUP]":
         self.check_valid_landuse_id(project, 'BUILDUP', section_text)
         self.check_valid_pollutant_id(project, 'BUILDUP', section_text)
     elif section_name_upper == "[WASHOFF]":
         self.check_valid_landuse_id(project, 'WASHOFF', section_text)
         self.check_valid_pollutant_id(project, 'WASHOFF', section_text)
     elif section_name_upper == "[SUBCATCHMENTS]":
         self.check_valid_raingage_id(project, 'SUBCATCHMENTS',
                                      section_text)
     InputFileReader.read_section(self, project, section_name, section_text)