@@ -16,13 +16,13 @@ def replace_last_occurrence(sFilename_path_in, sSubstring_in, sSubstring_out):
1616
1717
1818def basin_plot (self ,
19- iFlag_type_in ,
19+ iFlag_type_in ,
2020 sMesh_type ,
2121 sFilename_output_in = None ,
2222 sFilename_mesh_in = None ,
2323 iFont_size_in = None ,
2424 iFlag_title_in = None ,
25- iFlag_colorbar_in = None ,
25+ iFlag_colorbar_in = None ,
2626 iFlag_scientific_notation_colorbar_in = None ,
2727 iFlag_openstreetmap_in = None ,
2828 dData_min_in = None ,
@@ -46,7 +46,7 @@ def basin_plot(self,
4646 sFilename_mesh = self .sFilename_mesh
4747 else :
4848 sFilename_mesh = sFilename_mesh_in
49-
49+
5050
5151 if iFlag_type_in == 1 :
5252 #point based
@@ -64,10 +64,10 @@ def basin_plot(self,
6464 else :
6565 if iFlag_type_in == 3 :#polygon based
6666
67- self ._plot_polygon_variable ( sVariable_in ,
67+ self ._plot_polygon_variable ( sVariable_in ,
6868 iFlag_title_in = iFlag_title_in ,
6969 iFont_size_in = iFont_size_in ,
70- iFlag_colorbar_in = iFlag_colorbar_in ,
70+ iFlag_colorbar_in = iFlag_colorbar_in ,
7171 iFlag_scientific_notation_colorbar_in = iFlag_scientific_notation_colorbar_in ,
7272 dData_min_in = dData_min_in ,
7373 dData_max_in = dData_max_in ,
@@ -96,19 +96,19 @@ def basin_plot(self,
9696 sFilename0 = self .sFilename_flow_direction #this can be either domain wide or subbasin level
9797 #should use the pyflowline simplified flowline
9898 sFilename_dummy = self .sFilename_flowline_simplified
99- #now replace the folder string
99+ #now replace the folder string
100100 sFilename1 = replace_last_occurrence (sFilename_dummy , 'hexwatershed' , 'pyflowline' )
101101 sFilename_dummy = self .sFilename_flowline_conceptual
102- #now replace the folder string
102+ #now replace the folder string
103103 sFilename2 = replace_last_occurrence (sFilename_dummy , 'hexwatershed' , 'pyflowline' )
104104
105105 aFiletype_in = [2 , 2 , 2 ]
106106 aFilename_in = [sFilename0 , sFilename1 , sFilename2 ]
107107 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 ,
112112 sFilename_output_in = sFilename_output_in ,
113113 sTitle_in = 'Flow direction with observation' ,
114114 aFlag_thickness_in = [1 , 0 , 0 ],
@@ -126,30 +126,30 @@ def basin_plot(self,
126126 aFiletype_in = [3 , 2 ]
127127 aFilename_in = [sFilename0 , sFilename1 ]
128128 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 ,
133133 sFilename_output_in = sFilename_output_in ,
134134 sTitle_in = 'Flow direction with hillslope' ,
135135 aData_min_in = [1 , 1 ],
136136 aFlag_thickness_in = [0 , 1 ],
137- aFlag_discrete_in = [1 ,0 ],
137+ aFlag_discrete_in = [1 ,0 ],
138138 aVariable_in = ['hillslope' , 'drainage_area' ],
139139 aLegend_in = aLegend_in ,
140140 aFlag_color_in = [1 , 0 ],
141141 aFlag_fill_in = [1 , 0 ],
142142 aExtent_in = aExtent_in ,
143143 pProjection_map_in = pProjection_map_in )
144-
144+
145145 else :
146146 print ('Unsupported variable: ' , sVariable_in , ' in basin_plot.' )
147- return
148-
147+ return
148+
149149 pass
150150 else :
151151 #unsupported
152- pass
152+ pass
153153
154154 return
155155
@@ -165,12 +165,16 @@ def _plot_polyline_variable(self,
165165 aExtent_in = None ,
166166 aLegend_in = None ,
167167 pProjection_map_in = None ):
168-
169-
168+
169+
170170
171171
172172 iFlag_label = 0
173+ iFlag_discrete = 0
173174 iFlag_thickness = 0
175+ iFlag_color = 0
176+ sField_thickness = None
177+ sField_color = None
174178 if sVariable_in is not None :
175179 if sVariable_in == 'flowline_raw' :
176180 sFilename_json = self .sFilename_flowline_raw
@@ -182,28 +186,32 @@ def _plot_polyline_variable(self,
182186 if sVariable_in == 'flowline_filter' :
183187 sFilename_json = self .sFilename_flowline_filter
184188 sTitle = 'Filtered flowline'
185- iFlag_color = 0
189+ iFlag_color = 0
186190 iFlag_thickness = 0
187191 sField_thickness = None
188192 else :
189193 if sVariable_in == 'flowline_simplified' :
190- sFilename_json = self .sFilename_flowline_simplified
194+ sFilename_json = self .sFilename_flowline_simplified
191195 sTitle = 'Simplified flowline'
192196 iFlag_color = 1
193197 iFlag_thickness = 0
198+ iFlag_discrete = 1
194199 sField_thickness = None
200+ sField_color = 'lineid'
195201
196202 if aExtent_in is None :
197203 iFlag_label = 1
198204 else :
199205 iFlag_label = 0
200206 else :
201207 if sVariable_in == 'flowline_conceptual' :
202- sFilename_json = self .sFilename_flowline_conceptual
208+ sFilename_json = self .sFilename_flowline_conceptual
203209 sTitle = 'Conceptual flowline'
204210 iFlag_color = 1
205211 iFlag_thickness = 0
212+ iFlag_discrete = 1
206213 sField_thickness = None
214+ sField_color = 'lineid'
207215
208216 if aExtent_in is None :
209217 iFlag_label = 1
@@ -213,13 +221,13 @@ def _plot_polyline_variable(self,
213221 if sVariable_in == 'flow_direction' :
214222 sFilename_json = self .sFilename_flow_direction
215223 iFlag_label = 0
216- iFlag_color = 0
217- iFlag_thickness = 1
224+ iFlag_color = 0
225+ iFlag_thickness = 1
218226 sField_thickness = 'drainage_area'
219- sTitle = 'Flow direction'
227+ sTitle = 'Flow direction'
220228 else :
221229 if sVariable_in == 'aof' :
222- sFilename_json = self .sFilename_area_of_difference
230+ sFilename_json = self .sFilename_area_of_difference
223231 sTitle = 'Conceptual flowline'
224232 iFlag_label = 1
225233 self ._plot_area_of_difference ( sFilename_output_in ,
@@ -233,29 +241,32 @@ def _plot_polyline_variable(self,
233241 #default
234242 print ('A variable is needed.' )
235243 return
236-
237- if iFlag_title_in is not None :
244+
245+ if iFlag_title_in is not None :
238246 if iFlag_title_in == 0 :
239247 sTitle = ''
240248 else :
241249 pass
242- else :
250+ else :
243251 sTitle = ''
244252 pass
245-
246-
253+
254+
247255 map_vector_polyline_data (1 , sFilename_json ,
248- sFilename_output_in = sFilename_output_in ,
256+ sFilename_output_in = sFilename_output_in ,
249257 iFlag_thickness_in = iFlag_thickness ,
250- sTitle_in = sTitle ,
251258 iFlag_color_in = iFlag_color ,
259+ iFlag_discrete_in = iFlag_discrete ,
260+ sTitle_in = sTitle ,
261+ iFlag_zebra_in = 1 ,
252262 iFlag_label_in = iFlag_label ,
253- iFont_size_in = iFont_size_in ,
263+ iFont_size_in = iFont_size_in ,
254264 sField_thickness_in = sField_thickness ,
265+ sField_color_in = sField_color ,
255266 aExtent_in = aExtent_in ,
256267 aLegend_in = aLegend_in ,
257268 pProjection_map_in = pProjection_map_in )
258-
269+
259270def _plot_polygon_variable (self ,
260271 sVariable_in ,
261272 iFigwidth_in = None ,
@@ -283,11 +294,11 @@ def _plot_polygon_variable(self,
283294 dData_min_in (_type_, optional): _description_. Defaults to None.
284295 dData_max_in (_type_, optional): _description_. Defaults to None.
285296 """
286-
297+
287298 sMesh_type = self .sMesh_type
288299 iFiletype = 1 #most file are geojson, but some are parquet
289300 iFlag_integer_in = 0 #most variable are real, if not, it will be set to 1
290-
301+
291302 if sMesh_type == 'mpas' :
292303 #start with integer
293304 if sVariable_in == 'subbasin' :
@@ -319,7 +330,7 @@ def _plot_polygon_variable(self,
319330 sUnit = 'Unit: m'
320331 sColormap = 'terrain'
321332 dData_min = dData_min_in
322- dData_max = dData_max_in
333+ dData_max = dData_max_in
323334 sFilename = self .sFilename_variable_polygon
324335 else :
325336 if sVariable_in == 'drainage_area' :
@@ -330,6 +341,7 @@ def _plot_polygon_variable(self,
330341 dData_max = dData_max_in
331342 sColormap = 'Spectral_r'
332343 sFilename = self .sFilename_variable_polygon
344+ iFlag_scientific_notation_colorbar_in = 1
333345 else :
334346 if sVariable_in == 'travel_distance' :
335347 sVariable = 'travel_distance'
@@ -339,6 +351,7 @@ def _plot_polygon_variable(self,
339351 dData_max = dData_max_in
340352 sColormap = 'Spectral_r'
341353 sFilename = self .sFilename_variable_polygon
354+ iFlag_scientific_notation_colorbar_in = 1
342355 else :
343356 if sVariable == 'slope' :
344357 sTitle = 'Surface slope'
@@ -350,7 +363,7 @@ def _plot_polygon_variable(self,
350363 else :
351364 pass
352365
353-
366+
354367 else :
355368 if sVariable_in == 'subbasin' :
356369 iFlag_integer_in = 1
@@ -401,6 +414,7 @@ def _plot_polygon_variable(self,
401414 dData_max = dData_max_in
402415 sColormap = 'Spectral_r'
403416 sFilename = self .sFilename_variable_polygon
417+ iFlag_scientific_notation_colorbar_in = 1
404418
405419 else :
406420 if sVariable_in == 'travel_distance' :
@@ -409,8 +423,9 @@ def _plot_polygon_variable(self,
409423 sUnit = r'Unit: m'
410424 dData_min = 0.0
411425 dData_max = dData_max_in
412- sColormap = 'Spectral_r'
426+ sColormap = 'Spectral_r'
413427 sFilename = self .sFilename_variable_polygon
428+ iFlag_scientific_notation_colorbar_in = 1
414429 else :
415430 if sVariable_in == 'slope' :
416431 sVariable = 'slope'
@@ -423,13 +438,13 @@ def _plot_polygon_variable(self,
423438 else :
424439 pass
425440 pass
426-
427- if iFlag_title_in is not None :
441+
442+ if iFlag_title_in is not None :
428443 if iFlag_title_in == 0 :
429444 sTitle = ''
430445 else :
431446 pass
432- else :
447+ else :
433448 sTitle = ''
434449 pass
435450
@@ -438,7 +453,8 @@ def _plot_polygon_variable(self,
438453 iFlag_colorbar_in = iFlag_colorbar_in ,
439454 iFont_size_in = iFont_size_in ,
440455 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 ,
442458 dData_max_in = dData_max ,
443459 dData_min_in = dData_min ,
444460 sFilename_output_in = sFilename_output_in ,
@@ -466,7 +482,7 @@ def _plot_mesh_with_flowline(self,
466482 aFiletype_in .append (3 )
467483 aFlag_color .append (0 )
468484
469-
485+
470486 dummy = self .sFilename_flowline_conceptual
471487 sFilename_json = os .path .join (self .sWorkspace_output_basin , dummy )
472488 aFilename_in .append (sFilename_json )
@@ -514,7 +530,7 @@ def _plot_mesh_with_flow_direction(self,
514530#this is a reserved function
515531def _plot_area_of_difference (self , sFilename_figure_in , aExtent_in = None , pProjection_map_in = None ):
516532
517- sFilename_json = self .sFilename_area_of_difference
533+ sFilename_json = self .sFilename_area_of_difference
518534
519535 sFilename_in = self .sFilename_mesh
520536 sFilename_out = sFilename_figure_in
0 commit comments