A drainage system vector data processing method for SWMM modeling

By adopting a vector data processing method for drainage systems oriented towards SWMM modeling, the problems of data integration difficulties and reliance on manual operation are solved, and a standardized conversion from raw input data to model input files is achieved, thereby improving modeling efficiency and result reliability.

CN122333784APending Publication Date: 2026-07-03SUN YAT SEN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUN YAT SEN UNIV
Filing Date
2026-04-10
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies for SWMM modeling of urban flooding simulation face challenges such as difficulties in data integration, reliance on extensive manual operations in preprocessing, and a lack of standardized tools. These issues result in low modeling efficiency, susceptibility to errors, and difficulty in supporting rapid and accurate modeling of large-scale urban drainage systems.

Method used

This paper proposes a vector data processing method for drainage systems oriented towards SWMM modeling. By reading and unifying the basic vector data of the modeling area, identifying outlet nodes, constructing outlet attributes, generating rainfall stations, and processing time series files, a standardized file conforming to the SWMM model format is generated, realizing the standardized conversion from raw input data to model input files.

Benefits of technology

It achieves standardized conversion from raw input data to model input files, overcoming problems such as chaotic data versions, cumbersome processes, and possible errors in boundary condition settings due to human oversight in manual processing mode, thereby improving the reliability of flood simulation results and modeling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122333784A_ABST
    Figure CN122333784A_ABST
Patent Text Reader

Abstract

This invention proposes a vector data processing method for drainage systems oriented towards SWMM modeling, relating to the technical fields of urban flood simulation and vector data processing. The method involves reading and unifying the basic vector data of the modeling area, and reading time series files. Based on the pipe network topology, outlet nodes are identified through set operations, and outlet attribute vector data conforming to SWMM model requirements is constructed. Based on the outlet name mapping relationship, the attributes and topology of manholes, pipes, and sub-catchments are updated. Rain gauges are deployed and their attributes configured. Two types of time series are processed to generate standardized time series files conforming to SWMM format requirements. After data preparation, the data is converted into an SWMM model file. This invention achieves standardized conversion from raw input data to model input files, offering advantages such as clear logic, simple calling, and strong operability. It provides an efficient means for preliminary data preparation in urban flood simulation and improves the reliability of flood simulation results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical fields of urban flood simulation and vector data processing, and more specifically, to a method for vector data processing of drainage systems for SWMM modeling. Background Technology

[0002] Urban stormwater and flood simulation is an important technical means to support drainage system planning and disaster prevention and mitigation decisions. SWMM (Storm Water Management Model) has become one of the most widely used urban drainage system simulation tools worldwide. The model's runoff and catchment modules simulate precipitation and runoff occurring in each sub-catchment area and transmit water through pipe networks, channels, water storage and treatment facilities.

[0003] However, SWMM models face significant challenges in data preprocessing during practical engineering applications. The fundamental data required for model construction, such as manholes, pipes, and sub-catchments, are typically stored in fragmented GIS vector data formats. Furthermore, data formats for rainfall and boundary conditions are inconsistent. Before generating a standard input file recognizable by the SWMM model, extensive repetitive manual editing, format conversion, and parameter configuration are often required. This fails to provide adequate data for efficient modeling, leading to low modeling efficiency and introducing human error that affects the reliability of simulation results. Consequently, it is difficult to meet the demands for rapid modeling of large-scale urban drainage systems. Summary of the Invention

[0004] To address the challenges of existing technologies using SWMM models for urban flood simulation, such as difficulties in data integration, reliance on extensive manual preprocessing, and a lack of standardized tools, which lead to low modeling efficiency, susceptibility to errors, and difficulty in supporting rapid and accurate modeling of large-scale urban drainage systems, this invention proposes a vector data processing method for drainage systems in SWMM modeling. This method achieves standardized conversion from raw input data to model input files, providing an efficient means for preparing data in the early stages of urban flood simulation and improving the reliability of flood simulation results.

[0005] To achieve the above-mentioned technical effects, the technical solution of the present invention is as follows: A method for vector data processing of drainage systems for SWMM modeling includes the following steps: S1: Read and unify the basic vector data of the modeling area, and read the rainfall time series file and the tide time series file; the basic vector data includes the vector data corresponding to the inspection well node, the vector data corresponding to the drainage pipe, and the vector data corresponding to the sub-catchment area; S2: Based on the topology of the drainage pipeline network, the outlet nodes are identified through set operations, the outlet node set is constructed, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. S3: Based on the name mapping relationship of the identified outlet nodes, update the attributes and topology of the manhole nodes, pipe connection relationships, and sub-catchment areas; S4: Generate rain gauge stations in the modeling area and configure rain gauge attribute data; S5: Process the rainfall time series files and tide time series files to generate standardized time series files that meet the requirements of the SWMM model format.

[0006] Preferably, in step S1, the vector data corresponding to the manhole node includes the manhole node's identifier and inner bottom elevation attribute; the vector data corresponding to the drainage pipe includes the drainage pipe's identifier and topology attribute; and the vector data corresponding to the sub-catchment area includes the sub-catchment area's identifier, rain gauge, and drainage outlet attributes.

