Skip to content

Commit

Permalink
update readme with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed Dec 4, 2024
1 parent c149936 commit b486eb8
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 5 deletions.
51 changes: 48 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
out.width = "100%",
warning = FALSE
)
gpkg = '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg'
```

# hfsubsetR
Expand All @@ -29,7 +31,50 @@ The goal of `hfsubsetR` is to extract hydrofabric subsets from cloud or local ar
You can install the development version of `hfsubsetR` from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("lynker-spatial/hfsubsetR")
# install.packages("remotes")
remotes::install_github("lynker-spatial/hfsubsetR")
```

```{r}
library(hfsubsetR)
```
## Basic Use

### From local file

We can download a version (default = '2.2') hydrofabric (default = 'nextgen') for any domain (default = 'conus') using `get_hydrofabric`.

```{r, eval = FALSE}
gpkg <- '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg'
get_hydrofabric(outfile = gpkg)
```
From that, we can extract data for a VPU:

```{r, eval = FALSE}
get_vpu_fabric(gpkg,
vpuid = "01",
outfile = '/Users/mikejohnson/hydrofabric/01_nextgen.gpkg')
```

Or, we can extract a subset based on an input identifier (one of `id`, `comid`, `hl_uri`, `poi_id`, `nldi_feature`, `xy`):

```{r}
subset_fabric <- get_subset(gpkg = gpkg, comid = 101)
```

```{r, echo = FALSE}
{
plot(subset_fabric$divides$geom, col = "gray90")
plot(subset_fabric$flowpaths$geom, add = TRUE, col = "blue")
plot(subset_fabric$nexus, add = TRUE, col = "red", pch = 16)
}
```

### From Remote

Coming soon...

### Questions?

Please reach out via an issue or PR if you have comments, concerns, or questions!
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,49 @@ You can install the development version of `hfsubsetR` from
[GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("lynker-spatial/hfsubsetR")
# install.packages("remotes")
remotes::install_github("lynker-spatial/hfsubsetR")
```

``` r
library(hfsubsetR)
```

## Basic Use

### From local file

We can download a version (default = ‘2.2’) hydrofabric (default =
‘nextgen’) for any domain (default = ‘conus’) using `get_hydrofabric`.

``` r
gpkg <- '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg'

get_hydrofabric(outfile = gpkg)
```

From that, we can extract data for a VPU:

``` r
get_vpu_fabric(gpkg,
vpuid = "01",
outfile = '/Users/mikejohnson/hydrofabric/01_nextgen.gpkg')
```

Or, we can extract a subset based on an input identifier (one of `id`,
`comid`, `hl_uri`, `poi_id`, `nldi_feature`, `xy`):

``` r
subset_fabric <- get_subset(gpkg = gpkg, comid = 101)
```

<img src="man/figures/README-unnamed-chunk-6-1.png" width="100%" />

### From Remote

Coming soon…

### Questions?

Please reach out via an issue or PR if you have comments, concerns, or
questions!
Binary file added man/figures/README-unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b486eb8

Please sign in to comment.