Hydroinformatics ▪ Climate Change ▪ Remote sensing ▪ GIS ▪ Modelling

 

sara4r - An R-GUI for Spatial Analysis of surface Runoff using the NRCS-CN method

Software availability
Developer: Rafael Hernández-Guzmán
Contact address: INIRENA-UMSNH. Av. San Juanito Itzícuaro s/n. Col. Nueva Esperanza. CP 58330. Morelia, Michoacán, México
Email: rhernandez.g@gmail.com
First year available: 2020
Software requirements: Tested in R version 3.4 and later
Hardware requirements: General purpose computer
Programming language: RGtk2
Availability and cost: sara4r is available free upon request to the authors

R DESCRIPTION FILE
Package: sara4r
Type: Package
Title: sara4r - An R-GUI for Spatial Analysis of surface Runoff using the NRCS-CN method
Version: 0.0.7
Author: Rafael Hernandez-Guzman [aut, cre], Arturo Ruiz-Luna [aut]
Depends: R (>= 3.4.4), RGtk2
Imports: raster, sp, rgdal
Maintainer: Rafael Hernández-Guzmán (rhernandez.g@gmail.com)
Descriptio: sara4r is an easy way to calculate the rainfall-runoff relation using the Natural Resources Conservation Service - Curve Number method (NRCS-CN method) but includes modifications by Hawkins et al., (2002) about the Initial Abstraction. This graphical user interface follows the programming logic of a previously published software (CN-Idris, Hernández-Guzmán et al., 2011 - CN-Idris: An Idrisi tool for generating curve number maps and estimating direct runoff. Environmental Modelling & Software, 26(12), 1764-1766), a raster-based GIS tool that outputs runoff estimates from Land use/land cover and hydrologic soil group maps.
This package is under development at the Institute about Natural Resources Research (INIRENA) from the Universidad Michoacana de San Nicolás de Hidalgo and represents a collaborative effort between the Hydro-Geomatic Lab (INIRENA) with the Environmental Management Lab (CIAD, A.C.)
.

 

 

HOW TO INSTALL
sara4r package is a Graphical User Interface developed in RGtk2 and depends on other libraries to run (raster, sp, rgdal). Thus, to make available sara4r in the R environment you must install RGtk2 first, then the raster, sp and rgdal packages.

To run sara4r just type sara4r ( ) in R

The first time you execute our tool, you will be asked to install RGtk+, like the following dialog:

Just tipe OK and wait until the program finished.

Type again library(sara4r) to activate de library. Then type the function sara4r( ) and you will see the main interface like the following window:

How to use (R code):

# Load some libraries
library(raster)
library(sp)
library(rgdal)
library(rgeos)

# First at all, set directory to store the outputs
setwd("C:/Veirus/Rasters")

# Load raster in an R object called 'landuse'
landuse <- raster(system.file("extdata/landuse.tif", package="sara4r"))

# Ratify
landuse_r <- ratify(landuse)
rat <- levels(landuse_r)[[1]]
rat$Pixel_Values <- c(10, 20, 30, 40, 50, 60, 70, 80, 90)
rat$Class_Names <- c("10 Water bodies", "20 Mangrove", "30 Evergreen forest", "40 Tropical dry forest", "50 Crops", "60 Grassland", "70 Littoral", "80 Villages", "90 Burned lands")
levels(landuse_r) <- rat

landuse_r@data@attributes
landtypes <- landuse_r@data@attributes[[1]]
cols <- c("blue", "darksalmon", "darkgreen", "darkorange", "chartreuse", "azure4", "darkorchid", "black", "red")

image(landuse_r,
col=cols,
main="Landuse and landcover (R. Cuitzmala Watershed)",
xlab="UTM Zone 13 Eastings [m]",
ylab="UTM Zone 13 Northings [m]",
#font.main=1.6,
font.lab=2, #Font style (1:normal, 2:bold, 3:italic, 4:bold and italic, 5:symbol font)
cex.main=1.1, cex.lab=0.8,
cex.axis=0.8, font=2) #Text size


# Legend should be one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right", "center"
legend("bottomright",
legend = landtypes$Class_Names,
fill = cols,
bty="n",
cex = 0.65,
ncol = 1,
title = "Landuse and Landcover (2019)")


# Add scale bar
scalebar(10000,
xy=c(500000, 2190000),
cex = 0.65,
font=2,
type='bar',
divs=4,
below = "meters")

# Load raster in an R object called 'hsg'
hsg <- raster(system.file("extdata/hsg.tif", package="sara4r")) #soil <- raster("./Rst/soils.tif")

hsg_r <- ratify(hsg)
rat <- levels(hsg_r)[[1]]
rat$Pixel_Values <- c(1, 2, 3, 4)
rat$Class_Names <- c("1 A", "2 B", "3 C", "4 D")
levels(hsg_r) <- rat

hsg_r@data@attributes
HSGtypes <- hsg_r@data@attributes[[1]]
cols <- c("brown4", "azure4", "darkorange", "blue")

image(hsg_r,
col=cols,
main="Hydrologic Soil Groups (R. Cuitzmala Watershed)",
xlab="UTM Zone 13 Eastings [m]",
ylab="UTM Zone 13 Northings [m]",
#font.main=2,
font.lab=2, #Font style (1:normal, 2:bold, 3:italic, 4:bold and italic, 5:symbol font)
cex.main=1.1,
cex.lab=0.8,
cex.axis=0.8,
font=2) #Text size)


legend("bottomright",
legend = HSGtypes$Class_Names,
fill = cols,
bty="n",
cex = 0.65,
title = "HSG")


# Add scale bar
scalebar(10000,
xy=c(500000, 2190000),
cex = 0.65,
font=2,
type='bar',
divs=4,
below = "meters")

 

For more details see sara4r Vignette (https://cran.r-project.org/web/packages/sara4r/index.html)

Cite: Hernández-Guzmán R., Ruiz-Luna A. 2020. sara4r: An R-GUI for Spatial Analysis of Surface Runoff using the NRCS-CN Method. R package. Available at: https://CRAN.R-project.org/package=sara4r

DOWNLOAD