[0007] Preferably, based on the topology of the drainage pipeline network, outlet nodes are identified through set operations, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. The process is as follows: Construct the set of outlet nodes: Let F be a set of FromeNodes, the identifiers of the starting nodes of all pipes in the drainage pipeline data, and T be a set of ToNodes, satisfying the expression: , Where N is the total number of drainage pipes; the set O of the outlet nodes satisfies the expression: ; Construct vector data containing outlet attributes: reset the sequence identifier fid of all outlet nodes, generate a new name Name, retain the inner bottom elevation Elevation of the original outlet nodes, and add the boundary condition field of the SWMM model, assigning the boundary condition field a default value. Save the constructed collection and attribute table as spatial vector data.

[0008] Preferably, based on the identified outlet node name mapping relationship, the attributes and topology of the inspection well node, pipeline connection relationship, and sub-catchment area are updated. The process is as follows: Based on the original identifier of the outlet, delete the nodes that have been identified as outlets from the vector data corresponding to the inspection well nodes; By constructing a mapping dictionary between the original and updated identifiers of the water outlet, the FromeNode field and the ToNode field of the starting node identifier in the vector data corresponding to the drainage pipe are replaced in batches to update the pipe connection relationship involving the water outlet. Eliminate the sub-catchment area corresponding to the outlet.

[0009] Preferably, the process of generating rain gauge stations in the modeling area is as follows: Rainfall stations are automatically generated in the upper right corner of the modeling area, and calculations are performed based on the area boundary. The process satisfies the expression:

[0010] in, Indicates the coordinates of the rainfall station. Represents the rectangular boundary coordinates of the modeling area.

[0011] Preferably, the process of configuring rain gauge attribute data is as follows: Set up rain gauge name identifiers and extract unified rain gauge identifiers based on the attributes of sub-catchment areas; If the extraction fails, the identifiers of the rain gauge and the sub-catchment area will be updated simultaneously. Configure the rainfall data format as INTENSITY in terms of intensity; configure the snowfall factor as the default value of 1; configure the data source type as TIMESERIES; configure the default identifier TS_1 for the time series name.

[0012] Preferably, the sampling interval for the rainfall time series is calculated and configured. The Interval column automatically detects the minimum time interval by parsing the Time column in the Excel file of the rainfall intensity time series and converts it to HH:MM format. Each time is then converted into minutes from midnight of the current day. The process satisfies the expression:

[0013] in, This indicates time entries recorded in minutes. , , These represent the hours, minutes, and seconds of the time field in the original rainfall file, respectively. Calculate the interval between adjacent time steps and take the minimum time interval, then save it to the Interval column. The process satisfies the expression:

[0014] in, The smallest time interval representing a rainfall time series. , These represent the i-th and i+1-th time items in the rainfall time series, respectively, in minutes.

[0015] Preferably, the data in the rainfall intensity time series file is processed as follows: Convert the units of rainfall intensity to the default units that satisfy the SWMM model. The process satisfies the expression:

[0016] in, Indicates rainfall intensity in millimeters per hour. Indicates rainfall intensity in inches per hour; The consistency of time intervals in the original rainfall time series files is detected and analyzed. If the minimum and maximum time intervals are inconsistent, linear interpolation is performed on the original time-rainfall intensity data based on the minimum interval to generate rainfall intensity sequences with equal time intervals. Among these, rainfall intensity... The calculation expression is:

[0017] in, It represents any interpolation time; if a negative rainfall intensity value appears, it will be automatically corrected to 0; according to the rainfall time series name, the corresponding column will be added to the output file to generate a standardized Excel file.

[0018] Preferably, the tidal time series file is processed as follows: If the outlet needs to consider the tidal effect, the tidal time series needs to be processed. The tidal time series includes the number of days and water level information. The water level information is converted into the default unit requirement that meets the SWMM model. The process satisfies the expression:

[0019] in, This indicates the tide level value in feet. It represents the tide level value in meters; based on the tide time series name, it adds the corresponding column to the output file and generates a standardized Excel file.

[0020] Preferably, the vector data in the data file obtained after processing by S1 to S5 is loaded into the QGIS platform to generate an input file conforming to the SWMM model standard format. To address the problems faced by existing technologies in urban flood simulation using SWMM models, such as difficulties in data integration, reliance on extensive manual operations in preprocessing, and a lack of standardized tools, leading to low modeling efficiency, susceptibility to errors, and difficulty in supporting rapid and accurate modeling of large-scale urban drainage systems, this invention proposes a vector data processing method for drainage systems oriented towards SWMM modeling. This method achieves standardized conversion from raw input data to model input files, providing an efficient means for preliminary data preparation in urban flood simulation and improving the reliability of flood simulation results.

[0021] To achieve the above-mentioned technical effects, the technical solution of the present invention is as follows: A method for vector data processing of drainage systems for SWMM modeling includes the following steps: S1: Read and unify the basic vector data of the modeling area, and read the rainfall time series file and the tide time series file; the basic vector data includes the vector data corresponding to the inspection well node, the vector data corresponding to the drainage pipe, and the vector data corresponding to the sub-catchment area; S2: Based on the topology of the drainage pipeline network, the outlet nodes are identified through set operations, the outlet node set is constructed, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. S3: Based on the name mapping relationship of the identified outlet nodes, update the attributes and topology of the manhole nodes, pipe connection relationships, and sub-catchment areas; S4: Generate rain gauge stations in the modeling area and configure rain gauge attribute data; S5: Process the rainfall time series files and tide time series files to generate standardized time series files that meet the requirements of the SWMM model format.

