-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
100 lines (72 loc) · 2.63 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# SELECTRdata
<!-- badges: start -->
[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
<!-- badges: end -->
SELECTRdata provides convenience functions for downloading raster and tabular
data used in the Spatially Explicit Load Enrichment Calculation Tool (SELECT).
By providing a SpatRaster object of the target watershed, functions are available
to download cropped:
- [National Land Cover Dataset](https://www.mrlc.gov/)
- [FEMA USA Structures](https://disasters.geoplatform.gov/USA_Structures/)
- [Census Blocks](https://tigerweb.geo.census.gov/tigerwebmain/TIGERweb_restmapservice.html)
- [TIGER County Boundaries](https://tigerweb.geo.census.gov/tigerwebmain/TIGERweb_restmapservice.html)
- [USDA Agricultural Census](https://www.nass.usda.gov/)
Sources to add:
- Point sources (via ECHO or echor)
- MS4 urbanized areas (via US Census)
## Installation
You can install the development version of SELECTRdata like so:
``` r
# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE?
```
## Example
## MRLC National Land Cover Dataset
```{r example}
library(SELECTRdata)
library(terra)
## we need a template file, this is the thomsoncreek watershed in Texas
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata")
dem <- terra::rast(dem)
gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata")
wbd <- terra::vect(gpkg, layer = "wbd")
dem <- terra::mask(dem, wbd,
filename = tempfile(fileext = ".tif"))
```
```{r}
## set the following GDAL options to connect to
## MRLC's AWS S3 bucket
set_gdal_config("AWS_NO_SIGN_REQUEST", "YES")
## download the NLCD file cropped to the extents of the watershed
nlcd <- SELECTRdata::download_nlcd(template = dem,
overwrite = TRUE,
progress = 1)
plot(nlcd)
plot(wbd, add = TRUE)
```
### FEMA US Buildings
```{r}
buildings <- download_buildings(template = dem)
plot(buildings)
```
### TIGER Counties
```{r}
cen_blocks <- download_census_blocks(dem, "2020")
plot(cen_blocks, "POP100")
```
```{r}
counties <- download_counties(dem)
plot(counties)
```
You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this.