本文整理汇总了Python中core.inputfile.Section.match_omit方法的典型用法代码示例。如果您正苦于以下问题:Python Section.match_omit方法的具体用法?Python Section.match_omit怎么用?Python Section.match_omit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.inputfile.Section
的用法示例。
在下文中一共展示了Section.match_omit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_conduit_section
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_conduit_section(self):
"""Test CONDUIT section using Project class, data from Example 7"""
from_text = Project()
source_text = "[CONDUITS]\n" \
" ;; Inlet Outlet Manning Inlet Outlet Init. Max.\n" \
" ;;Name Node Node Length N Offset Offset Flow Flow\n" \
" ;;-------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ----------\n" \
" C2a J2a J2 157.48 0.016 4 4 0 0\n" \
" C2 J2 J11 526.0 0.016 4 6 0 0\n" \
" C3 J3 J4 109.0 0.016 0 6 0 0\n" \
" C4 J4 J5 133.0 0.05 6 4 0 0\n" \
" C5 J5 J6 207.0 0.05 4 0 0 0\n" \
" C6 J7 J6 140.0 0.05 8 0 0 0\n" \
" C7 J6 J8 95.0 0.016 0 0 0 0\n" \
" C8 J8 J9 166.0 0.05 0 0 0 0\n" \
" C9 J9 J10 320.0 0.05 0 6 0 0\n" \
" C10 J10 J11 145.0 0.05 6 6 0 0\n" \
" C11 J11 O1 89.0 0.016 0 0 0 0\n" \
" C_Aux1 Aux1 J1 377.31 0.016 0 4 0 0\n" \
" C_Aux2 Aux2 J2a 239.41 0.016 0 4 0 0\n" \
" C_Aux1to2 J1 Aux2 286.06 0.016 4 0 0 0\n" \
" C_Aux3 Aux3 J3 444.75 0.05 6 0 0 0\n" \
" P1 J1 J5 185.39 0.016 0 0 0 0\n" \
" P2 J2a J2 157.48 0.016 0 0 0 0\n" \
" P3 J2 J11 529.22 0.016 0 0 0 0\n" \
" P4 Aux3 J4 567.19 0.016 0 0 0 0\n" \
" P5 J5 J4 125.98 0.016 0 0 0 0\n" \
" P6 J4 J7 360.39 0.016 0 0 0 0\n" \
" P7 J7 J10 507.76 0.016 0 0 0 0\n" \
" P8 J10 J11 144.50 0.016 0 0 0 0"
from_text.set_text(source_text)
project_section = from_text.conduits
assert Section.match_omit(project_section.get_text(), source_text, " \t-;\n")
示例2: runTest
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def runTest(self):
"""Test set_text and get_text"""
from_text = Project()
source_text = '\n'.join(self.TEST_TEXT)
from_text.set_text(source_text)
project_sources = from_text.sources
assert Section.match_omit(project_sources.get_text(), source_text, " \t-;\n")
assert project_sources.value[0].id == "JUNCTION-9090"
assert project_sources.value[0].source_type == SourceType.CONCEN
assert project_sources.value[0].baseline_strength == "8330"
assert project_sources.value[0].pattern_id == "Pattern-A"
assert project_sources.value[1].id == "JUNCTION-9091"
assert project_sources.value[1].source_type == SourceType.MASS
assert project_sources.value[1].baseline_strength == "8331"
assert project_sources.value[1].pattern_id == "Pattern-B"
assert project_sources.value[2].id == "JUNCTION-9092"
assert project_sources.value[2].source_type == SourceType.FLOWPACED
assert project_sources.value[2].baseline_strength == "8332"
assert project_sources.value[2].pattern_id == "Pattern-C"
assert project_sources.value[3].id == "JUNCTION-9093"
assert project_sources.value[3].source_type == SourceType.SETPOINT
assert project_sources.value[3].baseline_strength == "8333"
assert project_sources.value[3].pattern_id == "Pattern-D"
assert project_sources.value[4].id == "JUNCTION-9094"
assert project_sources.value[4].source_type == SourceType.CONCEN
assert project_sources.value[4].baseline_strength == "8334"
assert project_sources.value[4].pattern_id == ""
示例3: test_junctions
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_junctions(self):
"""Test JUNCTIONS section through Project class"""
test_text = r"""
[JUNCTIONS]
;; Invert Max. Init. Surcharge Ponded
;;Name Elev. Depth Depth Depth Area
;;-------------- ---------- ---------- ---------- ---------- ----------
J1 4973 0 0 0 0
J2 4969 0 0 0 0
J3 4973 0 0 0 0
J4 4971 0 0 0 0
J5 4969.8 0 0 0 0
J6 4969 0 0 0 0
J7 4971.5 0 0 0 0
J8 4966.5 0 0 0 0
J9 4964.8 0 0 0 0
J10 4963.8 0 0 0 0
J11 4963 0 0 0 0
J12 4973.8 0 0 0 0
J13 4970.7 0 0 0 0
J14 4972.9 0 0 0 0
J15 4974.5 0 0 0 0
J16 4973.5 0 0 0 0
J17 4973.5 0 0 0 0
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.junctions
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例4: test_curves
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_curves(self):
"""Test Curves section"""
self.my_curve = curves.Curve()
self.my_curve = curves.Curve()
self.my_curve.curve_id = "XXX"
self.my_curve.description = "test curve"
self.my_curve.curve_type = curves.CurveType.HEADLOSS
self.my_curve.curve_xy = ((1500, 250), (1400, 200))
assert self.my_curve.curve_id == "XXX"
assert self.my_curve.description == "test curve"
assert self.my_curve.get_text().split() == [';HEADLOSS:', 'test', 'curve',
'XXX', '1500', '250', 'XXX', '1400', '200'], "incorrect pattern block"
# Create new project with new text
test_text = ("[CURVES]",
";ID\tX-Value\tY-Value",
";--\t-------\t-------",
";PUMP: Pump Curve for Pump 9",
" 1\t1500\t250\t")
from_text = Project()
from_text.set_text('\n'.join(test_text))
project_curves = from_text.curves
assert Section.match_omit(project_curves.get_text(), '\n'.join(test_text), " -;\t\n")
assert len(project_curves.value) == 1
this_curve = project_curves.value[0]
assert this_curve.curve_id == '1'
assert this_curve.description == "Pump Curve for Pump 9"
assert this_curve.curve_type == curves.CurveType.PUMP
assert this_curve.curve_xy == [("1500", "250")]
示例5: test_dividers
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_dividers(self):
"""Test DIVIDERS section from Example-1b"""
from_text = Project()
source_text = "[DIVIDERS]\n" \
";;Name Elevation Diverted Link Type Parameters\n" \
";;-------------- ---------- ---------------- ---------- ----------\n" \
"10 0 * CUTOFF 0 0 0"
from_text.set_text(source_text)
project_section = from_text.dividers
assert Section.match_omit(project_section.get_text(), source_text, " \t-;\n")
示例6: test_outfall_section
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_outfall_section(self):
"""Test OUTFALLS section"""
test_text = r"""
[OUTFALLS]
;;Name Elevation Type Stage Data Gated Route To
;;-------------- ---------- ---------- ---------------- -------- ----------------
18 975 FREE NO
18 975 FREE NO xxx
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.outfalls
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例7: test_treatment_section
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_treatment_section(self):
"""Test TREATMENT section"""
test_text = r"""
[TREATMENT]
;; Results: R or C
;; R-Fraction removal
;; C-efflument concentration
;;Node Pollutant Result = Func
;;----------------------------------------------------------------------
Node23 BOD C = BOD * exp(-0.05*HRT)
Node24 Lead R = 0.2 * R_TSS
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.treatment
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例8: test_washoff_section
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_washoff_section(self):
"""Test WASHOFF section"""
test_text = r"""
[WASHOFF]
;; Clean. BMP
;;LandUse Pollutant Function Coeff1 Coeff2 Effic. Effic.
;;------------------------------------------------------------------------------
Residential TSS EXP 0.1 1 0 0
Residential Lead EMC 0 0 0 0
Undeveloped TSS EXP 0.1 0.7 0 0
Undeveloped Lead EMC 0 0 0 0
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.washoff
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例9: test_dwf_section_example8
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_dwf_section_example8(self):
"""Test DWF section from example 8"""
from_text = Project()
source_text = r"""[DWF]
;; Average Time
;;Node Parameter Value Patterns
;;-------------- ---------------- ---------- ----------
J1 FLOW 0.008
J2a FLOW 0.01
J12 FLOW 0.0125
J13 FLOW 0.0123
Aux3 FLOW 0.004 """
# --Test set_text
from_text.set_text(source_text)
project_section = from_text.dwf
assert Section.match_omit(project_section.get_text(), source_text, " \t-;\n")
示例10: test_landuses
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_landuses(self):
"""Test LANDUSES section"""
test_text = r"""
[LANDUSES]
;; Cleaning Fraction Last
;;Name Interval Available Cleaned
;;-------------- ---------- ---------- ----------
Residential_1 0 0 0
Residential_2 0 0 0
Commercial 0 0 0
LID 0 0 0
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.landuses
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例11: test_lid_usage_section
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_lid_usage_section(self):
"""Test LIDUSAGE section through Project class
Test failed as current LID usage only contains one line of LID usage
Also code compained when I have special character in the comment lines"""
test_text = r"""
[LID_USAGE]
;34 rain barrels of 12 sq ft each are placed in
;subcatchment S1. They are initially empty and treat 17
;The outflow from the barrels is returned to the
;subcatchments pervious area.
S1 RB14 34 12 0 0 17 1
S2 Swale 1 10000 50 0 0 0 swale.rpt
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.lid_usage
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例12: test_aquifers
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_aquifers(self):
"""Test AQUIFERS section using the Project class"""
from_text = Project()
source_text = '\n'.join(self.TEST_TEXT)
from_text.set_text(source_text)
project_section = from_text.aquifers
assert Section.match_omit(project_section.get_text(), source_text, " \t-;\n")
val = project_section.value[0]
assert val.name == "1"
assert val.porosity == "0.5"
assert val.wilting_point == "0.15"
assert val.field_capacity == "0.30"
assert val.conductivity == "0.1"
assert val.conductivity_slope == "12"
assert val.tension_slope == "15.0"
assert val.upper_evaporation_fraction == "0.35"
assert val.lower_evaporation_depth == "14.0"
assert val.lower_groundwater_loss_rate == "0.002"
assert val.bottom_elevation == "0.0"
assert val.water_table_elevation == "3.5"
assert val.unsaturated_zone_moisture == "0.40"
assert val.upper_evaporation_pattern == ""
val = project_section.value[1]
assert val.name == "1"
assert val.porosity == "2"
assert val.wilting_point == "3"
assert val.field_capacity == "4"
assert val.conductivity == "5"
assert val.conductivity_slope == "6"
assert val.tension_slope == "7"
assert val.upper_evaporation_fraction == "8"
assert val.lower_evaporation_depth == "9"
assert val.lower_groundwater_loss_rate == "10"
assert val.bottom_elevation == "11"
assert val.water_table_elevation == "12"
assert val.unsaturated_zone_moisture == "13"
assert val.upper_evaporation_pattern == "14"
assert Aquifer.metadata.label_of("name") == "Aquifer Name"
assert Aquifer.metadata.hint_of("name") == "User-assigned aquifer name."
示例13: runTest
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def runTest(self):
"""Test files options"""
self.my_options = files.Files()
name = self.my_options.SECTION_NAME
assert name == "[FILES]"
actual_text = self.my_options.get_text()
# Expect blank section when there are no contents for the section
assert actual_text == ''
self.my_options.save_outflows = "save_outflows.txt"
expected_text = self.my_options.SECTION_NAME + '\n' + self.my_options.comment
expected_text += "\nSAVE OUTFLOWS \tsave_outflows.txt"
actual_text = self.my_options.get_text()
assert Section.match_omit(actual_text, expected_text, " \t-")
示例14: test_subcatchments
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_subcatchments(self):
"""Test SUBCATCHMENTS section from Example 1"""
test_text = """[SUBCATCHMENTS]
;; Total Pcnt. Pcnt. Curb Snow
;;Name Raingage Outlet Area Imperv Width Slope Length Pack
;;----------------------------------------------------------------------------------------------------
1 RG1 9 10 50 500 0.01 0
2 RG1 10 10 50 500 0.01 0
3 RG1 13 5 50 500 0.01 0
4 RG1 22 5 50 500 0.01 0
5 RG1 15 15 50 500 0.01 0
6 RG1 23 12 10 500 0.01 0
7 RG1 19 4 10 500 0.01 0
8 RG1 18 10 10 500 0.01 0
"""
from_text = Project()
from_text.set_text(test_text)
project_section = from_text.subcatchments
assert Section.match_omit(project_section.get_text(), test_text, " \t-;\n")
示例15: test_dwf_section_example3
# 需要导入模块: from core.inputfile import Section [as 别名]
# 或者: from core.inputfile.Section import match_omit [as 别名]
def test_dwf_section_example3(self):
"""Test DWF section from example 3"""
from_text = Project()
source_text = r"""
[DWF]
;; Average Time
;;Node Parameter Value Patterns
;;-----------------------------------------------------
KRO3001 FLOW 1 "" "" "DWF" "" "" "" ""
KRO6015 FLOW 1 "" "" "DWF" "" "" "" ""
KRO6016 FLOW 1 "" "" "DWF" "" "" "" ""
KRO6017 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1002 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1003 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1004 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1005 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1006 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1007 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1008 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1009 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1010 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1012 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1013 FLOW 1 "" "" "DWF" "" "" "" ""
KRO1015 FLOW 1 "" "" "DWF" "" "" "" ""
KRO2001 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4004 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4008 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4009 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4010 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4011 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4012 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4013 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4014 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4015 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4017 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4018 FLOW 1 "" "" "DWF" "" "" "" ""
KRO4019 FLOW 1 "" "" "DWF" "" "" "" ""
SU1 FLOW 1 "" "" "DWF" "" "" "" ""
"""
from_text.set_text(source_text)
project_section = from_text.dwf
assert Section.match_omit(project_section.get_text(), source_text, " \t-;\n")