Watershed.IOR1: Watershed inlet and outlet nodes: case 1

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/WatershedIOR1.R

Description

The function determines the inlet and outlet nodes for zhyd watershed objects. This case 1 is for those watersheds that its river inlet and outlet object is length 1 (length(riverIO)=1).

Usage

1

Arguments

x

An object "SpatialPointsDataFrame" as is described in package sp over the function will search the inlet and outlet nodes of the watershed.

dist

A vector with the distances of each point in x to the current zhyd boundary.

Value

A list of length 2:

inlet

A "SpatialPointsDataFrame" that represents the inlet node of the current zhyd.

outlet

A "SpatialPointsDataFrame" that represents the outlet node of the current zhyd.

Note

If there are not inlet or outlet node of the current zhyd, 0 is returned.

Author(s)

J.A. Torres

See Also

See Also the functions Watershed.IOR2, Watershed.IOR3, Watershed.IOR4.

Examples

 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
library(Watersheds)
data(WatershedsData)

station1 = WatershedsData$station
subbasin1 = WatershedsData$subbasin
zhyd1 = WatershedsData$zhyd
river1 = WatershedsData$river
node1 = WatershedsData$node	

station1 = SpatialPoints(coords=cbind(4232972,3327634), 
	proj4string=slot(subbasin1,"proj4string"))
watershed = new("Watershed",station=station1,subbasin=subbasin1,
	zhyd=zhyd1,river=river1,c1=subbasin1,node=node1)

a = Watershed.Order(watershed)
c1 = a[[1]]
nodeIO = a[[9]]			
c1_river = a[[10]]
		
# determining inlet and outlet watershed nodes
	# determining distances of nodeIO to c1
	boundary = gBoundary(c1)
	dist = gDistance(nodeIO, boundary, byid =TRUE)
	a = Watershed.IOR1(x=nodeIO, dist=dist)
	c1_inlet = a$inlet; c1_inlet
	c1_outlet = a$outlet; c1_outlet
	
plot(c1,col="gray50")			
plot(station1,pch=24, bg="blue",add= TRUE)
plot(c1_river, col="blue", add=TRUE)
plot(c1_outlet,pch=21, bg="red",add= TRUE)
plot.PointAttribute(c1_outlet,"ELEV",700,0.8)
title(main="Watershed outlet, case I")

Watersheds documentation built on May 2, 2019, 12:10 p.m.