{"id":22798091,"url":"https://github.com/doi-usgs/geoknife","last_synced_at":"2025-04-09T19:18:50.584Z","repository":{"id":44596417,"uuid":"10252218","full_name":"DOI-USGS/geoknife","owner":"DOI-USGS","description":"R tools for geo-web processing of gridded data via the Geo Data Portal. geoknife slices up gridded data according to overlap with irregular features, such as watersheds, lakes, points, etc.","archived":false,"fork":false,"pushed_at":"2023-04-06T02:31:12.000Z","size":3224,"stargazers_count":69,"open_issues_count":20,"forks_count":23,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-09T19:18:44.354Z","etag":null,"topics":["geo-data-portal","grid-data","r","r-package","rstats","usgs"],"latest_commit_sha":null,"homepage":"https://doi-usgs.github.io/geoknife/","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/DOI-USGS.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.note","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-05-23T20:00:51.000Z","updated_at":"2023-04-11T20:51:41.000Z","dependencies_parsed_at":"2023-09-25T09:33:03.658Z","dependency_job_id":null,"html_url":"https://github.com/DOI-USGS/geoknife","commit_stats":{"total_commits":981,"total_committers":9,"mean_commits":109.0,"dds":0.2222222222222222,"last_synced_commit":"59b358bec3bd90e4743623f13b0be2f4de84f473"},"previous_names":["usgs-r/geoknife"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DOI-USGS%2Fgeoknife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DOI-USGS%2Fgeoknife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DOI-USGS%2Fgeoknife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DOI-USGS%2Fgeoknife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DOI-USGS","download_url":"https://codeload.github.com/DOI-USGS/geoknife/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094990,"owners_count":21046770,"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":["geo-data-portal","grid-data","r","r-package","rstats","usgs"],"created_at":"2024-12-12T06:08:17.987Z","updated_at":"2025-04-09T19:18:50.552Z","avatar_url":"https://github.com/DOI-USGS.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"README\"\nauthor: \"Jordan S Read\"\npackage version: \"`r as.character(packageVersion('geoknife'))`\"\ndate: \"`r format(Sys.time(), '%d %B, %Y')`\"\noutput:\n  md_document:\n    variant: markdown_github\n---\n# `geoknife` package version `r packageVersion('geoknife')`\n\n\u003c!-- ![R-CMD-check](https://github.com/doi-usgs/geoknife/workflows/R-CMD-check/badge.svg) [![codecov](https://codecov.io/gh/doi-usgs/geoknife/branch/master/graph/badge.svg)](https://codecov.io/gh/doi-usgs/geoknife) --\u003e\n[![CRAN](https://www.r-pkg.org/badges/version/geoknife)](https://cran.r-project.org/package=geoknife)\n[![Download Count](http://cranlogs.r-pkg.org/badges/geoknife)](https://cran.r-project.org/package=geoknife)  \n\nTools for geo-web processing of gridded data via the [Geo Data Portal](https://labs.waterdata.usgs.gov/gdp_web/ \"Geo Data Portal\"). `geoknife` slices up gridded data according to overlap with irregular features, such as watersheds, lakes, points, etc. The result is subsetted data in plain text, NetCDF, geotiff or other formats.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/geoknife.png\" alt=\"GDP\" align=\"center\"\u003e\n\u003c/p\u003e  \n\u003cbr /\u003e \n\n### Installing `geoknife`\n\n\nTo install the `geoknife` from CRAN:  \n``` r\ninstall.packages(\"geoknife\")\n```\n\n```{r setup, echo=FALSE}\n  library(knitr)\n  opts_chunk$set(fig.path = \"inst/\", dev='png') \n```\n\nOr to install the current development version of the package:  \n```{r, eval=FALSE}\ninstall.packages(\"remotes\")\nremotes::install_github('DOI-USGS/geoknife')\n```\n\n### Reporting bugs\n\nPlease consider reporting bugs and asking questions on the Issues page:\n[https://github.com/DOI-USGS/geoknife/issues](https://github.com/DOI-USGS/geoknife/issues)\n\n### Code of Conduct\n\nWe want to encourage a warm, welcoming, and safe environment for contributing to this project. See the [code of conduct](https://github.com/DOI-USGS/geoknife/blob/master/CONDUCT.md) for more information.\n\n### Package Support\n\nThe Water Mission Area of the USGS supports the development and maintenance of `geoknife` through September 2018, and most likely further into the future. Resources are available primarily for maintenance and responding to user questions. Priorities on the development of new features are determined by the `geoknife` development team.\n\n[![USGS](http://doi-usgs.github.io/images/usgs.png)](https://www.usgs.gov/)\n\n## `geoknife` overview\nThe `geoknife` package was created to support web-based geoprocessing of large gridded datasets according to their overlap with landscape (or aquatic/ocean) features that are often irregularly shaped. `geoknife` creates data access and subsequent geoprocessing requests for the USGS's Geo Data Portal to carry out on a web server. The results of these requests are available for download after the processes have been completed. This type of workflow has three main advantages: 1) it allows the user to avoid downloading large datasets, 2) it avoids reinventing the wheel for the creation and optimization of complex geoprocessing algorithms, and 3) computing resources are dedicated elsewhere, so `geoknife` operations do not have much of an impact on a local computer. \n\n`geoknife` interacts with a remote server to figure out what types of processing capabilities are available, in addition to seeing what types of geospatial features are already available to be used as an area of interest (commonly, these are user-uploaded shapefiles). Because communication with web resources are central to `geoknife` operations, users must have an active internet connection. \n\nThe main elements of setting up and carrying out a `geoknife` 'job' (`geojob`) include defining the feature of interest (the `stencil` argument in the `geoknife` function), the gridded web dataset to be processed (the `fabric` argument in the `geoknife` function), and the the processing algorithm parameters (the `knife` argument in the `geoknife` function). The status of the `geojob` can be checked with `check`, and output can be loaded into a data.frame with `result`. \n\n### What can `geoknife` do?\n##### Define a stencil that represents the geographic region to slice out of the data\n\n```{r, message=FALSE, warning=FALSE}\nlibrary(geoknife)\n# from a single point\nstencil \u003c- simplegeom(c(-89, 46.23))\n   # -- or --\n# from a collection of named points\nstencil \u003c- simplegeom(data.frame(\n              'point1' = c(-89, 46), \n              'point2' = c(-88.6, 45.2)))\n   # -- or --\n#for a state from a web available dataset\nstencil \u003c- webgeom('state::New Hampshire')\nstencil \u003c- webgeom('state::New Hampshire,Wisconsin,Alabama')\n   # -- or --\n#for HUC8s from a web available dataset\nstencil \u003c- webgeom('HUC8::09020306,14060009')\n```\n##### Define a fabric that represents the underlying data\n```{r}\n# from the prism dataset:\nfabric \u003c- webdata('prism')\n   # -- or --\n# explicitly define webdata from a list:\nfabric \u003c- webdata(list(\n            times = as.POSIXct(c('1895-01-01','1899-01-01')),\n            url = 'https://cida.usgs.gov/thredds/dodsC/prism_v2',\n            variables = 'ppt'))\n# modify the times field:\ntimes(fabric) \u003c- as.POSIXct(c('2003-01-01','2005-01-01'))\n```\n##### Create the processing job that will carry out the subsetting/summarization task\n```{r}\njob \u003c- geoknife(stencil, fabric, wait = TRUE)\n\n# use existing convienence functions to check on the job:\ncheck(job)\n```\nsee also: \n```{r, eval=FALSE}\nrunning(job)\nerror(job)\nsuccessful(job)\n```\n##### Plot the results\n```{r, fig.height=3.5, fig.width=7}\ndata \u003c- result(job)\nplot(data[,1:2], ylab = variables(fabric))\n```\n\n##### Use an email to listen for process completion\n```{r, eval=FALSE}\njob \u003c- geoknife(webgeom('state::New Hampshire'), fabric = 'prism', email = 'fake.email@gmail.com')\n```\n\n### `geoknife` Functions (as of v1.1.5)\n| Function       | Title           |\n| ------------- |:-------------|\n| `geoknife` | slice up gridded data according to overlap with feature(s) |\n| `gconfig` | set or query package settings for `geoknife` processing defaults |\n| `algorithm` | the algorithm of a `webprocess` |\n| `attribute` | the attribute of an `webgeom` |\n| `check` | check status of `geojob` |\n| `download` | download the results of a `geojob` |\n| `error` | convenience  function for state of `geojob` |\n| `running` | convenience  function for state of `geojob` |\n| `successful` | convenience  function for state of `geojob` |\n| `start` | start a `geojob` |\n| `cancel` | cancel a `geojob` |\n| `geom` | the geom of a `webgeom` | \n| `inputs` | the inputs of a `webprocess` |\n| `id` | the process id of a `geojob` |\n| `values` | the values of a `webgeom` | \n| `result` | load the output of a completed `geojob` into data.frame |\n| `variables` | the variables for a `webdata` object |\n| `wait` | wait for a `geojob` to complete processing |\n| `times` | the times of a `webdata` object |\n| `url` | the url of a `webdata`, `webgeom`, `geojob`, or `webprocess` |\n| `version` | the version of a `webgeom` or `webdata` |\n| `xml` | the xml of a `geojob` |\n| `query` | query datasets or variables |\n\n### `geoknife` classes (as of v0.12.0)\n| Class       | Title           |\n| ------------- |:-------------|\n| `simplegeom` | a simple geometric class. Extends `sp::SpatialPolygons` |\n| `webgeom` | a web feature service geometry |\n| `webprocess` | a web processing service |\n| `webdata` | web data |\n| `geojob` | a geo data portal processing job |\n| `datagroup` | a simple class that contains data lists that can be `webdata` |\n\n## What libraries does `geoknife` need?\nThis version requires `httr`, `sp`, and `XML`. All of these packages are available on CRAN, and will be installed automatically when using the `install.packages()` instructions above.\n\n\n## Check Notes:\nIn addition to typical R package checking, a Dockerfile is included in this repository. Once built, it can be run with the following command.\n\n```\ndocker build -t geoknife_test .\n\ndocker run --rm -it -v %cd%:/src geoknife_test /bin/bash -c \"cp -r /src/* /check/ \u0026\u0026 cp /src/.Rbuildignore /check/ \u0026\u0026 cd /check \u0026\u0026 Rscript -e 'devtools::build()' \u0026\u0026 R CMD check --as-cran ../geoknife_*\"\n```\n\n## Release Procedure\n\nFor release of the sbtools package, a number of steps are required.\n\n1. Ensure all checks pass and code coverage is adequate.\n1. Ensure `NEWS.md` reflects updates in version.\n1. Update `DESCRIPTION` to reflect release version.\n1. Convert `DISCLAIMER.md` to approved language and rebuild `README.Rmd`.\n1. Create release candidate branch and commit release candidate.\n1. Build source package and upload to CRAN.\n1. Once accepted to CRAN, tag release candidate branch an push to repositories.\n1. Change `DISCLAIMER.md` back to development mode and increment description version.\n1. Merge release candidate and commit.\n1. Open PR/MR in development state.\n\n```{r disclaimer, child=\"DISCLAIMER.md\", eval=TRUE}\n\n```\n\n [\n    ![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png)\n  ](https://creativecommons.org/publicdomain/zero/1.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoi-usgs%2Fgeoknife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoi-usgs%2Fgeoknife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoi-usgs%2Fgeoknife/lists"}