Skip to content

Commit eabe9dc

Browse files
committedDec 5, 2024·
add logo
1 parent 30342f4 commit eabe9dc

9 files changed

+129
-97
lines changed
 

‎.Rbuildignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ vignettes/tutorial
1414
docs
1515
tmp
1616
runners
17-
in-progress
17+
in-progress
18+
data-raw
19+
README_files

‎DESCRIPTION

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ Imports:
2525
glue,
2626
grDevices,
2727
hydrofab,
28+
hydroloom,
2829
hfsubsetR,
2930
jsonlite,
30-
nhdplusTools,
3131
purrr,
3232
rstudioapi,
3333
sf,
3434
terra,
3535
utils,
3636
zonal
37-
License: Apache License (>= 2)
37+
License: Apache License (>= 2) + LICENSE
3838
Encoding: UTF-8
3939
LazyData: true
4040
RoxygenNote: 7.3.2
@@ -47,11 +47,12 @@ Suggests:
4747
dm,
4848
leaflet,
4949
DT,
50-
knitr
50+
knitr,
51+
distill
5152
Remotes:
5253
NOAA-OWP/hydrofab,
5354
mikejohnson51/zonal,
5455
mikejohnson51/climateR,
5556
lynker-spatial/hfsubsetR
56-
Config/testthat/edition: 3
5757
VignetteBuilder: knitr
58+
Config/testthat/edition: 3

‎README.Rmd

+26-26
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ output: github_document
77
```{r, include = FALSE}
88
options(width=100)
99
knitr::opts_chunk$set(
10-
#warning = FALSE,
10+
warning = FALSE,
1111
message = TRUE,
1212
fig.path = 'man/figures/'
1313
)
14+
gpkg = '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg'
1415
```
1516

16-
## Hydrofabric
17+
# Hydrofabric:<a href="https://github.com/lynker-spatial/hfsubsetR"><img src="man/figures/logo.png" align="right" width="25%"/></a>
1718

