-
Notifications
You must be signed in to change notification settings - Fork 6
Application procedure for post processing tools
The requred input dataset are the lake river routing product generated by this toolbox (See example dataset and following figures).The required inputs including: catchment polygon shpfile, river network polyline shpfine and Connected lake polygon and None connected lake polygon shpfile. The catchment polygon shpfile
Figure 1: Example inputs datasets for post processing, including catchment polygon shpfile, river network polyline shpfine and Connected lake polygon and None connected lake polygon shpfile. The Observation point or point of interest is optional. CL represnet for connected lake, while NCL represent for none connected lake
Tools to extract region of interest from the generated lake-river routing product (Input in Figure 1)
In this part, two tools will be introduced "Locate_subid_needsbyuser" and "Select_Routing_product_based_SubId", respectively.
This tools will return a sub-basin Id of the catchment in routing products based on user provided observation gauge name or a point shapefile.
Subids = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Guage_NMS =Gauge_Name_List)
or
Subids = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Path_Points =Path_Points)
### import routing toolbox
from ToolboxClass import LRRT
########### Define folder directories, Data folder is the folder where routing product is located, and Outputfolder is the folder where to save output of the results
Datafolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/WoodLake/"
Outputfolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/"
########### Define requried inputs
Path_Con_Lake_ply = os.path.join(Datafolder,'Con_Lake_Ply.shp') ### Connected lake polygons
Path_NonCon_Lake_ply = os.path.join(Datafolder,'Non_Con_Lake_Ply.shp') ### None connected lake polygons
Path_final_riv_ply = os.path.join(Datafolder,'finalriv_info_ply.shp') ### River polyline
Path_final_riv = os.path.join(Datafolder,'finalriv_info.shp') ### Catchment polygons
Point_of_Interest = os.path.join(Datafolder,'obspoint.shp') ### point of the interest
########### Define a project Name
ProjectName = 'Select_By_Gauge_Name'
########### Initialize the toolbox
RTtool=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
### find subids of observation guage 05PB009
SubIds = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Guage_NMS = ['05PB009'])
This tools will use user provided subbasin id or subbasin id generated by Locate_subid_needsbyuser to extract all the subbasins drainage to this subid. Assuming the subid is 2491, The output will be located at './Example_folder/SubId_1000532/'
RTtool.Select_Routing_product_based_SubId(Path_Con_Lake_ply = Path_Con_Lake_ply,Path_NonCon_Lake_ply= Path_NonCon_Lake_ply,Path_final_riv_ply = Path_final_riv_ply, Path_final_riv = Path_final_riv, mostdownid = [Subids[0]])
### import routing toolbox
from ToolboxClass import LRRT
########### Define requried inputs
Path_Con_Lake_ply = os.path.join(Datafolder,'Con_Lake_Ply.shp') ### Connected lake polygons
Path_NonCon_Lake_ply = os.path.join(Datafolder,'Non_Con_Lake_Ply.shp') ### None connected lake polygons
Path_final_riv_ply = os.path.join(Datafolder,'finalriv_info_ply.shp') ### River polyline
Path_final_riv = os.path.join(Datafolder,'finalriv_info.shp') ### Catchment polygons
Point_of_Interest = os.path.join(Datafolder,'obspoint.shp') ### point of the interest
########### Define a project Name
ProjectName = 'Select_By_Gauge_Name'
########### Initialize the toolbox
RTtool=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
### find subids of observation guage 05PB009
SubIds = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Guage_NMS = ['05PB009'])
### Find the drainage region to this subid, and generate routing product within this drainage region
RTtool.Select_Routing_product_based_SubId(Path_Con_Lake_ply = Path_Con_Lake_ply,Path_NonCon_Lake_ply= Path_NonCon_Lake_ply,Path_final_riv_ply = Path_final_riv_ply, Path_final_riv = Path_final_riv, mostdownid = [SubIds[0]])
### The result is showed in Figure 2, and similar to the inputs, for layers are generated but in a within the drainage region controlled by gauge '05Pb009'
### You may notice that some connected lake are represented by more than 1 catchments, These can be merged by using following command.
### Define final catchment by merge lake catchment covered by the same connected lakes showed in Figure 3
Datafolder_SubRegion = os.path.join(Outputfolder,ProjectName,'SubId_'+str(SubIds[0])) ### The output folder where sub region result are stored
RTtool.Define_Final_Catchment(Datafolder = Datafolder_SubRegion)
The extracted routing product by this example is showed in following Figures
Figure 2: Extracted routing product in the drainage region controlled by Guage 05PB009.CL represnet for connected lake, while NCL represent for none connected lake
And the find routing structure can be generated by merging catchment polygons that are covered by the same connected lake
Figure 3: Final routing structure after merging catchment covered by the same connected lakes showed in Figure 2.CL represnet for connected lake, while NCL represent for none connected lake
This tool allow user to simplify the lake river routing product by remove river reaches with drainage area smaller than a area thresthold (Area_Min, in km2).
RTtool.Customize_Routing_Topology(DataFolder = Extracted_example_folder,Area_Min = 80)
########### Define folder directories,Data folder is the folder where routing product is located, and Outputfolder is the folder where to save output of the results
Datafolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/WoodLake/"
Outputfolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/"
########### Define requried inputs
Path_Con_Lake_ply = os.path.join(Datafolder,'Con_Lake_Ply.shp') ### Connected lake polygons
Path_NonCon_Lake_ply = os.path.join(Datafolder,'Non_Con_Lake_Ply.shp') ### None connected lake polygons
Path_final_riv_ply = os.path.join(Datafolder,'finalriv_info_ply.shp') ### River polyline
Path_final_riv = os.path.join(Datafolder,'finalriv_info.shp') ### Catchment polygons
Point_of_Interest = os.path.join(Datafolder,'obspoint.shp') ### point of the interest
#######################################To get routing product in the region of interest
########### Define a project Name
ProjectName = 'Select_By_Gauge_Name'
########### Initialize the toolbox
RTtool=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
### find subids of observation guage 05PB009
SubIds = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Guage_NMS = ['05PB009'])
### Find the drainage region to this subid, and generate routing product within this drainage region
RTtool.Select_Routing_product_based_SubId(Path_Con_Lake_ply = Path_Con_Lake_ply,Path_NonCon_Lake_ply= Path_NonCon_Lake_ply,Path_final_riv_ply = Path_final_riv_ply, Path_final_riv = Path_final_riv, mostdownid = [SubIds[0]])
#######################################To Simplify River network
Datafolder_SubRegion = os.path.join(Outputfolder,ProjectName,'SubId_'+str(SubIds[0]))
ProjectName = 'Simplify_River_Network'
########### Initialize the toolbox
RTtool_SRN=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
########### Simplify river network showed in Figure 4, you will find some river system are simplified, some connected lake are changed to None connected lakes.
RTtool_SRN.Customize_Routing_Topology(DataFolder = Datafolder_SubRegion,Area_Min = 100)
########### Define final catchment by merge lake catchment covered by the same connected lakes showed in Figure 5
Datafolder_Simp_River = os.path.join(Outputfolder,ProjectName,'SubArea_'+str(100))
RTtool_SRN.Define_Final_Catchment(Datafolder = os.path.join(Datafolder_Simp_River))
The simplified routing product is showed in Figure 4 and again final routing structure after merging catchment covered by the same connected lake is showed in Figure 5
Figure 4: Simplify lake river routing network by remove river reaches with drainage area smaller than 100 km2. The original lake river routing network before simplification is showed in Figure 2. CL represnet for connected lake, while NCL represent for none connected lake
Figure 5: Final routing structure after merging catchment covered by the same connected lakes showed in Figure 4. CL represnet for connected lake, while NCL represent for none connected lake
This tool allow user to change the lake river routing network by selected connected and none connected lake by two lake area thresthold: Thres_Area_Conn_Lakes and Thres_Area_Non_Conn_Lakes, respectively.
RTtool.SelectLakes(Extracted_example_folder, Thres_Area_Conn_Lakes = Thres_Area_Conn_Lakes ,Thres_Area_Non_Conn_Lakes = Thres_Area_Non_Conn_Lakes, SelectionName = Output_Folder_Name)
########### Define folder directories,Data folder is the folder where routing product is located, and Outputfolder is the folder where to save output of the results
Datafolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/WoodLake/"
Outputfolder = "C:/Users/dustm/Documents/ubuntu/share/OneDrive/OneDrive - University of Waterloo/Documents/RoutingTool/Samples/Examples/Outputs1/"
########### Define requried inputs
Path_Con_Lake_ply = os.path.join(Datafolder,'Con_Lake_Ply.shp') ### Connected lake polygons
Path_NonCon_Lake_ply = os.path.join(Datafolder,'Non_Con_Lake_Ply.shp') ### None connected lake polygons
Path_final_riv_ply = os.path.join(Datafolder,'finalriv_info_ply.shp') ### River polyline
Path_final_riv = os.path.join(Datafolder,'finalriv_info.shp') ### Catchment polygons
Point_of_Interest = os.path.join(Datafolder,'obspoint.shp') ### point of the interest
#######################################To get routing product in the region of interest
########### Define a project Name
ProjectName = 'Select_By_Gauge_Name'
########### Initialize the toolbox
RTtool=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
### find subids of observation guage 05PB009
SubIds = RTtool.Locate_subid_needsbyuser(Path_products = Path_final_riv_ply,Guage_NMS = ['05PB009'])
### Find the drainage region to this subid, and generate routing product within this drainage region
RTtool.Select_Routing_product_based_SubId(Path_Con_Lake_ply = Path_Con_Lake_ply,Path_NonCon_Lake_ply= Path_NonCon_Lake_ply,Path_final_riv_ply = Path_final_riv_ply, Path_final_riv = Path_final_riv, mostdownid = [SubIds[0]])
#######################################Selected lake by area
Datafolder_SubRegion = os.path.join(Outputfolder,ProjectName,'SubId_'+str(SubIds[0]))
ProjectName = 'Selected_Lake_By_Area'
########### Initialize the toolbox
RTtool_SL=LRRT(OutputFolder = Outputfolder,ProjectNM = ProjectName)
########### Select lakes by area, showed in Figure 6
RTtool_SL.SelectLakes(Datafolder = Datafolder_SubRegion,Thres_Area_Conn_Lakes = 10,Thres_Area_Non_Conn_Lakes = 3, SelectionName = 'All')
######## Define final catchment by merge lake catchment covered by the same connected lakes showed in Figure 7
RTtool_SL.Define_Final_Catchment(Datafolder = os.path.join(Outputfolder,ProjectName,'All'))
The updated lake river routing network by selecting lakes is showed in following Figure.
Figure 6: Updated lake river routing network after selecting lakes. The original lake river routing network before lake selection is showed in Figure 2. CL represnet for connected lake, while NCL represent for none connected lake
Figure 7: Final routing structure after merging catchment covered by the same connected lakes showed in Figure 6. CL represnet for connected lake, while NCL represent for none connected lake
© 2019-2021 - BasinMaker- [email protected]