[0022] Preferably, in step S1, the vector data corresponding to the manhole node includes the manhole node's identifier and inner bottom elevation attribute; the vector data corresponding to the drainage pipe includes the drainage pipe's identifier and topology attribute; and the vector data corresponding to the sub-catchment area includes the sub-catchment area's identifier, rain gauge, and drainage outlet attributes.

[0023] Preferably, based on the topology of the drainage pipeline network, outlet nodes are identified through set operations, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. The process is as follows: Construct the set of outlet nodes: Let F be a set of FromeNodes, the identifiers of the starting nodes of all pipes in the drainage pipeline data, and T be a set of ToNodes, satisfying the expression: , Where N is the total number of drainage pipes; the set O of the outlet nodes satisfies the expression: ; Construct vector data containing outlet attributes: reset the sequence identifier fid of all outlet nodes, generate a new name Name, retain the inner bottom elevation Elevation of the original outlet nodes, and add the boundary condition field of the SWMM model, assigning the boundary condition field a default value. Save the constructed collection and attribute table as spatial vector data.

[0024] Preferably, based on the identified outlet node name mapping relationship, the attributes and topology of the inspection well node, pipeline connection relationship, and sub-catchment area are updated. The process is as follows: Based on the original identifier of the outlet, delete the nodes that have been identified as outlets from the vector data corresponding to the inspection well nodes; By constructing a mapping dictionary between the original and updated identifiers of the water outlet, the FromeNode field and the ToNode field of the starting node identifier in the vector data corresponding to the drainage pipe are replaced in batches to update the pipe connection relationship involving the water outlet. Eliminate the sub-catchment area corresponding to the outlet.

[0025] Preferably, the process of generating rain gauge stations in the modeling area is as follows: Rainfall stations are automatically generated in the upper right corner of the modeling area, and calculations are performed based on the area boundary. The process satisfies the expression:

[0026] in, Indicates the coordinates of the rainfall station. Represents the rectangular boundary coordinates of the modeling area.

[0027] Preferably, the process of configuring rain gauge attribute data is as follows: Set up rain gauge name identifiers and extract unified rain gauge identifiers based on the attributes of sub-catchment areas; If the extraction fails, the identifiers of the rain gauge and the sub-catchment area will be updated simultaneously. Configure the rainfall data format as INTENSITY in terms of intensity; configure the snowfall factor as the default value of 1; configure the data source type as TIMESERIES; configure the default identifier TS_1 for the time series name.

[0028] Preferably, the sampling interval for the rainfall time series is calculated and configured. The Interval column automatically detects the minimum time interval by parsing the Time column in the Excel file of the rainfall intensity time series and converts it to HH:MM format. Each time is then converted into minutes from midnight of the current day. The process satisfies the expression:

[0029] in, This indicates time entries recorded in minutes. , , These represent the hours, minutes, and seconds of the time field in the original rainfall file, respectively. Calculate the interval between adjacent time steps and take the minimum time interval, then save it to the Interval column. The process satisfies the expression:

[0030] in, The smallest time interval representing a rainfall time series. , These represent the i-th and i+1-th time items in the rainfall time series, respectively, in minutes.

[0031] Preferably, the data in the rainfall intensity time series file is processed as follows: Convert the units of rainfall intensity to the default units that satisfy the SWMM model. The process satisfies the expression:

[0032] in, Indicates rainfall intensity in millimeters per hour. Indicates rainfall intensity in inches per hour; The consistency of time intervals in the original rainfall time series files is detected and analyzed. If the minimum and maximum time intervals are inconsistent, linear interpolation is performed on the original time-rainfall intensity data based on the minimum interval to generate rainfall intensity sequences with equal time intervals. Among these, rainfall intensity... The calculation expression is:

[0033] in, It represents any interpolation time; if a negative rainfall intensity value appears, it will be automatically corrected to 0; according to the rainfall time series name, the corresponding column will be added to the output file to generate a standardized Excel file.

[0034] Preferably, the tidal time series file is processed as follows: If the outlet needs to consider the tidal effect, the tidal time series needs to be processed. The tidal time series includes the number of days and water level information. The water level information is converted into the default unit requirement that meets the SWMM model. The process satisfies the expression:

[0035] in, This indicates the tide level value in feet. It represents the tide level value in meters; based on the tide time series name, it adds the corresponding column to the output file and generates a standardized Excel file.

[0036] Preferably, the vector data in the data file obtained after processing by S1 to S5 is loaded into the QGIS platform to generate an input file that conforms to the SWMM model standard format.

