@@ -16,13 +16,13 @@ def replace_last_occurrence(sFilename_path_in, sSubstring_in, sSubstring_out):
16
16
17
17
18
18
def basin_plot (self ,
19
- iFlag_type_in ,
19
+ iFlag_type_in ,
20
20
sMesh_type ,
21
21
sFilename_output_in = None ,
22
22
sFilename_mesh_in = None ,
23
23
iFont_size_in = None ,
24
24
iFlag_title_in = None ,
25
- iFlag_colorbar_in = None ,
25
+ iFlag_colorbar_in = None ,
26
26
iFlag_scientific_notation_colorbar_in = None ,
27
27
iFlag_openstreetmap_in = None ,
28
28
dData_min_in = None ,
@@ -46,7 +46,7 @@ def basin_plot(self,
46
46
sFilename_mesh = self .sFilename_mesh
47
47
else :
48
48
sFilename_mesh = sFilename_mesh_in
49
-
49
+
50
50
51
51
if iFlag_type_in == 1 :
52
52
#point based
@@ -64,10 +64,10 @@ def basin_plot(self,
64
64
else :
65
65
if iFlag_type_in == 3 :#polygon based
66
66
67
- self ._plot_polygon_variable ( sVariable_in ,
67
+ self ._plot_polygon_variable ( sVariable_in ,
68
68
iFlag_title_in = iFlag_title_in ,
69
69
iFont_size_in = iFont_size_in ,
70
- iFlag_colorbar_in = iFlag_colorbar_in ,
70
+ iFlag_colorbar_in = iFlag_colorbar_in ,
71
71
iFlag_scientific_notation_colorbar_in = iFlag_scientific_notation_colorbar_in ,
72
72
dData_min_in = dData_min_in ,
73
73
dData_max_in = dData_max_in ,
@@ -96,19 +96,19 @@ def basin_plot(self,
96
96
sFilename0 = self .sFilename_flow_direction #this can be either domain wide or subbasin level
97
97
#should use the pyflowline simplified flowline
98
98
sFilename_dummy = self .sFilename_flowline_simplified
99
- #now replace the folder string
99
+ #now replace the folder string
100
100
sFilename1 = replace_last_occurrence (sFilename_dummy , 'hexwatershed' , 'pyflowline' )
101
101
sFilename_dummy = self .sFilename_flowline_conceptual
102
- #now replace the folder string
102
+ #now replace the folder string
103
103
sFilename2 = replace_last_occurrence (sFilename_dummy , 'hexwatershed' , 'pyflowline' )
104
104
105
105
aFiletype_in = [2 , 2 , 2 ]
106
106
aFilename_in = [sFilename0 , sFilename1 , sFilename2 ]
107
107
map_multiple_vector_data (aFiletype_in ,
108
- aFilename_in ,
109
- iFlag_title_in = iFlag_title_in ,
110
- iFont_size_in = iFont_size_in ,
111
- iFlag_openstreetmap_in = iFlag_openstreetmap_in ,
108
+ aFilename_in ,
109
+ iFlag_title_in = iFlag_title_in ,
110
+ iFont_size_in = iFont_size_in ,
111
+ iFlag_openstreetmap_in = iFlag_openstreetmap_in ,
112
112
sFilename_output_in = sFilename_output_in ,
113
113
sTitle_in = 'Flow direction with observation' ,
114
114
aFlag_thickness_in = [1 , 0 , 0 ],
@@ -126,30 +126,30 @@ def basin_plot(self,
126
126
aFiletype_in = [3 , 2 ]
127
127
aFilename_in = [sFilename0 , sFilename1 ]
128
128
map_multiple_vector_data (aFiletype_in ,
129
- aFilename_in ,
130
- iFlag_title_in = iFlag_title_in ,
131
- iFont_size_in = iFont_size_in ,
132
- iFlag_openstreetmap_in = iFlag_openstreetmap_in ,
129
+ aFilename_in ,
130
+ iFlag_title_in = iFlag_title_in ,
131
+ iFont_size_in = iFont_size_in ,
132
+ iFlag_openstreetmap_in = iFlag_openstreetmap_in ,
133
133
sFilename_output_in = sFilename_output_in ,
134
134
sTitle_in = 'Flow direction with hillslope' ,
135
135
aData_min_in = [1 , 1 ],
136
136
aFlag_thickness_in = [0 , 1 ],
137
- aFlag_discrete_in = [1 ,0 ],
137
+ aFlag_discrete_in = [1 ,0 ],
138
138
aVariable_in = ['hillslope' , 'drainage_area' ],
139
139
aLegend_in = aLegend_in ,
140
140
aFlag_color_in = [1 , 0 ],
141
141
aFlag_fill_in = [1 , 0 ],
142
142
aExtent_in = aExtent_in ,
143
143
pProjection_map_in = pProjection_map_in )
144
-
144
+
145
145
else :
146
146
print ('Unsupported variable: ' , sVariable_in , ' in basin_plot.' )
147
- return
148
-
147
+ return
148
+
149
149
pass
150
150
else :
151
151
#unsupported
152
- pass
152
+ pass
153
153
154
154
return
155
155
@@ -165,12 +165,16 @@ def _plot_polyline_variable(self,
165
165
aExtent_in = None ,
166
166
aLegend_in = None ,
167
167
pProjection_map_in = None ):
168
-
169
-
168
+
169
+
170
170
171
171
172
172
iFlag_label = 0
173
+ iFlag_discrete = 0
173
174
iFlag_thickness = 0
175
+ iFlag_color = 0
176
+ sField_thickness = None
177
+ sField_color = None
174
178
if sVariable_in is not None :
175
179
if sVariable_in == 'flowline_raw' :
176
180
sFilename_json = self .sFilename_flowline_raw
@@ -182,28 +186,32 @@ def _plot_polyline_variable(self,
182
186
if sVariable_in == 'flowline_filter' :
183
187
sFilename_json = self .sFilename_flowline_filter
184
188
sTitle = 'Filtered flowline'
185
- iFlag_color = 0
189
+ iFlag_color = 0
186
190
iFlag_thickness = 0
187
191
sField_thickness = None
188
192
else :
189
193
if sVariable_in == 'flowline_simplified' :
190
- sFilename_json = self .sFilename_flowline_simplified
194
+ sFilename_json = self .sFilename_flowline_simplified
191
195
sTitle = 'Simplified flowline'
192
196
iFlag_color = 1
193
197
iFlag_thickness = 0
198
+ iFlag_discrete = 1
194
199
sField_thickness = None
200
+ sField_color = 'lineid'
195
201
196
202
if aExtent_in is None :
197
203
iFlag_label = 1
198
204
else :
199
205
iFlag_label = 0
200
206
else :
201
207
if sVariable_in == 'flowline_conceptual' :
202
- sFilename_json = self .sFilename_flowline_conceptual
208
+ sFilename_json = self .sFilename_flowline_conceptual
203
209
sTitle = 'Conceptual flowline'
204
210
iFlag_color = 1
205
211
iFlag_thickness = 0
212
+ iFlag_discrete = 1
206
213
sField_thickness = None
214
+ sField_color = 'lineid'
207
215
208
216
if aExtent_in is None :
209
217
iFlag_label = 1
@@ -213,13 +221,13 @@ def _plot_polyline_variable(self,
213
221
if sVariable_in == 'flow_direction' :
214
222
sFilename_json = self .sFilename_flow_direction
215
223
iFlag_label = 0
216
- iFlag_color = 0
217
- iFlag_thickness = 1
224
+ iFlag_color = 0
225
+ iFlag_thickness = 1
218
226
sField_thickness = 'drainage_area'
219
- sTitle = 'Flow direction'
227
+ sTitle = 'Flow direction'
220
228
else :
221
229
if sVariable_in == 'aof' :
222
- sFilename_json = self .sFilename_area_of_difference
230
+ sFilename_json = self .sFilename_area_of_difference
223
231
sTitle = 'Conceptual flowline'
224
232
iFlag_label = 1
225
233
self ._plot_area_of_difference ( sFilename_output_in ,
@@ -233,29 +241,32 @@ def _plot_polyline_variable(self,
233
241
#default
234
242
print ('A variable is needed.' )
235
243
return
236
-
237
- if iFlag_title_in is not None :
244
+
245
+ if iFlag_title_in is not None :
238
246
if iFlag_title_in == 0 :
239
247
sTitle = ''
240
248
else :
241
249
pass
242
- else :
250
+ else :
243
251
sTitle = ''
244
252
pass
245
-
246
-
253
+
254
+
247
255
map_vector_polyline_data (1 , sFilename_json ,
248
- sFilename_output_in = sFilename_output_in ,
256
+ sFilename_output_in = sFilename_output_in ,
249
257
iFlag_thickness_in = iFlag_thickness ,
250
- sTitle_in = sTitle ,
251
258
iFlag_color_in = iFlag_color ,
259
+ iFlag_discrete_in = iFlag_discrete ,
260
+ sTitle_in = sTitle ,
261
+ iFlag_zebra_in = 1 ,
252
262
iFlag_label_in = iFlag_label ,
253
- iFont_size_in = iFont_size_in ,
263
+ iFont_size_in = iFont_size_in ,
254
264
sField_thickness_in = sField_thickness ,
265
+ sField_color_in = sField_color ,
255
266
aExtent_in = aExtent_in ,
256
267
aLegend_in = aLegend_in ,
257
268
pProjection_map_in = pProjection_map_in )
258
-
269
+
259
270
def _plot_polygon_variable (self ,
260
271
sVariable_in ,
261
272
iFigwidth_in = None ,
@@ -283,11 +294,11 @@ def _plot_polygon_variable(self,
283
294
dData_min_in (_type_, optional): _description_. Defaults to None.
284
295
dData_max_in (_type_, optional): _description_. Defaults to None.
285
296
"""
286
-
297
+
287
298
sMesh_type = self .sMesh_type
288
299
iFiletype = 1 #most file are geojson, but some are parquet
289
300
iFlag_integer_in = 0 #most variable are real, if not, it will be set to 1
290
-
301
+
291
302
if sMesh_type == 'mpas' :
292
303
#start with integer
293
304
if sVariable_in == 'subbasin' :
@@ -319,7 +330,7 @@ def _plot_polygon_variable(self,
319
330
sUnit = 'Unit: m'
320
331
sColormap = 'terrain'
321
332
dData_min = dData_min_in
322
- dData_max = dData_max_in
333
+ dData_max = dData_max_in
323
334
sFilename = self .sFilename_variable_polygon
324
335
else :
325
336
if sVariable_in == 'drainage_area' :
@@ -330,6 +341,7 @@ def _plot_polygon_variable(self,
330
341
dData_max = dData_max_in
331
342
sColormap = 'Spectral_r'
332
343
sFilename = self .sFilename_variable_polygon
344
+ iFlag_scientific_notation_colorbar_in = 1
333
345
else :
334
346
if sVariable_in == 'travel_distance' :
335
347
sVariable = 'travel_distance'
@@ -339,6 +351,7 @@ def _plot_polygon_variable(self,
339
351
dData_max = dData_max_in
340
352
sColormap = 'Spectral_r'
341
353
sFilename = self .sFilename_variable_polygon
354
+ iFlag_scientific_notation_colorbar_in = 1
342
355
else :
343
356
if sVariable == 'slope' :
344
357
sTitle = 'Surface slope'
@@ -350,7 +363,7 @@ def _plot_polygon_variable(self,
350
363
else :
351
364
pass
352
365
353
-
366
+
354
367
else :
355
368
if sVariable_in == 'subbasin' :
356
369
iFlag_integer_in = 1
@@ -401,6 +414,7 @@ def _plot_polygon_variable(self,
401
414
dData_max = dData_max_in
402
415
sColormap = 'Spectral_r'
403
416
sFilename = self .sFilename_variable_polygon
417
+ iFlag_scientific_notation_colorbar_in = 1
404
418
405
419
else :
406
420
if sVariable_in == 'travel_distance' :
@@ -409,8 +423,9 @@ def _plot_polygon_variable(self,
409
423
sUnit = r'Unit: m'
410
424
dData_min = 0.0
411
425
dData_max = dData_max_in
412
- sColormap = 'Spectral_r'
426
+ sColormap = 'Spectral_r'
413
427
sFilename = self .sFilename_variable_polygon
428
+ iFlag_scientific_notation_colorbar_in = 1
414
429
else :
415
430
if sVariable_in == 'slope' :
416
431
sVariable = 'slope'
@@ -423,13 +438,13 @@ def _plot_polygon_variable(self,
423
438
else :
424
439
pass
425
440
pass
426
-
427
- if iFlag_title_in is not None :
441
+
442
+ if iFlag_title_in is not None :
428
443
if iFlag_title_in == 0 :
429
444
sTitle = ''
430
445
else :
431
446
pass
432
- else :
447
+ else :
433
448
sTitle = ''
434
449
pass
435
450
@@ -438,7 +453,8 @@ def _plot_polygon_variable(self,
438
453
iFlag_colorbar_in = iFlag_colorbar_in ,
439
454
iFont_size_in = iFont_size_in ,
440
455
iFlag_scientific_notation_colorbar_in = iFlag_scientific_notation_colorbar_in ,
441
- iFlag_discrete_in = iFlag_integer_in ,
456
+ iFlag_discrete_in = iFlag_integer_in ,
457
+ iFlag_zebra_in = 1 ,
442
458
dData_max_in = dData_max ,
443
459
dData_min_in = dData_min ,
444
460
sFilename_output_in = sFilename_output_in ,
@@ -466,7 +482,7 @@ def _plot_mesh_with_flowline(self,
466
482
aFiletype_in .append (3 )
467
483
aFlag_color .append (0 )
468
484
469
-
485
+
470
486
dummy = self .sFilename_flowline_conceptual
471
487
sFilename_json = os .path .join (self .sWorkspace_output_basin , dummy )
472
488
aFilename_in .append (sFilename_json )
@@ -514,7 +530,7 @@ def _plot_mesh_with_flow_direction(self,
514
530
#this is a reserved function
515
531
def _plot_area_of_difference (self , sFilename_figure_in , aExtent_in = None , pProjection_map_in = None ):
516
532
517
- sFilename_json = self .sFilename_area_of_difference
533
+ sFilename_json = self .sFilename_area_of_difference
518
534
519
535
sFilename_in = self .sFilename_mesh
520
536
sFilename_out = sFilename_figure_in
0 commit comments