{"id":22413711,"url":"https://github.com/jsta/streamnet","last_synced_at":"2025-08-20T00:37:55.989Z","repository":{"id":88675728,"uuid":"104792308","full_name":"jsta/streamnet","owner":"jsta","description":"Morphology analysis of stream networks 🍃","archived":false,"fork":false,"pushed_at":"2022-07-09T19:35:17.000Z","size":2451,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T00:25:36.214Z","etag":null,"topics":["geomorphology","limnology"],"latest_commit_sha":null,"homepage":"https://jsta.github.io/streamnet/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsta.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-25T19:21:43.000Z","updated_at":"2024-05-10T09:55:46.000Z","dependencies_parsed_at":"2023-03-13T18:19:31.183Z","dependency_job_id":null,"html_url":"https://github.com/jsta/streamnet","commit_stats":{"total_commits":100,"total_committers":2,"mean_commits":50.0,"dds":"0.030000000000000027","last_synced_commit":"00a79128fe0940678c104526aa2393db5396f7fd"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jsta/streamnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsta%2Fstreamnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsta%2Fstreamnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsta%2Fstreamnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsta%2Fstreamnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsta","download_url":"https://codeload.github.com/jsta/streamnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsta%2Fstreamnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271246988,"owners_count":24725902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geomorphology","limnology"],"created_at":"2024-12-05T14:14:23.184Z","updated_at":"2025-08-20T00:37:55.896Z","avatar_url":"https://github.com/jsta.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/\",\n  eval = FALSE\n)\n```\n\n# streamnet\n\n[![CRAN status](https://www.r-pkg.org/badges/version/streamnet)](https://cran.r-project.org/package=streamnet)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![Travis-CI Build Status](https://travis-ci.org/jsta/streamnet.svg?branch=master)](https://travis-ci.org/jsta/streamnet)\n[![DOI](https://zenodo.org/badge/104792308.svg)](https://zenodo.org/badge/latestdoi/104792308)\n\n\nMorphology analysis of stream networks \n\n## Installation\n\nYou can install streamnet from github with:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"jsta/streamnet\")\n```\n\nIn addition, many functions require a system installation of [GRASS 7](https://grass.osgeo.org/) along with the [v.stream.order](https://grass.osgeo.org/grass74/manuals/addons/v.stream.order.html) extension.\n\nThere is a helper function to install `v.stream.order` at `streamnet:::install_grass_extensions`.\n\n## Usage\n\n### Calculate morphology metrics\n\n```{r grass_flag, echo=FALSE}\nSys.setenv(GRASS_VERBOSE = 0)\n```\n\n```{r setup, message=FALSE, eval=TRUE, warning=FALSE}\nlibrary(sf)\nlibrary(nhdR)\nlibrary(streamnet)\nlibrary(ggplot2)\nlibrary(raster)\n```\n\n```{r calc_metrics, message=FALSE, warning=FALSE, eval=FALSE}\ndata(nhd_sub_lines)\ndata(nhd_sub_lakes)\n\noutlet_reach   \u003c- terminal_reaches(network = nhd_sub_lines, \n                                   approve_all_dl = TRUE, quiet = TRUE)\noutlet_point   \u003c- st_cast(st_line_sample(outlet_reach, sample = 1), \"POINT\")\n\nggplot() +\n  geom_sf(data = nhd_sub_lines) +\n  geom_sf(data = outlet_point, aes(color = \"red\")) +\n  scale_color_manual(labels = \"outlet\", values = \"red\") +\n  labs(colour = \"\") + theme_minimal()\n\ncalc_metrics(nhd_sub_lines, nhd_sub_lakes)\n```\n\n### Simplify stream networks\n\n```{r simplify_networks, eval=TRUE}\ndata(nhd_sub_lines)\n\n# Combine(dissolve) adjacent reaches with no junctions\nnhd_sub_simple \u003c- simplify_network(nhd_sub_lines)\navg_link_length(nhd_sub_simple)\navg_link_length(nhd_sub_lines)\n```\n\n### Round-trip igraph and sf lines\n\n```{r igraph_v_sf, eval=TRUE}\ntree \u003c- create_reversed_tree(15)\nclass(tree)\nplot(tree)\n\ntree_sf \u003c- igraph2sf(tree)\nplot(tree_sf)\n```\n\n### Create synthetic stream networks\n\n```{r gen_dla, eval=FALSE}\n# Diffusion limited aggregation\ndt \u003c- sim_dla()\nviz_dla(dt, which.max(dt))\n```\n\n```{r show_dla, echo=FALSE, eval=TRUE}\nknitr::include_graphics(\"man/figures/show_dla.png\")\n```\n\n```{r viz_bin_raster, eval=TRUE}\n# Generate from a binary raster\nfoo \u003c- matrix(0, ncol = 9, nrow = 9)\nfoo[1:4,3] \u003c- 1\nfoo[5,4]   \u003c- 1\nfoo[6:9,5] \u003c- 1\nfoo \u003c- raster(foo, xmn = 1, xmx = 9, ymn = 1, ymx = 9)\norigin \u003c- which.min(apply(\n              which(as.matrix(flip(foo, \"y\")) == 1, arr.ind = TRUE), 1, sum))\nres \u003c- raster2network(foo, origin)\n\npar(mfrow = c(1, 2))\nplot(foo)\nplot(foo); plot(res, add = TRUE)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsta%2Fstreamnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsta%2Fstreamnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsta%2Fstreamnet/lists"}