[0037] Compared with the prior art, the beneficial effects of the technical solution of the present invention are: This invention proposes a vector data processing method for drainage systems oriented towards SWMM modeling. It reads and unifies the basic vector data of the modeling area, reads time-series files, identifies and extracts outlet nodes from the basic input data, and constructs vector data containing outlet attributes according to the format requirements of the SWMM model. Based on the name mapping relationship of the identified outlet nodes, the drainage system vector data is updated. Rain gauges are deployed and configured in the modeling area to provide a carrier for subsequent access to the processed time-series files. The time-series files are processed to provide standardized boundary condition inputs for the SWMM model, generating standardized files that conform to the SWMM model format requirements. This invention is configured according to the SWMM specification. It constructs a complete data processing chain, from reading the original data, identifying and modeling the outlet, to updating the vector data of the drainage system, automatically deploying rain gauges and generating standardized rainfall time series. Subsequently, only basic data files need to be provided, and no manual operation is required to obtain a complete data package that can be directly imported into the SWMM model. This allows the data source, processing parameters, and transformation rules for each modeling to be completely recorded and reproduced. It overcomes the problems of data version confusion, cumbersome process, and possible errors in boundary condition settings due to human oversight in the traditional manual processing mode.

[0038] Compared with the prior art, the beneficial effects of the technical solution of the present invention are: This invention proposes a vector data processing method for drainage systems oriented towards SWMM modeling. It reads and unifies the basic vector data of the modeling area, reads time-series files, identifies and extracts outlet nodes from the basic input data, and constructs vector data containing outlet attributes according to the format requirements of the SWMM model. Based on the name mapping relationship of the identified outlet nodes, the drainage system vector data is updated. Rain gauges are deployed and configured in the modeling area to provide a carrier for subsequent access to the processed time-series files. The time-series files are processed to provide standardized boundary condition inputs for the SWMM model, generating standardized files that conform to the SWMM model format requirements. This invention is configured according to the SWMM specification. It constructs a complete data processing chain, from reading the original data, identifying and modeling the outlet, to updating the vector data of the drainage system, automatically deploying rain gauges and generating standardized rainfall time series. Subsequently, only basic data files need to be provided, and no manual operation is required to obtain a complete data package that can be directly imported into the SWMM model. This allows the data source, processing parameters, and transformation rules for each modeling to be completely recorded and reproduced. It overcomes the problems of data version confusion, cumbersome process, and possible errors in boundary condition settings due to human oversight in the traditional manual processing mode. Attached Figure Description

[0039] Figure 1This diagram illustrates the overall steps of vector data processing for drainage systems oriented towards SWMM modeling, as proposed in this embodiment of the invention. Figure 2 A flowchart illustrating a method for vector data processing of drainage systems oriented towards SWMM modeling, as proposed in an embodiment of the present invention; Figure 3 This represents the distribution map of the input vector data of the drainage system proposed in this embodiment of the invention; Figure 4 This diagram illustrates an example of the input data for the drainage system proposed in this embodiment of the invention. Figure 5 A schematic diagram illustrating the input rainfall time series proposed in an embodiment of the present invention; Figure 6 This diagram illustrates the distribution of the drainage system proposed in this embodiment of the invention. Figure 7 This represents a diagram of the SWMM model file proposed in this embodiment of the invention. Detailed Implementation

[0040] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent. To better illustrate this embodiment, some parts of the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions; It is understandable to those skilled in the art that some well-known details may be omitted from the accompanying drawings.

[0041] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0042] The positional relationships depicted in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent. Example 1 This embodiment proposes a vector data processing method for drainage systems oriented towards SWMM modeling. (See [link to relevant documentation]). Figure 2 This includes the following steps: S1: Read and unify the basic vector data of the modeling area, and read the rainfall time series file and the tide time series file; the basic vector data includes the vector data corresponding to the manhole node, the vector data corresponding to the drainage pipe, and the vector data corresponding to the sub-catchment area; S2: Based on the topology of the drainage pipeline network, the outlet nodes are identified through set operations, the outlet node set is constructed, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. S3: Based on the name mapping relationship of the identified outlet nodes, update the attributes and topology of the manhole nodes, pipe connection relationships, and sub-catchment areas; S4: Generate rain gauge stations in the modeling area and configure rain gauge attribute data; S5: Process the rainfall time series files and tide time series files to generate standardized time series files that meet the requirements of the SWMM model format.

[0043] The core idea of ​​this embodiment is to automatically identify, map, update, and configure dispersed drainage system vector data (including manhole nodes, drainage pipes, and sub-catchments) and boundary conditions such as rainfall time series, transforming them into input files that meet the strict format requirements of the SWMM model. This replaces the traditional manual, item-by-item processing mode, overcoming problems such as data version inconsistencies, cumbersome processes, and potential omissions in settings that can occur with manual processing. Figure 1 As shown, this embodiment mainly includes five core steps: basic data reading, automatic outlet identification and modeling, drainage system vector data updating, automatic rain gauge deployment and configuration, and time series processing and generation. Finally, the method is encapsulated into a callable Python class file to generate SWMM model files.

[0044] Specifically, the basic vector data in Shapefile format of the modeling region is read using the open-source third-party library Geopandas. The coordinate system of all basic vector data is unified, and a node identifier index is constructed, laying the foundation for subsequent topology analysis. Set operations are used to automatically identify and model the outlet nodes, ensuring that the outlet data can be directly recognized by the SWMM model without subsequent manual correction. Rain gauges are deployed and configured in the modeling region, providing a carrier for the subsequent integration of processed time series files. The rainfall and tide time series files are processed to provide standardized boundary condition inputs for the SWMM model. The method proposed in this embodiment achieves standardized conversion from raw input data to model input files, overcoming the problems of data version confusion, cumbersome processes, and potential errors in boundary condition settings due to human oversight in traditional manual processing methods.

