Skip to content

Commit

Permalink
adding stream order to example
Browse files Browse the repository at this point in the history
  • Loading branch information
lecondon committed May 4, 2020
1 parent 0346bb8 commit 1fd2520
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Rpkg/R/CalStream_Order.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CalcStreamOrder=function(basinID,dsID,segments){
blist2=which(segments2==btemp)
segments[blist2]=order_no[i]
}
outputlist=list("summary"=summary, "channel_orders"=segments)
outputlist=list("summary"=summary, "order_mask"=segments)
}

return(outputlist)
Expand Down
6 changes: 5 additions & 1 deletion Workflow_Example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ image.plot(area,main="drainage Area")
Next you can use the flow direction file and the drainage areas to define a river network given a user specified drainage area threshold to define rivers (i.e. any cell with >=riv_th cells draining to it will count as a river)
```{r}
subbasin=CalcSubbasins(travHS$direction, area=area, mask=watershed.mask, riv_th=60, merge_th=0)
#you can also calcualte stream order if you would like here:
streamorder=CalcStreamOrder(subbasin$summary[,1], subbasin$summary[,6], subbasin$segments)
```
*Note:Try changing the riv_th to change the density of the river network that is created. The merge threshold is used to lump together river segments with drainage areas below this threshold. Use help(CalcSubbasins) to learn more about the options for this function *

Take a look at the resulting river network
```{r}
par(mfrow=c(1,2))
par(mfrow=c(1,3))
image.plot(subbasin$segments, main="Stream Segments")
image.plot(streamorder$order_mask, main="Stream Segments")
image.plot(subbasin$subbasins, main="Sub basins")
```

Expand Down

0 comments on commit 1fd2520

Please sign in to comment.