Learn R Programming

Watersheds (version 1.1)

Watershed.Order-methods: S4 Method for Function Watershed.Order

Description

S4 Method for function Watershed.Order. Definition of the properties of the current zhyd watershed.

Arguments

Value

The method returns a list of 11 objects:
c1
An object SpatialPolygonsDataFrame of length 1 that represents the current zhyd watershed object.
c1_inlet
An object SpatialPointsDataFrame of length 1 that represents the current inlet node of the zhyd watershed object.
c1_outlet
An object SpatialPointsDataFrame of length 1 that represents the current outlet node of the zhyd watershed object.
c2
An object SpatialPolygonsDataFrame of length 1 that represents the greater watershed tributary of the current zhyd watershed object.
c3
An object SpatialPolygonsDataFrame of length 1 that represents the second watershed tributary of the current zhyd watershed object.
node_trib
An object SpatialPointsDataFrame of length 2 that represents the station points of the tributary watershed objects.
sb1
An object SpatialPointsDataFrame of length 1 that represents the subbasin that contains the current zhyd watershed object.
riverIO
An object SpatialLinesDataFrame that represents the inlet (I) and outlet (O) rivers that crosses the boundary of the current zhyd watershed object.
nodeIO
An object SpatialPointsDataFrame that represents the nodes of the inlet (I) and outlet (O) rivers that crosses the boundary of the current zhyd watershed object.
c1_river
An object SpatialLinesDataFrame that represents the river network inside the current zhyd watershed object.
c1_node
An object SpatialPointsDataFrame that represents the node network inside the current zhyd watershed object.

Methods

signature(x = "Watershed")
The function takes the object of class Watershed and identifies the subbasin that contains the current station (class SpatialPoints) and subsets the zhyd object to subbasin and extract the current zhy object that contains station. Posteriorly, identifies the inlet and outlet stretches and probable inlet and outlet nodes of the zhyd. Then, runs the functions Watershed. ,IOR1, IOR2, IOR3, or IOR4 for determining the actual inlet and outlet nodes. Finally, the method executes the S4 method Watershed.Tributary for defining tributary nodes and tributary catchments of the current zhyd watershed.

See Also

See Also the class Watershed and the methods Watershed.Order2 and Watershed.Tributary.

Examples

Run this code
library(Watersheds)
data(WatershedsData)

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


station1 = SpatialPoints(coords=cbind(4328448.74, 3118576.86), 
	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]]
c1_inlet = a[[2]]
c1_outlet = a[[3]]
c2 = a[[4]]
c3 = a[[5]]
node_trib = a[[6]]
sb1 = a[[7]]
riverIO = a[[8]]
nodeIO = a[[9]]			
c1_river = a[[10]]
c1_node = a[[11]]	

bbox1 = slot(c1, "bbox")
bbox = matrix(0,2,2)
bbox[,1] = bbox1[,1]*.998
bbox[,2] = bbox1[,2]*1.002

plot(c1, xlim=bbox[1,], ylim=bbox[2,],col="gray50")			
plot(c2, col="gray75", add=TRUE)
plot(c3, col="gray85", add=TRUE)
plot(slot(watershed,"station"),pch=24, bg="blue",add= TRUE)
plot.PolyLineAttribute(c1, "order", 450, 0.8)
plot.PolyLineAttribute(c2, "order", 450, 0.8)
plot.PolyLineAttribute(c3, "order", 450, 0.8)				
plot(c1_river, col="blue", add=TRUE)
plot(c1_node,pch=21,bg="blue",cex=.5,add=TRUE)
plot(nodeIO,pch=21,bg="blue",cex=.5,add=TRUE)
plot(c1_inlet, pch=21, bg="green",add= TRUE)
plot(c1_outlet,pch=21, bg="red",add= TRUE)
plot.PointAttribute(nodeIO,"ELEV",600,0.7)
title(main="Current zhyd watershed (1)",
	sub="First order tributary watersheds (1.1, 1.2)")

Run the code above in your browser using DataLab