[0045] Example 2 This embodiment improves upon Embodiment 1 by providing a vector data processing method for drainage systems oriented towards SWMM modeling. In S1, the vector data corresponding to the manhole node includes the manhole node's identifier and inner bottom elevation attribute; the vector data corresponding to the drainage pipe includes the drainage pipe's identifier and topology attribute; and the vector data corresponding to the sub-catchment area includes the sub-catchment area's identifier, rain gauge, and drainage outlet attributes.

[0046] In this embodiment, the open-source third-party library Geopandas is used to read the Shapefile format vector data (.shp) of the modeling region. An Excel file (.xlsx) containing rainfall intensity time series is also read, with a fixed time step; rainfall data is provided in terms of intensity. All vector data are unified in a coordinate system, and a node identifier index is constructed to lay the foundation for subsequent topology analysis.

[0047] In one optional embodiment, based on the topology of the drainage pipeline network, outlet nodes are identified through set operations, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. The process is as follows: Construct the set of outlet nodes: Let F be a set of FromeNodes, the identifiers of the starting nodes of all pipes in the drainage pipeline data, and T be a set of ToNodes, satisfying the expression: , Where N is the total number of drainage pipes; the set O of outlet nodes satisfies the expression: ; Construct vector data containing outlet attributes: reset the sequence identifier fid of all outlet nodes, generate a new name Name, retain the inner bottom elevation Elevation of the original outlet nodes, and add the boundary condition field of the SWMM model, assigning the boundary condition field a default value. Save the constructed collection and attribute table as spatial vector data.

[0048] In this embodiment, set operations are used to automatically identify outlet nodes, ensuring that outlet data can be directly recognized by the SWMM model without subsequent manual correction. Outlet nodes are identified as nodes that only serve as the end point of the pipeline and not the start point; that is, nodes that only appear in the ToNode but never in the FromNode. An attribute table conforming to the SWMM model requirements is constructed for the separated outlets. First, the sequence identifier (fid) is reset, and a new name (Name) is generated. The original node's inner bottom elevation (Elevation) is retained, and the necessary boundary condition fields for SWMM are added, with default values: the boundary type (Type) is set to "FREE" for free outflow by default, and three optional outflow schemes, "NORMAL", "FIXED", and "TIDAL", are also supported. The content of the Type column is automatically detected. If it is "FIXED", the FixedStage column must be a non-negative constant, set to 1 foot by default; if it is "TIDAL", the Curve_TS column must be associated with a tidal curve, with the tidal curve name set to "tdc_1" by default. The FlapGate is set to "NO" by default, and the RouteTo function is left blank by default. The modeling results are saved as spatial vector data (.shp).

[0049] In an optional embodiment, based on the identified outlet node name mapping relationship, the attributes and topology of the inspection well node, pipeline connection relationship, and sub-catchment area are updated. The process is as follows: Based on the original identifier of the outlet, delete the nodes that have been identified as outlets from the vector data corresponding to the inspection well nodes; By constructing a mapping dictionary between the original and updated identifiers of the water outlet, the FromeNode field and the ToNode field of the starting node identifier in the vector data corresponding to the drainage pipe are replaced in batches to update the pipe connection relationship involving the water outlet. Eliminate the sub-catchment area corresponding to the outlet.

[0050] In this embodiment, a mapping dictionary of original and updated identifiers for water outlets is constructed to perform batch replacements of the "FromNode" and "ToNode" fields in the pipeline data. Vectorized operations using the third-party library Pandas are used to update all pipeline connections involving water outlets, automatically maintaining the consistency of the pipeline network topology. The "Outlet" field in the sub-catchment attribute table specifies the discharge node corresponding to each sub-region. Since the water outlet itself does not participate in surface runoff collection, its corresponding sub-catchment is removed from the final model to eliminate redundancy.

[0051] In one optional embodiment, the process of generating rain gauge stations in the modeling area is as follows: Rainfall stations are automatically generated in the upper right corner of the modeling area, and calculations are performed based on the area boundary. The process satisfies the expression:

[0052] in, Indicates the coordinates of the rainfall station. Represents the rectangular boundary coordinates of the modeling area.

[0053] The process of configuring rain gauge attribute data is as follows: Set up rain gauge name identifiers and extract unified rain gauge identifiers based on the attributes of sub-catchment areas; If the extraction fails, the identifiers of the rain gauge and the sub-catchment area will be updated simultaneously. Configure the rainfall data format as INTENSITY in terms of intensity; configure the snowfall factor as the default value of 1; configure the data source type as TIMESERIES; configure the default identifier TS_1 for the time series name.

[0054] The sampling interval for the rainfall time series is calculated and configured. The Interval column automatically detects the minimum time interval by parsing the Time column in the Excel file of the rainfall intensity time series and converts it to HH:MM format. Each time is then converted into minutes from midnight of the current day. The process satisfies the expression:

[0055] in, This indicates time entries recorded in minutes. , , These represent the hours, minutes, and seconds of the time field in the original rainfall file, respectively. Calculate the interval between adjacent time steps and take the minimum time interval, then save it to the Interval column. The process satisfies the expression:

