-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparameters.py.cs
More file actions
379 lines (266 loc) · 11.2 KB
/
parameters.py.cs
File metadata and controls
379 lines (266 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
namespace ArcSWAT3
{
public class Parameters
{
public static bool useSlowPolygonize = false;
public bool isBatch;
public string mpiexecDir;
public string numProcesses;
public string SWATEditorDir;
public GlobalVars _gv;
public ParamForm _dlg;
public static string _SWATEDITOR = "SwatEditor.exe";
public static string _SWATEDITORDEFAULTDIR = "C:\\SWAT\\SWATEditor";
public static string _SWATEDITORVERSION = "2012.10.19";
public static string _MPIEXEC = "mpiexec.exe";
public static string _MPIEXECDEFAULTDIR = "C:\\Program Files\\Microsoft MPI\\Bin";
public static string _TAUDEMDIR = "TauDEM5Bin";
public static string _TAUDEM539DIR = "TauDEM539Bin";
public static string _TAUDEMHELP = "TauDEM_Tools.chm";
public static string _SWATGRAPH = "SWATGraph";
public static string _DBDIR = "Databases";
public static string _DBPROJ = "ArcSWATProj2012.mdb";
public static string _DBREF = "QSWATRef2012.mdb";
public static string _TNCDBPROJ = "QSWATProj2012_TNC.sqlite";
public static string _TNCDBREF = "QSWATRef2012_TNC.sqlite";
public static string _TNCFAOLOOKUP = "FAO_soils_TNC";
public static string _TNCFAOUSERSOIL = "usersoil_FAO";
public static string _TNCHWSDLOOKUP = "HWSD_soils_TNC";
public static string _TNCHWSDUSERSOIL = "usersoil_HWSD";
public static string _ACCESSSTRING = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=";
public static string _TABLESOUT = "TablesOut";
public static string _ANIMATION = "Animation";
public static string _PNG = "Png";
public static string _STILLBASE = "still.gif";
public static string _STILLJPG = "still.jpg";
public static string _STILLPNG = "still.png";
public static string _TXTINOUT = "TxtInOut";
public static string _SSURGODB = "SWAT_US_SSURGO_Soils.mdb";
public static string _SSURGODB_HUC = "SSURGO_Soils_HUC.sqlite";
public static int _SSURGOWater = 377988;
public static string _WATERBODIES = "WaterBodies.sqlite";
public static string _USSOILDB = "SWAT_US_Soils.mdb";
public static string _CIO = "file.cio";
public static string _OUTPUTDB = "SWATOutput.mdb";
public static string _SUBS = "subs";
public static string _RIVS = "rivs";
public static string _HRUS = "hrus";
public static string _SUBS1 = "subs1";
public static string _RIV1 = "riv1";
public static string _HRU0 = "hru0";
public static string _HRUS1 = "hrus1";
public static string _HRUS2 = "hrus2";
public static string _HRUSRASTER = "hrus.tif";
public static string _HRUSCSV = "hrus.csv";
public static string _TOPOREPORT = "TopoRep.txt";
public static string _TOPOITEM = "Elevation";
public static string _BASINREPORT = "LanduseSoilSlopeRepSwat.txt";
public static string _BASINITEM = "Landuse and Soil";
public static string _HRUSREPORT = "HruLanduseSoilSlopeRepSwat.txt";
public static string _ARCHRUSREPORT = "HRULandUseSoilsReport.txt";
public static string _ARCBASINREPORT = "LandUseSoilsReport.txt";
public static string _HRUSITEM = "HRUs";
public static string _USECSV = "Use csv file";
public static string _LANDUSE = "LANDUSE";
public static string _SOIL = "SOIL";
public static string _SLOPEBAND = "SLOPE_BAND";
public static string _AREA = "AREA (ha)";
public static string _PERCENT = "%SUBBASIN";
public static string _SQKM = "sq. km";
public static string _HECTARES = "hectares";
public static string _SQMETRES = "sq. metres";
public static string _SQMILES = "sq. miles";
public static string _ACRES = "acres";
public static string _SQFEET = "sq. feet";
public static string _METRES = "metres";
public static string _FEET = "feet";
public static string _FEET_US = "feet_us";
public static string _CM = "centimetres";
public static string _MM = "millimetres";
public static string _INCHES = "inches";
public static string _YARDS = "yards";
public static string _DEGREES = "degrees";
public static string _UNKNOWN = "unknown";
public static double _FEETTOMETRES = 0.3048;
public static double _CMTOMETRES = 0.01;
public static double _MMTOMETRES = 0.001;
public static double _INCHESTOMETRES = 0.0254;
public static double _YARDSTOMETRES = 0.91441;
public static double _SQMILESTOSQMETRES = 2589988.1;
public static double _ACRESTOSQMETRES = 4046.8564;
public static double _SQMETRESTOSQFEET = 10.76391;
public static int _RIV1SUBS1MAX = 1000;
public static double _NEARNESSTHRESHOLD = 0.1;
public static HashSet<string> _WATERLANDUSES = new HashSet<string> {
"WATR",
"WETN",
"WETF",
"RIWF",
"UPWF",
"RIWN",
"UPWN"
};
public static double _WATERMAXSLOPE = 1E-05;
public static HashSet<string> _TNCWATERLANDUSES = new HashSet<string> {
"WEWO",
"WETL",
"WEHB",
"WATR",
"TWEW",
"TWET",
"TWEH"
};
public static int _TNCFAOWATERSOIL = 6997;
public static HashSet<int> _TNCFAOWATERSOILS = new HashSet<int> {
6997,
1972
};
public static int _TNCHWSDWATERSOIL = 39997;
public static HashSet<int> _TNCHWSDWATERSOILS = new HashSet<int> {
39997,
34972
};
public static double _GRIDDEFAULTSLOPE = 0.005;
public static double _RICEMAXSLOPE = 0.005;
public static Dictionary<string, ValueTuple<double, double, double, double>> TNCExtents = new Dictionary<string, ValueTuple<double, double, double, double>> {
{
"CentralAmerica",
(-92.3, 7.2, -59.4, 23.2)},
{
"NorthAmerica",
(-178.3, 0, -29.9, 60.0)},
{
"SouthAmerica",
(-109.7, -56.2, -34.5, 12.9)},
{
"Australia",
(89.9, -55.0, 180, 0)},
{
"Africa",
(-25.6, -35.1, 60.1, 37.6)},
{
"Europe",
(-31.6, 34.3, 69.9, 60.0)},
{
"Asia",
(-0.1, -11.1, 180, 60.0)}};
public static string wgnDb = "swatplus_wgn.sqlite";
public static string CHIRPSDir = "CHIRPS";
public static Dictionary<string, List<string>> CHIRPSStationsCsv = new Dictionary<string, List<string>> {
{
"CentralAmerica",
new List<string> {
"north_america_grids.csv",
"south_america_grids.csv"
}},
{
"NorthAmerica",
new List<string> {
"north_america_grids.csv"
}},
{
"SouthAmerica",
new List<string> {
"south_america_grids.csv"
}},
{
"Australia",
new List<string> {
"australia_grids.csv",
"asia_02_grids.csv"
}},
{
"Africa",
new List<string> {
"africa_grids.csv"
}},
{
"Europe",
new List<string> {
"europe_grids.csv",
"asia_01_grids.csv",
"asia_02_grids.csv"
}},
{
"Asia",
new List<string> {
"europe_grids.csv",
"asia_01_grids.csv",
"asia_02_grids.csv"
}}};
public static string ERA5Dir = "ERA5";
public static string ERA5GridsDir = "Weather";
public static Dictionary<string, List<string>> ERA5StationsCsv = new Dictionary<string, List<string>> {
{
"CentralAmerica",
new List<string> {
"north_america_grids.csv",
"south_america_grids.csv"
}},
{
"NorthAmerica",
new List<string> {
"north_america_grids.csv"
}},
{
"SouthAmerica",
new List<string> {
"south_america_grids.csv"
}},
{
"Australia",
new List<string> {
"australia_grids.csv",
"asia_grids.csv"
}},
{
"Africa",
new List<string> {
"africa_grids.csv"
}},
{
"Europe",
new List<string> {
"europe_grids.csv"
}},
{
"Asia",
new List<string> {
"europe_grids.csv",
"asia_grids.csv"
}}};
public Parameters(GlobalVars gv)
{
//var settings = QSettings();
//# SWAT Editor directory
//this.SWATEditorDir = settings.value("/QSWAT/SWATEditorDir", _SWATEDITORDEFAULTDIR);
this.SWATEditorDir = _SWATEDITORDEFAULTDIR;
//# mpiexec directory
//this.mpiexecDir = settings.value("/QSWAT/mpiexecDir", _MPIEXECDEFAULTDIR);
this.mpiexecDir = _MPIEXECDEFAULTDIR;
//# number of MPI processes
//this.numProcesses = settings.value("/QSWAT/NumProcesses", "");
this.numProcesses = "";
this._gv = gv;
this._dlg = new ParamForm(gv, this.SWATEditorDir, this.mpiexecDir);
//this._dlg.setWindowFlags(this._dlg.windowFlags() & ~Qt.WindowContextHelpButtonHint);
if (this._gv is not null)
{
//this._dlg.move(this._gv.parametersPos);
//# flag showing if batch run
this.isBatch = this._gv.isBatch;
}
else
{
this.isBatch = false;
}
}
public void run() {
this._dlg.ShowDialog();
}
}
}