@@ -54,6 +54,116 @@ def data_preparation(data_name, data_entry, export_params):
54
54
)
55
55
export_params ['main_infiltration_method' ] = main_infiltration_method
56
56
return {'OPTIONS' : {'data' : options_df }}
57
+ elif data_name == 'SUBCATCHMENTS' :
58
+ from .g_s_subcatchments import get_subcatchments_from_layer
59
+ subcatchments_df , subareas_df , infiltration_df = get_subcatchments_from_layer (
60
+ data_entry ['data' ]['SUBCATCHMENTS' ].copy (),
61
+ export_params ['main_infiltration_method' ]
62
+ )
63
+ return {
64
+ 'SUBCATCHMENTS' : {'data' : subcatchments_df },
65
+ 'SUBAREAS' : {'data' : subareas_df },
66
+ 'INFILTRATION' : {'data' : infiltration_df }
67
+ }
68
+
69
+ elif data_name == 'CONDUITS' :
70
+ from .g_s_links import get_conduits_from_shapefile
71
+ conduits_df , xsections_df , losses_df = get_conduits_from_shapefile (
72
+ data_entry ['data' ]['CONDUITS' ].copy ()
73
+ )
74
+ return {
75
+ 'CONDUITS' : {'data' : conduits_df },
76
+ 'XSECTIONS' : {'data' : xsections_df },
77
+ 'LOSSES' : {'data' : losses_df }
78
+ }
79
+
80
+ elif data_name == 'PUMPS' :
81
+ from .g_s_links import get_pumps_from_shapefile
82
+ pumps_df = get_pumps_from_shapefile (data_entry ['data' ]['PUMPS' ].copy ())
83
+ return {'PUMPS' : {'data' : pumps_df }}
84
+
85
+ elif data_name == 'WEIRS' :
86
+ from .g_s_links import get_weirs_from_shapefile
87
+ weirs_df , xsections_df = get_weirs_from_shapefile (data_entry ['data' ]['WEIRS' ].copy ())
88
+ return {
89
+ 'WEIRS' : {'data' : weirs_df },
90
+ 'XSECTIONS' : {'data' : xsections_df }
91
+ }
92
+
93
+ elif data_name == 'OUTLETS' :
94
+ from .g_s_links import get_outlets_from_shapefile
95
+ outlets_df = get_outlets_from_shapefile (data_entry ['data' ]['OUTLETS' ].copy ())
96
+ return {'OUTLETS' : {'data' : outlets_df }}
97
+
98
+ elif data_name == 'ORIFICES' :
99
+ from .g_s_links import get_orifices_from_shapefile
100
+ orifices_df , xsections_df = get_orifices_from_shapefile (data_entry ['data' ]['ORIFICES' ].copy ())
101
+ return {
102
+ 'ORIFICES' : {'data' : orifices_df },
103
+ 'XSECTIONS' : {'data' : xsections_df }
104
+ }
105
+
106
+ elif data_name == 'JUNCTIONS' :
107
+ from .g_s_nodes import get_junctions_from_shapefile
108
+ junctions_df = get_junctions_from_shapefile (data_entry ['data' ]['JUNCTIONS' ].copy ())
109
+ return {'JUNCTIONS' : {'data' : junctions_df }}
110
+
111
+ elif data_name == 'OUTFALLS' :
112
+ from .g_s_nodes import get_outfalls_from_shapefile
113
+ outfalls_df = get_outfalls_from_shapefile (data_entry ['data' ]['OUTFALLS' ].copy ())
114
+ return {'OUTFALLS' : {'data' : outfalls_df }}
115
+
116
+ elif data_name == 'STORAGES' :
117
+ from .g_s_nodes import get_storages_from_shapefile
118
+ storages_df = get_storages_from_shapefile (data_entry ['data' ]['STORAGES' ].copy ())
119
+ return {'STORAGES' : {'data' : storages_df }}
120
+
121
+ elif data_name == 'DIVIDERS' :
122
+ from .g_s_nodes import get_dividers_from_shapefile
123
+ dividers_df = get_dividers_from_shapefile (data_entry ['data' ]['DIVIDERS' ].copy ())
124
+ return {'DIVIDERS' : {'data' : dividers_df }}
125
+
126
+ elif data_name == 'CURVES' :
127
+ from .g_s_export_helpers import get_curves_from_table
128
+ curves_dict = get_curves_from_table (
129
+ data_entry ['data' ]['CURVES' ],
130
+ name_col = 'Name'
131
+ )
132
+ return {'CURVES' : {'data' : curves_dict }}
133
+
134
+ elif data_name == 'PATTERNS' :
135
+ from .g_s_export_helpers import get_patterns_from_table
136
+ patterns_dict = get_patterns_from_table (
137
+ data_entry ['data' ]['PATTERNS' ],
138
+ name_col = 'Name'
139
+ )
140
+ return {'PATTERNS' : {'data' : patterns_dict }}
141
+
142
+ elif data_name == 'TIMESERIES' :
143
+ from .g_s_export_helpers import get_timeseries_from_table
144
+ timeseries_dict = get_timeseries_from_table (
145
+ data_entry ['data' ]['TIMESERIES' ],
146
+ name_col = 'Name' ,
147
+ feedback = export_params ['feedback' ]
148
+ )
149
+ return {'TIMESERIES' : {'data' : timeseries_dict }}
150
+
151
+ elif data_name == 'INFLOWS' :
152
+ from .g_s_nodes import get_inflows_from_table
153
+ inflows_dict = get_inflows_from_table (
154
+ data_entry ['data' ]['INFLOWS' ],
155
+ all_nodes ,
156
+ feedback = export_params ['feedback' ]
157
+ )
158
+ return {'INFLOWS' : {'data' : inflows_dict }}
159
+
160
+ elif data_name == 'QUALITY' :
161
+ from .g_s_quality import get_quality_params_from_table
162
+ quality_df = get_quality_params_from_table (data_entry ['data' ]['QUALITY' ].copy ())
163
+ return {'QUALITY' : {'data' : quality_df }}
164
+
165
+ else :
166
+ raise QgsProcessingException (f'Unknown data name: { data_name } ' )
57
167
58
168
# geometry functions
59
169
def check_nan (replace_lst ):
0 commit comments