[0056] in, The smallest time interval representing a rainfall time series. , These represent the i-th and i+1-th time items in the rainfall time series, respectively, in minutes.

[0057] In this embodiment, the Name column, representing the rain gauge name identifier, extracts a unified rain gauge identifier, such as "RG_1," from the sub-catchment attribute table (RainGage). If extraction fails, the rain gauge identifiers for both the rain gauge station and the sub-catchment area are updated simultaneously. The Format column for rainfall data format is set to "INTENSITY" by default, indicating that data is provided in terms of rainfall intensity, with the required unit being inches per hour (in / hr). The SCF column for snowfall factor is set to 1 by default. The Datasources column for data source type is set to TIMESERIES by default, corresponding to a time series data source.

[0058] In an optional embodiment, the data in the rainfall intensity time series file is processed as follows: Convert the units of rainfall intensity to the default units that satisfy the SWMM model. The process satisfies the expression:

[0059] in, Indicates rainfall intensity in millimeters per hour. Indicates rainfall intensity in inches per hour; The consistency of time intervals in the original rainfall time series files is detected and analyzed. If the minimum and maximum time intervals are inconsistent, linear interpolation is performed on the original time-rainfall intensity data based on the minimum interval to generate rainfall intensity sequences with equal time intervals. Among these, rainfall intensity... The calculation expression is:

[0060] in, It represents any interpolation time; if a negative rainfall intensity value appears, it will be automatically corrected to 0; according to the rainfall time series name, the corresponding column will be added to the output file to generate a standardized Excel file.

[0061] In this embodiment, the original rainfall time series file must contain the necessary date, time, and rainfall intensity information. Rainfall intensity (PI) is typically recorded in millimeters per hour (mm / hr), while the default unit requirement for the SWMM model is inches per hour (in / hr).

[0062] In an optional embodiment, the tide time series file is processed as follows: If the outlet needs to consider the tidal effect, the tidal time series needs to be processed. The tidal time series includes the number of days and water level information. The water level information is converted into the default unit requirement that meets the SWMM model. The process satisfies the expression:

[0063] in, This indicates the tide level value in feet. It represents the tide level value in meters; based on the tide time series name, it adds the corresponding column to the output file and generates a standardized Excel file.

[0064] In this embodiment, if the downstream boundary (outlet) of the model needs to consider the tidal influence, the tidal time series data can be processed. The raw tidal data needs to provide the number of days (unit: days) and water level (unit: meters). The water level information is converted to feet (ft) according to the following formula to meet the default unit requirements of the SWMM model.

[0065] In an optional embodiment, the vector data in the data file obtained after processing S1 to S5 is loaded into the QGIS platform to generate an input file that conforms to the SWMM model standard format.

[0066] In this embodiment, vector data is loaded into the QGIS platform, and the open-source plugin "Generate SwmmInp" is invoked to generate an input file (.inp) in the standard SWMM 5.1 format. This file fully contains key data segments such as [JUNCTIONS], [OUTFALLS], [CONDUITS], [SUBCATCHMENTS], [RAINGAGES], and [TIMESERIES], which can be directly imported into the SWMM model for hydrological and hydraulic simulation.

[0067] Example 3 This embodiment proposes a vector data processing method for drainage systems in SWMM modeling, used to process vector data for an SWMM model of the drainage system in the central urban area of ​​Shangqiu City, with a modeling area of ​​approximately 9.96 square kilometers. The specific steps are as follows: Step SA: The drainage system Shapefile vector data (.shp) contains 2106 manhole nodes, 2069 drainage pipes, and 2106 sub-catchments. See the drainage system input vector data distribution map. Figure 3 The horizontal and vertical axes represent coordinates in a unified projected coordinate system. The attribute table information included in the original drainage system data can be found here. Figure 4 , Figure 4 (a) is the drainage pipe data. Figure 4 (b) is the inspection well node data. Figure 4 (c) Data for the sub-catchment area. Additionally, prepare rainfall time-series data in Excel format (.xlsx). Import the necessary third-party libraries Geopandas, Pandas, NumPy, and Shapely into the Python environment. Use the `geopandas.read_file` function to read the drainage system vector file and unify all vector data to the same coordinate system. Use the `pandas.read_excel` function to read the rainfall time-series file and store it as a DataFrame variable `df_rain`.

[0068] Step SB: Based on the topology of the drainage pipeline network, automatically identify the outlet nodes using set operations and construct an attribute table conforming to the SWMM specification for them. The specific steps are as follows: Step SB01: Extract all start-point node identifiers (FromNode) and end-point node identifiers (ToNode) from the drainage pipeline data, forming sets from_nodes and to_nodes respectively. Obtain the outlet node set through set difference operation and save it to the variable outfall_names; Step SB02: Configure the attributes of the outlet feature set, reset the index, and add a sequence identifier field fid (starting from 1). Generate a new node name field Name according to the rule "Out_1, Out_2…". Retain the original node's inner bottom elevation field Elevation. Additionally, add the necessary fields for the SWMM model outlet and assign default values: the boundary type Type is set to "FREE" by default; if the type is "TIDAL", the tidal curve name Curve_TS is set to "tdc_1" by default; the flap gate identifier FlapGate is set to "NO" by default; the outflow calculation method RouteTo is left blank by default. Finally, save the processed outlet data as a file named "SWMM_outfalls.shp".

