---
title: "iemiscdata: Weighted CN Calculations Using the Composite CN"
author: "Irucka Embry, E.I.T. (EcoC²S)"
date: "`r Sys.Date()`"
lang: en-us
urlcolor: blue
output:
  rmarkdown::pdf_document:
    highlight: kate
    toc: true
    latex_engine: xelatex
vignette: >
  %\VignetteIndexEntry{iemiscdata Weighted CN Calculations Using the Composite CN}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

\bigskip

# Example 2-1 from the Reference

&ldquo;The watershed covers 250 acres in Dyer County, northwestern Tennessee. Seventy percent (175 acres) is a Loring soil, which is in hydrologic soil group C. Thirty percent (75 acres) is a Memphis soil, which is in group B. The event is a 25-year frequency, 24-hour storm with total rainfall of 6 inches.&rdquo;  

&ldquo;The present cover type is pasture in good hydrologic condition.&rdquo;  

What is the present weighted CN?  

\medskip

```{r, warning = FALSE, message = FALSE, tidy = TRUE}

install.load::load_package("iemiscdata", "iemisc", "round", "data.table")
# load needed packages using the load_package function from the install.load package (it is assumed that you have already installed these packages)

data(cn_other_agricultural)

# locate the row where "Hydrologic condition" == "Good" & "Cover type" %like% "Pasture, grassland, or range--continuous forage for grazing"
CNlocation1 <- cn_other_agricultural[cn_other_agricultural$"Hydrologic condition" == "Good" & cn_other_agricultural$"Cover type" %like% "Pasture, grassland, or range--continuous forage for grazing"]

CN1 <- CNlocation1$"Curve numbers for hydrologic soil group C"

CN1



# locate the row where "Hydrologic condition" == "Good" & "Cover type" %like% "Pasture, grassland, or range--continuous forage for grazing"
CNlocation2 <- cn_other_agricultural[cn_other_agricultural$"Hydrologic condition" == "Good" & cn_other_agricultural$"Cover type" %like% "Pasture, grassland, or range--continuous forage for grazing"]

CN2 <- CNlocation2$"Curve numbers for hydrologic soil group B"

CN2



CNa <- c(CN1, CN2)

area_pct1 <- c(0.70, 0.30)
weighted_CN(CN = CNa, area_pct = area_pct1)
```

Use a CN of `r round_r3(weighted_CN(CN = CNa, area_pct = area_pct1), d = 0)`.  

\bigskip
\bigskip

# Example 2-2 from the Reference

&ldquo;Seventy percent (175 acres) of the watershed, consisting of all the Memphis soil and 100 acres of the Loring soil, is 1/2-acre residential lots with lawns in good hydrologic condition. The rest of the watershed is scattered open space in good hydrologic condition.&rdquo;   

Assume 25% average impervious area.  

What is the proposed weighted CN?  

\medskip

```{r, warning = FALSE, message = FALSE, tidy = TRUE}

data(cn_urban)

# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation1 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN1 <- CNlocation1$"Curve numbers for hydrologic soil group B"

CN1




# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation2 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN2 <- CNlocation2$"Curve numbers for hydrologic soil group C"

CN2



# locate the row where "Cover type and hydrologic condition" == "Good condition (grass cover > 75%)"
CNlocation3 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "Good condition (grass cover > 75%)", ]


CN3 <- CNlocation3$"Curve numbers for hydrologic soil group C"

CN3



CNb <- c(CN1, CN2, CN3)

area_pct2 <- c(0.30, 0.40, 0.30)
weighted_CN(CN = CNb, area_pct = area_pct2)
```

Use a CN of `r round_r3(weighted_CN(CN = CNb, area_pct = area_pct2), d = 0)`.  

\bigskip
\bigskip

# Example 2-3 from the Reference

&ldquo;This example is the same as example 2-2, except that the 1/2-acre lots have a total impervious area of 35 percent. For these lots, the pervious area is lawns in good hydrologic condition. Since the impervious area percentage differs from the percentage assumed in table 2-2, use figure 2-3 to compute CN.&rdquo;   

What is the proposed weighted CN?  

\medskip

