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 4.1
Hardware requirements: General purpose computer
Programming language: tcltk
Availability and cost: sara4r is available at the Comprehensive R Archive Network

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.9
Author: Rafael Hernandez-Guzman [aut, cre], Arturo Ruiz-Luna [aut]
Depends: R (>= 4.1), tcltk, tcltk2
Imports: raster, sp, rgdal
Maintainer: Rafael Hernández-Guzmán (rhernandez.g@gmail.com)
Description: A Graphical user interface (GUI) to calculate the rainfall-runoff relation using the Natural Resources Conservation Service - Curve Number method (NRCS-CN method) but include modifications by Hawkins et al., (2002) about the Initial Abstraction. This GUI 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). It is 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.)
.

 

 

Sara4r Logic

 

 

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

To run sara4r just type library(sara4r) to activate de library. Then type the function sara4r( ) and you will see the main interface.

 

A more complete vignette (tutorial) is found as a supplementary material in the following publication:

Hernández-Guzmán R., Ruiz-Luna A., Mendoza E. (2021). Sara4r: an R graphical user interface (GUI) to estimate watershed surface runoff applying the NRCS – curve number methodSara4r: an R graphical user interface (GUI) to estimate watershed surface runoff applying the NRCS – curve number method. Journal of Hydroinformatics, 23(1), 76-87. https://doi.org/10.2166/hydro.2020.087

 

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