[0069] Step SC: Based on the mapping relationship of the outlet names, automatically update the data for inspection well nodes, drainage pipes, and sub-catchment areas to ensure the consistency of all data. The specific steps are as follows: Step SC01: Construct a mapping dictionary named_map between the original and updated identifiers of the outlet; Step SC02: Filter out records whose Name field value belongs to the outlet from the original inspection well node data, delete these features from the original inspection well nodes, and retain the remaining nodes as ordinary inspection wells as Shapefile format vector data "SWMM_junctions.shp"; Step SC03: For drainage pipe data, replace the values ​​in the ToNode field that belong to the original outlet names with the corresponding new names. Use Pandas' apply method to perform vectorized batch updates, thereby automatically maintaining the correctness of the pipe network topology. The updated pipe data is saved as a Shapefile format vector data file "SWMM_conduits.shp". Step SC04: For sub-catchment data, the Outlet field records the discharge node corresponding to each sub-region. Records whose Outlet field values ​​do not belong to the outlet are filtered out using a Boolean index, retaining the valid sub-catchments. The updated sub-catchment data is saved as Shapefile format vector data "SWMM_subcatchments.shp".

[0070] Step SD: Rain gauge stations are automatically generated in the upper right corner of the modeling area, and time intervals are automatically parsed based on the rainfall time series file to complete the rain gauge attribute configuration. The specific steps are as follows: Step SD01: Obtain the rectangular range [xmin,xmax,ymin,ymax] from the original sub-catchment data, calculate the coordinates of the rain gauge stations, and use the Point function of the Shapely library to construct the vector data of the rain gauge stations; Step SD02: Parse the time interval of the rainfall time series, extract the time column from the rainfall variable df_rain, convert each time in "HH:MM:SS" format into minutes starting from 00:00 on the current day, and store it as a new column. Calculate the difference between adjacent time points to obtain a series of interval values, take the minimum value as the minimum time interval and format it as the string "HH:MM", and save it to the Interval field, for example, 60 minutes corresponds to "01:00"; Step SD03: Construct a rain gauge attribute table containing the following fields: Name (rain gauge name), a unified identifier extracted from the sub-catchment attributes; Format (rainfall data format), defaulting to "INTENSITY"; SCF (snowfall factor), defaulting to 1; DataSource (data source type), defaulting to "TIMESERIES"; SeriesName (time series name), defaulting to "TS_1"; Interval (interval time), calculated in step S402; FileName, StationID, RainUnits, and Annotation are set to empty by default. Save the results as a Shapefile format vector data "SWMM_raingage.shp".

[0071] Step SE: Standardize the rainfall time series and optional tide time series to generate an Excel file that can be directly referenced by SWMM. The specific steps are as follows: Step SE01: Rainfall Time Series Processing. First, convert the original rainfall intensity from millimeters per hour (mm / hr) to inches per hour (in / hr) and reset the intensity column. Then, check the consistency of the time intervals. If the minimum and maximum time intervals are inconsistent, perform linear interpolation based on the minimum interval to ensure the generation of an equally spaced series. If negative values ​​occur during interpolation, they are automatically corrected to 0. Finally, according to the rainfall time series name determined in step S403 (e.g., "TS_1"), organize the processed data into a standardized table and save it as an Excel file named "SWMM_rainfall.xlsx". Figure 5 To input a rainfall time series graph, the horizontal axis represents the cumulative elapsed time since the start of rainfall, in hours, and the vertical axis represents the rainfall intensity at the corresponding time. The blue line connects the rainfall intensities at different times, and the green dots represent discrete time series data nodes.

[0072] Step SE02: Tidal Time Series Processing. If the model involves tidal boundaries, read the tidal data file, which includes the number of days and water level (unit: meters). Convert the water level to feet and save it as an Excel file named "SWMM_tide_curve.xlsx" according to the tidal curve name set in step S202 (e.g., "tdc_1").

[0073] Step SE03: The core algorithm from the previous steps is encapsulated into a Python class SWMMDataProcessor. Users only need to call this class, passing in the original file path and a few parameters, to automatically and quickly process the data required by the SWMM model. The generated data file is loaded into the QGIS platform, and the input data is configured using the open-source plugin "Generate Swmm Inp" to generate an input file "SWMM_model.inp" conforming to the SWMM 5.1 standard format.

[0074] Figure 6 The diagram shows the distribution of the drainage system in the standardized SWMM model. Figure 6 The horizontal and vertical axes represent the coordinate values ​​in the planar projection coordinate system, which corresponds to the unified coordinate system of the original GIS vector data. Figure 7 The diagram shows the SWMM model file after standardization.

[0075] The embodiments described are merely examples to clearly illustrate the present invention and are not intended to limit the implementation of the invention. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively describe all possible implementations. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for vector data processing of drainage systems for SWMM modeling, characterized in that, Includes the following steps: S1: Read and unify the basic vector data of the modeling area, and read the rainfall time series file and the tide time series file; the basic vector data includes the vector data corresponding to the inspection well node, the vector data corresponding to the drainage pipe, and the vector data corresponding to the sub-catchment area; S2: Based on the topology of the drainage pipeline network, the outlet nodes are identified through set operations, the outlet node set is constructed, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. S3: Based on the name mapping relationship of the identified outlet nodes, update the attributes and topology of the manhole nodes, pipe connection relationships, and sub-catchment areas; S4: Generate rain gauge stations in the modeling area and configure rain gauge attribute data; S5: Process the rainfall time series files and tide time series files to generate standardized time series files that meet the requirements of the SWMM model format.