1819
<!-- badges: start -->
1920
[![R CMD Check](https://github.com/NOAA-OWP/hydrofabric/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/NOAA-OWP/hydrofabric/actions/workflows/R-CMD-check.yaml)
@@ -22,7 +23,6 @@ knitr::opts_chunk$set(
2223

2324
This repository serves a few main purposes.
2425

25-
2626
1. **Modular Hydrofabric Processes**: This package offers a collection of R packages specifically designed for hydroscience applications, akin to the tidyverse suite for hydrofabric development. It manages dependencies, resolves conflicts, and streamlines the installation process for quick setup.
2727

2828
2. **Hydrographic Network Utilities / Geoscience**: The repository includes tools for obtaining, manipulating, and enhancing hydrographic networks.
@@ -55,42 +55,41 @@ library(hydrofabric)
5555

5656
`library(hydrofabric)` will load the core packages (alphabetical):
5757

58-
* [climateR](https://github.com/mikejohnson51/climateR) for accessing federated data stores for parameter and attributes estimation
58+
* [climateR](https://github.com/mikejohnson51/climateR) for accessing federated data for parameter and attributes estimation
5959
* [hfsubsetR](https://github.com/lynker-spatial/) for cloud-based hydrofabric subsetting
6060
* [hydrofab](https://github.com/mikejohnson51/hydrofab) a tool set for "fabricating" multiscale hydrofabrics
61-
* [ngen.hydrofab](https://github.com/mikejohnson51/ngen.hydrofab) NextGen extensions for hydrofab
62-
* [nhdplusTools](https://github.com/doi-usgs/nhdplusTools/) for network manipulation
63-
* [zonal](https://github.com/mikejohnson51/zonal) for catchment parameter estimation
61+
* [hydroloom](https://github.com/doi-usgs/nhdplusTools/) for network manipulation
62+
* [zonal](https://github.com/mikejohnson51/zonal) for spatial grid to polygon summaries
6463

6564
Additionally it will load key geospatial data science libraries:
6665

6766
* `dplyr` (data.frames)
68-
* `sf` (vector)
69-
* `terra` (raster)
70-
67+
* `sf` (vector geodata)
68+
* `terra` (raster geodata)
7169

7270
# Subsetting
7371

74-
```{r}
75-
# The output directory
76-
o = "vignettes/tutorial/example.gpkg"
72+
```{r, eval = FALSE}
73+
gpkg <- './conus_nextgen.gpkg'
74+
75+
get_hydrofabric(outfile = gpkg)
76+
```
7777

78-
# Build subset
79-
hfsubsetR::get_subset(comid = 101, outfile = o, overwrite = FALSE)
78+
```{r}
79+
subset_fabric <- get_subset(gpkg = gpkg,
80+
comid = 101)
8081
```
8182

8283
```{r, echo = FALSE}
8384
{
84-
plot(sf::read_sf(o, "divides")$geom)
85-
plot(sf::read_sf(o, "flowpaths")$geom, col = "blue", add = TRUE)
86-
#plot(sf::read_sf(o, "nexus")$geom, col = "red", pch = 16, add = TRUE)
85+
plot(subset_fabric$divides$geom, col = "gray90")
86+
plot(subset_fabric$flowpaths$geom, add = TRUE, col = "blue")
87+
plot(subset_fabric$nexus, add = TRUE, col = "red", pch = 16)
8788
}
8889
```
8990

9091
We have _also_ created a CLI cloud based subsetter. Binaries of these can be installed at the [release page](https://github.com/lynker-spatial/hfsubsetCLI/releases).
9192

92-
> NOTE: A Python Implementation is coming soon!
93-
9493
# Hydrofabric Characteristic Data
9594

9695
A wide range of data can be appended to the hydrofabric (subsets) from resources including NOAA core modules, streamcat, hydroatlas, USGS catchment characteristics, and more.
@@ -100,19 +99,20 @@ Preliminary documentation of these can be found [here](https://github.com/NOAA-O
10099
Additionally, open source tools like `climateR` and `zonal` can be used to rapidly access and summarize data for a catchment set:
101100

102101
```{r}
103-
# Read Hydrofabric
104-
hf = read_hydrofabric(o)
105-
106102
# Get Daymet Data
107-
(tmax = getDaymet(hf$catchments, varname = "tmax", startDate = "2020-10-01"))
103+
(tmax = getDaymet(subset_fabric$divides,
104+
varname = "tmax",
105+
startDate = "2020-10-01"))
108106
```
109107

110108
```{r, echo = FALSE}
111109
plot(tmax$tmax, main = 'Daymet Maximum Temperture')
112110
```
113111

114112
```{r}
115-
(summary_stats = zonal::execute_zonal(tmax, hf$catchments, ID = "divide_id"))
113+
(summary_stats = zonal::execute_zonal(tmax,
114+
subset_fabric$divides,
115+
ID = "divide_id"))
116116
```
117117

118118
```{r, echo = FALSE}
@@ -145,7 +145,7 @@ HydroShare, http://www.hydroshare.org/resource/129787b468aa4d55ace7b124ed27dbde
145145

146146
# Questions:
147147

148-
<a href = "mailto:jjohnson@lynker.com?subject=NextGen Hydrofabric Questions"> Mike Johnson (Hydrofabric Lead) </a>
148+
<a href = "mailto:mike.johnson@noaa.gov?subject=NextGen Hydrofabric Questions"> Mike Johnson (Hydrofabric Program Lead) </a>
149149

150150
```{r, eval = FALSE, echo = FALSE}
151151
#knitr::include_graphics(c("man/figures/lynker-logo.png","man/figures/noaa-logo.png", 'man/figures/usgs-logo.png'))

‎README.md

+77-65
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33

4-
## Hydrofabric for Next Generation Water Resource Modeling
4+
# Hydrofabric:<a href="https://github.com/lynker-spatial/hfsubsetR"><img src="man/figures/logo.png" align="right" width="25%"/></a>
55

66
<!-- badges: start -->
77

@@ -10,24 +10,29 @@ Check](https://github.com/NOAA-OWP/hydrofabric/actions/workflows/R-CMD-check.yam
1010
[![Dependencies](https://img.shields.io/badge/dependencies-18/102-red?style=flat)](#)
1111
<!-- badges: end -->
1212

13-
This development repository serves a few main purposes.
13+
This repository serves a few main purposes.
1414

15-
1. Hydrofabric processes are intentionally modular. This package
16-
provides a collection of R package that are designed for
17-
hydroscience. (e.g. tidyverse for hydrofabric development)
15+
1. **Modular Hydrofabric Processes**: This package offers a collection
16+
of R packages specifically designed for hydroscience applications,
17+
akin to the tidyverse suite for hydrofabric development. It manages
18+
dependencies, resolves conflicts, and streamlines the installation
19+
process for quick setup.
1820

19-
2. Contains utilites needed for manipulating and enhancing hydrographic
20-
networks.
21+
2. **Hydrographic Network Utilities / Geoscience**: The repository
22+
includes tools for obtaining, manipulating, and enhancing
23+
hydrographic networks.
2124

22-
3. It provides the utilities to subset the national dataset for regions
23-
upstream of a location (XY), hydrofabric ID, indexed hydrolocation
24-
(e.g. NWIS gage, HUC12 or NID) or NHDPlus COMID.
25+
3. **Subsetting National Datasets**: It provides utilities to subset
26+
the national dataset for areas upstream of a specified location (XY
27+
coordinates), hydrofabric ID, indexed hydrolocation (e.g., NWIS
28+
gage, HUC12, or NID), NHDPlus COMID, or NLDI feature.
2529

26-
4. It provides a wide range of documentation including the hydrofabric
27-
and cross section data model, the origins and development of the
28-
product that can be found on the [landing
30+
4. **Comprehensive Documentation**: The repository offers extensive
31+
documentation, including details on the hydrofabric and
32+
cross-section data model, as well as the origins and development of
33+
the product. This information can be found on the [landing
2934
page](https://noaa-owp.github.io/hydrofabric/) under
30-
[articles](https://noaa-owp.github.io/hydrofabric/articles/index.html).
35+
[articles](https://noaa-owp.github.io/hydrofabric/articles/index.html)..
3136

3237
## Cloud Native Data Archives
3338

@@ -58,15 +63,16 @@ remotes::install_github("NOAA-OWP/hydrofabric")
5863
library(hydrofabric)
5964
```
6065

61-
## ── Attaching packages ───────────────────────────────────────────────────────── hydrofabric 0.0.9 ──
66+
## ── Attaching packages ───────────────────────────────────────────────────────── hydrofabric 0.2.1 ──
6267

63-
## ✔ dplyr 1.1.4zonal 0.0.2
64-
## ✔ climateR 0.3.5hfsubsetR 0.0.9
65-
## ✔ nhdplusTools 1.1.0sf 1.0.17
66-
## ✔ hydrofab 0.5.2 ✔ terra 1.7.71
68+
## ✔ climateR 0.3.6hydroloom 1.1.0
69+
## ✔ dplyr 1.1.4sf 1.0.19
70+
## ✔ hfsubsetR 0.3.2terra 1.7.78
71+
## ✔ hydrofab 0.6 ✔ zonal 0.1.0
6772

6873
## ── Conflicts ──────────────────────────────────────────────────────────── hydrofabric_conflicts() ──
69-
## ✖ terra::plot() masks climateR::plot()
74+
## ✖ terra::plot() masks climateR::plot()
75+
## ✖ terra::query() masks hfsubsetR::query()
7076

7177
##
7278
## Attaching package: 'hydrofabric'
@@ -78,47 +84,41 @@ library(hydrofabric)
7884
`library(hydrofabric)` will load the core packages (alphabetical):
7985

8086
- [climateR](https://github.com/mikejohnson51/climateR) for accessing
81-
federated data stores for parameter and attributes estimation
87+
federated data for parameter and attributes estimation
8288
- [hfsubsetR](https://github.com/lynker-spatial/) for cloud-based
8389
hydrofabric subsetting
8490
- [hydrofab](https://github.com/mikejohnson51/hydrofab) a tool set for
8591
“fabricating” multiscale hydrofabrics
86-
- [ngen.hydrofab](https://github.com/mikejohnson51/ngen.hydrofab)
87-
NextGen extensions for hydrofab
88-
- [nhdplusTools](https://github.com/doi-usgs/nhdplusTools/) for network
92+
- [hydroloom](https://github.com/doi-usgs/nhdplusTools/) for network
8993
manipulation
90-
- [zonal](https://github.com/mikejohnson51/zonal) for catchment
91-
parameter estimation
94+
- [zonal](https://github.com/mikejohnson51/zonal) for spatial grid to
95+
polygon summaries
9296

9397
Additionally it will load key geospatial data science libraries:
9498

9599
- `dplyr` (data.frames)
96-
- `sf` (vector)
97-
- `terra` (raster)
100+
- `sf` (vector geodata)
101+
- `terra` (raster geodata)
98102

99103
# Subsetting
100104

101105
``` r
102-
# The output directory
103-
o = "vignettes/tutorial/example.gpkg"
106+
gpkg <- './conus_nextgen.gpkg'
104107

105-
# Build subset
106-
hfsubsetR::get_subset(comid = 101, outfile = o, overwrite = FALSE)
108+
get_hydrofabric(outfile = gpkg)
107109
```
108110

109-
## Warning in hfsubsetR::get_subset(comid = 101, outfile = o, overwrite = FALSE):
110-
## vignettes/tutorial/example.gpkg already exists and overwrite is FALSE
111-
112-
## [1] "vignettes/tutorial/example.gpkg"
111+
``` r
112+
subset_fabric <- get_subset(gpkg = gpkg,
113+
comid = 101)
114+
```
113115

114-
![](man/figures/unnamed-chunk-6-1.png)<!-- -->
116+
![](man/figures/unnamed-chunk-7-1.png)<!-- -->
115117

116118
We have *also* created a CLI cloud based subsetter. Binaries of these
117119
can be installed at the [release
118120
page](https://github.com/lynker-spatial/hfsubsetCLI/releases).
119121

120-
> NOTE: A Python Implementation is coming soon!
121-
122122
# Hydrofabric Characteristic Data
123123

124124
A wide range of data can be appended to the hydrofabric (subsets) from
@@ -132,51 +132,63 @@ Additionally, open source tools like `climateR` and `zonal` can be used
132132
to rapidly access and summarize data for a catchment set:
133133

134134
``` r
135-
# Read Hydrofabric
136-
hf = read_hydrofabric(o)
137-
138135
# Get Daymet Data
139-
(tmax = getDaymet(hf$catchments, varname = "tmax", startDate = "2020-10-01"))
136+
(tmax = getDaymet(subset_fabric$divides,
137+
varname = "tmax",
138+
startDate = "2020-10-01"))
140139
```
141140

142141
## $tmax
143142
## class : SpatRaster
144-
## dimensions : 21, 19, 1 (nrow, ncol, nlyr)
143+
## dimensions : 34, 27, 1 (nrow, ncol, nlyr)
145144
## resolution : 1000, 1000 (x, y)
146-
## extent : 480250, 499250, -1202500, -1181500 (xmin, xmax, ymin, ymax)
145+
## extent : 480250, 507250, -1205500, -1171500 (xmin, xmax, ymin, ymax)
147146
## coord. ref. : +proj=lcc +lat_0=42.5 +lon_0=-100 +lat_1=25 +lat_2=60 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs
148147
## source(s) : memory
149148
## name : tmax_2020-10-01_na_total
150-
## min value : 32.83
149+
## min value : 32.49
151150
## max value : 33.79
152151
## unit : degrees C
153152
## time : 2020-10-01 UTC
154153

155-
![](man/figures/unnamed-chunk-8-1.png)<!-- -->
154+
![](man/figures/unnamed-chunk-9-1.png)<!-- -->
156155

157156
``` r
158-
(summary_stats = zonal::execute_zonal(tmax, hf$catchments, ID = "divide_id"))
157+
(summary_stats = zonal::execute_zonal(tmax,
158+
subset_fabric$divides,
159+
ID = "divide_id"))
159160
```
160161

161-
## Simple feature collection with 35 features and 4 fields
162+
## Simple feature collection with 33 features and 11 fields
162163
## Geometry type: POLYGON
163164
## Dimension: XY
164-
## Bounding box: xmin: 113055 ymin: 890715 xmax: 130425 ymax: 911055
165+
## Bounding box: xmin: 113055 ymin: 888405 xmax: 138555 ymax: 920325
165166
## Projected CRS: NAD83 / Conus Albers
166167
## First 10 features:
167-
## divide_id areasqkm vpuid mean.tmax_2020.10.01_na_total geom
168-
## 1 101 4.5666 12 33.49731 POLYGON ((130305 890715, 13...
169-
## 2 1078473 12.3156 12 33.17984 POLYGON ((120345 900615, 12...
170-
## 3 1078475 12.3408 12 33.21740 POLYGON ((117855 903975, 11...
171-
## 4 1078513 6.4449 12 33.66863 POLYGON ((114645 895815, 11...
172-
## 5 1078519 1.9197 12 33.69756 POLYGON ((115515 895755, 11...
173-
## 6 1078525 0.3789 12 33.70147 POLYGON ((115965 895215, 11...
174-
## 7 1078527 0.3312 12 33.72665 POLYGON ((114735 895485, 11...
175-
## 8 1078535 0.3582 12 33.70396 POLYGON ((116445 895155, 11...
176-
## 9 1078545 0.2862 12 33.70000 POLYGON ((116445 894735, 11...
177-
## 10 1078549 4.6296 12 33.60812 POLYGON ((117675 894825, 11...
178-
179-
![](man/figures/unnamed-chunk-10-1.png)<!-- -->
168+
## divide_id toid type ds_id areasqkm vpuid id lengthkm tot_drainage_areasqkm
169+
## 1 cat-2440455 nex-2440456 network NA 12.333600 12 wb-2440455 8.311509 12.33360
170+
## 2 cat-2440456 nex-2440457 network NA 22.042350 12 wb-2440456 8.331279 46.69020
171+
## 3 cat-2440457 nex-2440458 network NA 14.172300 12 wb-2440457 6.178294 75.85065
172+
## 4 cat-2440458 nex-2440459 network NA 8.410501 12 wb-2440458 8.247455 152.46045
173+
## 5 cat-2440459 nex-2440460 network NA 8.895599 12 wb-2440459 8.716688 174.68595
174+
## 6 cat-2440463 nex-2440460 network NA 7.793550 12 wb-2440463 5.555428 7.79355
175+
## 7 cat-2440464 nex-2440465 network NA 49.057200 12 wb-2440464 13.680996 49.05720
176+
## 8 cat-2440465 nex-2440466 network NA 58.074299 12 wb-2440465 18.292739 129.15360
177+
## 9 cat-2440466 nex-2440460 network NA 3.231900 12 wb-2440466 6.033382 290.13525
178+
## 10 cat-2440467 nex-2440460 network NA 6.275700 12 wb-2440467 3.406335 6.27570
179+
## has_flowline mean.tmax_2020.10.01_na_total geom
180+
## 1 TRUE 33.21733 POLYGON ((117855 903975, 11...
181+
## 2 TRUE 33.48803 POLYGON ((118485 894765, 11...
182+
## 3 TRUE 33.58906 POLYGON ((119205 893865, 11...
183+
## 4 TRUE 33.59082 POLYGON ((125595 892305, 12...
184+
## 5 TRUE 33.49315 POLYGON ((132465 889485, 13...
185+
## 6 TRUE 33.18192 POLYGON ((133125 892065, 13...
186+
## 7 TRUE 32.79919 POLYGON ((126585 907905, 12...
187+
## 8 TRUE 33.19112 POLYGON ((131505 895095, 13...
188+
## 9 TRUE 33.47892 POLYGON ((132015 891435, 13...
189+
## 10 TRUE 33.28711 POLYGON ((132045 891555, 13...
190+
191+
![](man/figures/unnamed-chunk-11-1.png)<!-- -->
180192

181193
# Background
182194

@@ -233,8 +245,8 @@ Please cite data and use as:
233245
234246
# Questions:
235247

236-
<a href = "mailto:jjohnson@lynker.com?subject=NextGen Hydrofabric Questions">
237-
Mike Johnson (Hydrofabric Lead) </a>
248+
<a href = "mailto:mike.johnson@noaa.gov?subject=NextGen Hydrofabric Questions">
249+
Mike Johnson (Hydrofabric Program Lead) </a>
238250

239251
<img src="man/figures/logos.png" width="1796" style="display: block; margin: auto;" />
240252

‎inst/logo.R

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
library(hexSticker)
3+
library(showtext)
4+
5+
imgurl <- "man/figures/imgfile.png"
6+
7+
hexSticker::sticker(imgurl,
8+
package="hydrofabric",
9+
y = 1.5,
10+
p_size=17,
11+
p_color = "brown",
12+
s_x=1,
13+
s_y=.8,
14+
s_width=.75,
15+
h_color = "dodgerblue",
16+
h_fill = "gray90",
17+
filename="man/figures/logo.png")

‎man/figures/imgfile.png

398 KB
Loading

‎man/figures/logo.png

92.6 KB
Loading

‎man/figures/poi_dist.png

29.9 KB
Loading

‎man/hydrofabric-package.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.