drawHypsoCurves {hypsoLoop} | R Documentation |
Draw Hypsometric curves and calculate hypsometric integrals
Description
This function takes as input the DEM and sub-catchments boundaries and calls the hypsoTables function to produce the hypsometric tables. It then draws and prints out the hypsometric curves for each sub-catchment. Then, it fits a function to the table of each sub-cacthment and uses it to calculate the hypsometric integral. Finally, it summarizes the results in a well-formatted table and prints it out as CSV. All these results are stored in a folder called "HYPSO_OUTPUT" created in the current working directory.
Usage
drawHypsoCurves(x, y, print_result = FALSE)
Arguments
x |
An object of class SpatialPolygonsDataFrame or simple features (sf). For instance, you can use RGDAL package's "readOGR()" function to create such an object from Shapefiles saved on disk. Alternatively, you can use sf's st_read() function to get a simple features object from the shapefile. NB: at least one column (attribute) named 'Name' should be present in the shapefile or input data frame. |
y |
An object of class RasterLayer. You can use the raster package to read GeoTIFF and other raster formats from disk. |
print_result |
A logical variable to decide whether the output folder will be created to contain the figures and summary table (CSV) or not. |
Details
The elevation range of each sub-cacthment is divided into 30 contour intervals and the area covered by each contour interval is calculated. The result is put into tables (one table for each sub-catchment). This data is then used to construct the hypsometric curve through ggplot2. A 3rd polynomial function is then fitted to the normalized table and PolynomF package is used to calculate the area under the hypsometric curve (its integral). Finally, the integral values for each sub-catchment are compiled into a data frame that is exported as CSV.
Value
A data frame containing the hypsometric integral for each sub-catchment along with other data such as maximum & minimum elevation.
Author(s)
Faustin Gashakamba gashakamba@gmail.com
See Also
Examples
drawHypsoCurves(watersheds, DEM) #Draw hypsographic curves of the sub-catchments in 'watersheds'.