2. The method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, In S1, the vector data corresponding to the inspection well node includes the identification and inner bottom elevation attribute of the inspection well node; the vector data corresponding to the drainage pipe includes the identification and topology attribute of the drainage pipe; and the vector data corresponding to the sub-catchment area includes the identification, rain gauge, and drainage outlet attributes of the sub-catchment area.

3. The method for vector data processing of drainage systems for SWMM modeling according to claim 2, characterized in that, Based on the topology of the drainage pipeline network, outlet nodes are identified through set operations, and vector data containing outlet attributes is constructed according to the requirements of the SWMM model. The process is as follows: Construct the set of outlet nodes: Let F be a set of FromeNodes, the identifiers of the starting nodes of all pipes in the drainage pipeline data, and T be a set of ToNodes, satisfying the expression: , Where N is the total number of drainage pipes; the set O of the outlet nodes satisfies the expression: ; Construct vector data containing outlet attributes: reset the sequence identifier fid of all outlet nodes, generate a new name Name, retain the inner bottom elevation Elevation of the original outlet nodes, and add the boundary condition field of the SWMM model, assigning the boundary condition field a default value. Save the constructed collection and attribute table as spatial vector data.

4. A method for vector data processing of drainage systems for SWMM modeling according to claim 1 or 2, characterized in that, Based on the identified outlet node name mapping relationships, update the attributes and topology of the inspection well nodes, pipe connection relationships, and sub-catchment areas. The process is as follows: Based on the original identifier of the outlet, delete the nodes that have been identified as outlets from the vector data corresponding to the inspection well nodes; By constructing a mapping dictionary between the original and updated identifiers of the water outlet, the FromeNode field and the ToNode field of the starting node identifier in the vector data corresponding to the drainage pipe are replaced in batches to update the pipe connection relationship involving the water outlet. Eliminate the sub-catchment area corresponding to the outlet.

5. The method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, The process of generating rain gauge stations in the modeling area is as follows: Rainfall stations are automatically generated in the upper right corner of the modeling area. The coordinates of the rainfall stations are calculated based on the area boundary. The process satisfies the expression: in, This indicates the coordinates of the rainfall station. Represents the rectangular boundary coordinates of the modeling area.

6. The method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, The process of configuring rain gauge attribute data is as follows: Set up rain gauge name identifiers and extract unified rain gauge identifiers based on the attributes of sub-catchment areas; If the extraction fails, the identifiers of the rain gauge and the sub-catchment area will be updated simultaneously. Configure the rainfall data format as INTENSITY in terms of intensity; configure the snowfall factor as the default value of 1; configure the data source type as TIMESERIES; configure the default identifier TS_1 for the time series name.

7. A method for vector data processing of drainage systems for SWMM modeling according to claim 6, characterized in that, The sampling interval for the rainfall time series is calculated and configured. The Interval column automatically detects the minimum time interval by parsing the Time column in the Excel file of the rainfall intensity time series and converts it to HH:MM format. Each time is then converted into minutes from midnight of the current day. The process satisfies the expression: in, This indicates time entries recorded in minutes. , , These represent the hours, minutes, and seconds of the time field in the original rainfall file, respectively. Calculate the interval between adjacent time steps and take the minimum time interval, then save it to the Interval column. The process satisfies the expression: in, The smallest time interval representing a rainfall time series. , These represent the i-th and i+1-th time items in the rainfall time series, respectively, in minutes.

8. A method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, The data in the rainfall intensity time series file is processed as follows: Convert the units of rainfall intensity to the default units that satisfy the SWMM model. The process satisfies the expression: in, Indicates rainfall intensity in millimeters per hour. Indicates rainfall intensity in inches per hour; The consistency of time intervals in the original rainfall time series files is detected and analyzed. If the minimum and maximum time intervals are inconsistent, linear interpolation is performed on the original time-rainfall intensity data based on the minimum interval to generate rainfall intensity sequences with equal time intervals. Among these, rainfall intensity... The calculation expression is: in, It represents any interpolation time; if a negative rainfall intensity value appears, it will be automatically corrected to 0; according to the rainfall time series name, the corresponding column will be added to the output file to generate a standardized Excel file.

9. A method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, The process of processing the tide time series file is as follows: If the outlet needs to consider the tidal effect, the tidal time series needs to be processed. The tidal time series includes the number of days and water level information. The water level information is converted into the default unit requirement that meets the SWMM model. The process satisfies the expression: in, Expresses the tide level value in feet. It represents the tide level value in meters; based on the tide time series name, it adds the corresponding column to the output file and generates a standardized Excel file.

10. A method for vector data processing of drainage systems for SWMM modeling according to claim 1, characterized in that, The vector data in the data file obtained after processing by S1 to S5 is loaded into the QGIS platform to generate an input file that conforms to the SWMM model standard format.