```{r, warning = FALSE, message = FALSE, tidy = TRUE}

# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation1 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN1 <- CNlocation1$"Curve numbers for hydrologic soil group B"

CN1


# obtain the composite CN at 35%
CN1_new <- c_composite_CN(CN1, impervious = 35)

CN1_new



# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation2 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN2 <- CNlocation2$"Curve numbers for hydrologic soil group C"

CN2


# obtain the composite CN at 35%
CN2_new <- c_composite_CN(CN2, impervious = 35)

CN2_new



# locate the row where "Cover type and hydrologic condition" == "Good condition (grass cover > 75%)"
CNlocation3 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "Good condition (grass cover > 75%)", ]


CN3 <- CNlocation3$"Curve numbers for hydrologic soil group C"

CN3



CNc <- c(CN1_new, CN2_new, CN3)

area_pct3 <- c(0.30, 0.40, 0.30)
weighted_CN(CN = CNc, area_pct = area_pct3)
```

Use a CN of `r round_r3(weighted_CN(CN = CNc, area_pct = area_pct3), d = 0)`.  

\bigskip
\bigskip

# Example 2-4 from the Reference

&ldquo;This example is also based on example 2-2, except that 50 percent of the impervious area associated with the 1/2-acre lots on the Loring soil is “unconnected,” that is, it is not directly connected to the drainage system. For these lots, the pervious area CN (lawn, good condition) is 74 and the impervious area is 25 percent. Use figure 2-4 to compute the CN for these lots. CN's for the 1/2-acre lots on Memphis soil and the open space on Loring soil are the same as those in example 2-2. (See figure 2-8.)&rdquo;   

What is the proposed weighted CN?  

\medskip

```{r, warning = FALSE, message = FALSE, tidy = TRUE}

# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation1 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN1 <- CNlocation1$"Curve numbers for hydrologic soil group B"

CN1




# locate the row where "Cover type and hydrologic condition" == "1/2 acre"
CNlocation2 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "1/2 acre", ]


CN2 <- CNlocation2$"Curve numbers for hydrologic soil group C"

CN2


# obtain the composite CN at 25%
CN2_new <- uc_composite_CN(CN2, impervious = 25, R = 50 / 100)

CN2_new




# locate the row where "Cover type and hydrologic condition" == "Good condition (grass cover > 75%)"
CNlocation3 <- cn_urban[cn_urban$"Cover type and hydrologic condition" == "Good condition (grass cover > 75%)", ]


CN3 <- CNlocation3$"Curve numbers for hydrologic soil group C"

CN3



CNc <- c(CN1, CN2_new, CN3)

area_pct4 <- c(0.30, 0.40, 0.30)
weighted_CN(CN = CNc, area_pct = area_pct4)
```

Use a CN of `r round_r3(weighted_CN(CN = CNc, area_pct = area_pct4), d = 0)`.  

\bigskip
\bigskip
\bigskip
\bigskip

# Works Cited

United States Department of Agriculture Natural Resources Conservation Service Conservation Engineering Division, &ldquo;Urban Hydrology for Small Watersheds Technical Release 55 (TR-55)&rdquo;, June 1986, pages 2-11 - 2-16, https://directives.sc.egov.usda.gov/OpenNonWebContent.aspx?content=22162.wba  

\bigskip
\bigskip

# EcoC²S Links

EcoC²S Home -- https://www.ecoccs.com/  
About EcoC²S -- https://www.ecoccs.com/about_ecoc2s.html  
Services -- https://www.ecoccs.com/services.html  
1 Stop Shop -- https://www.ecoccs.com/other_biz.html  
Products -- https://www.questionuniverse.com/products.html  
Media -- https://www.ecoccs.com/media.html  
Resources -- https://www.ecoccs.com/resources.html  
R Trainings and Resources provided by EcoC²S (Irucka Embry, E.I.T.) -- https://www.ecoccs.com/rtraining.html  

\bigskip
\bigskip

# Copyright and License

All R code written by Irucka Embry is distributed under the GPL-3 (or later) license, see the [GNU General Public License {GPL} page](https://www.gnu.org/licenses/gpl-3.0.html).  

All written content originally created by Irucka Embry is copyrighted under the Creative Commons Attribution-ShareAlike 4.0 International License. All other written content retains the copyright of the original author(s).  

This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).  
