{"id":22503731,"url":"https://github.com/mdsumner/noswimming","last_synced_at":"2025-03-27T23:14:55.894Z","repository":{"id":265009948,"uuid":"842309339","full_name":"mdsumner/noswimming","owner":"mdsumner","description":"Prevent Animals from Swimming on Land","archived":false,"fork":false,"pushed_at":"2024-08-14T05:01:26.000Z","size":340,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T11:19:31.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsumner.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-14T05:00:37.000Z","updated_at":"2024-08-14T05:02:41.000Z","dependencies_parsed_at":"2024-11-27T07:16:10.207Z","dependency_job_id":null,"html_url":"https://github.com/mdsumner/noswimming","commit_stats":null,"previous_names":["mdsumner/noswimming"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fnoswimming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fnoswimming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fnoswimming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fnoswimming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsumner","download_url":"https://codeload.github.com/mdsumner/noswimming/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245938228,"owners_count":20697008,"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","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":[],"created_at":"2024-12-06T23:39:06.106Z","updated_at":"2025-03-27T23:14:55.822Z","avatar_url":"https://github.com/mdsumner.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, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# noswimming\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThe goal of noswimming is to prevent animals from leaving the ocean. (i.e. swimming on land is not allowed)\n\n## WIP\n\nThe name isn't very serious, or accurate, or what we want. TBD (donotcross ?)\n\n## Installation\n\nYou can install the development version of noswimming like so:\n\n``` r\n## install.packages(\"remotes\")\nremotes::install_github(\"mdsumner/noswimming\")\n```\n\n## Example\n\nThis is a basic example which finds the least cost path around land (we get a topographic dataset under the hood to figure this out). \n\n```{r example}\nlibrary(noswimming)\n#pt \u003c- cbind(c(-90, 90), c(-70, -60))\npt \u003c- cbind(c(138, 153),  c(-36, -23))\npath \u003c- lcp(pt)\n\nlibrary(terra)\n## we get the data in the projection use\nplot(path)\n## so reproject for longlat use\nplot(terra::project(path, \"EPSG:4326\"), lty = 2, col = \"firebrick\")\nmaps::map(add = TRUE)\n```\n\nTo turn `path` into longlat, do this: \n\n```{r path}\nll \u003c- terra::geom(terra::project(path, \"EPSG:4326\"))[,c(\"x\", \"y\")]\nstr(ll)\n```\n\n\nWe can also obtain the intermediate datasets used in the above process. \n\n```{r intermediate}\n\npt1 \u003c- cbind(c(-90, 90), c(-70, -60))\ntopo \u003c- make_global_topo(pt1)\n\n## here we might customize the min and max value of the topography (from [-Inf,0])\nsurf \u003c- make_na_surface(topo)\n\npath \u003c- lcp(pt1, surf = surf)\nplot(topo)\nplot(path, add = TRUE, col = \"hotpink\")\n```\n\n\nIt's not really going to be valid in this crs for such long pathways, but we might improve that (you would need a custom projection like Oblique Mercator). \n\n\n```{r longer}\npt2 \u003c- cbind(c(-76, -118), c(-52, 70))\ntopo \u003c- make_global_topo(pt2)\n\n## here we might customize the min and max value of the topography (from [-Inf,0])\nsurf \u003c- make_na_surface(topo)\n\npath \u003c- lcp(pt2, surf = surf)\ntopo[topo \u003e 0] \u003c- NA\n\nplot(topo)\nplot(path, add = TRUE, col = \"hotpink\", lwd = 2)\n```\n\n\n\n## Code of Conduct\n  \nPlease note that the noswimming project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fnoswimming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsumner%2Fnoswimming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fnoswimming/lists"}