Skip to content

Commit

Permalink
Merge pull request #298 from dblodgett-usgs/v1.1.21
Browse files Browse the repository at this point in the history
v1.1.21
  • Loading branch information
dblodgett-usgs authored Nov 4, 2022
2 parents d111cc3 + 51efe27 commit 3a1dc91
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 77 deletions.
8 changes: 2 additions & 6 deletions DISCLAIMER.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Disclaimer
==========

Disclaimer
This information is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The information has not received final approval by the U.S. Geological Survey (USGS) and is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the information.

This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey (USGS), an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits
This software has been approved for release by the U.S. Geological Survey (USGS). Although the software has been subjected to rigorous review, the USGS reserves the right to update the software as needed pursuant to further analysis and review. No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. Furthermore, the software is released on condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from its authorized or unauthorized use.

Although this software program has been used by the USGS, no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith.
This software is provided "AS IS."
This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the [official USGS copyright policy](https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits "official USGS copyright policy")
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 1.1.21
# Version 1.1.21 (2022-11-03)

- All web calls now use `httr::RETRY()` to be a bit more robust. #213
- Password management can now be done with the [`keyring` package.](https://r-lib.github.io/keyring/index.html)
Expand Down
116 changes: 116 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
output: github_document
---

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

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

ScienceBase R Tools
===

Tools for interfacing R with ScienceBase data services.

## Package Description

This package provides a rich interface to USGS's [ScienceBase](https://www.sciencebase.gov/), a data cataloging and collaborative data management platform. For further information, see the [sbtools manuscript in The R Journal](https://journal.r-project.org/archive/2016-1/winslow-chamberlain-appling-etal.pdf) (USGS IP-075498). See `citation('sbtools')` for how to cite the package.

### Recommended Citation:

```
Winslow, LA, S Chamberlain, AP Appling, and JS Read. 2016. sbtools:
A package connecting R to cloud-based data for collaborative online
research. The R Journal 8:387-398.
```

Package source code DOI: https://doi.org/10.5066/P912NGFV

|Linux|Test Coverage|
|----------|------------|
| ![R-CMD-check](https://github.com/usgs-r/sbtools/workflows/R-CMD-check/badge.svg) |[![codecov.io](https://codecov.io/github/USGS-R/sbtools/coverage.svg?branch=master)](https://codecov.io/github/USGS-R/sbtools?branch=master)|

### Current CRAN information

|Version|Monthly Downloads|Total Downloads|
|----------|------------|------------|
|[![CRAN version](https://www.r-pkg.org/badges/version/sbtools)](https://cran.r-project.org/package=sbtools)|[![](https://cranlogs.r-pkg.org/badges/sbtools)](https://cran.r-project.org/package=sbtools)|[![](https://cranlogs.r-pkg.org/badges/grand-total/sbtools)](https://cran.r-project.org/package=sbtools)|

## Package Installation
To install the `sbtools` package, you must be using R 3.0 or greater and run the following command:

```r
install.packages("sbtools")
```

To get cutting-edge changes, install from GitHub using the `devtools` packages:

```r
remotes::install_github("USGS-R/sbtools")
```

## Reporting bugs

Please consider reporting bugs and asking questions on the Issues page:

[https://github.com/USGS-R/sbtools/issues](https://github.com/USGS-R/sbtools/issues)


Follow `@USGS_R` on Twitter for updates on USGS R packages:

[![Twitter Follow](https://img.shields.io/twitter/follow/USGS_R.svg?style=social&label=Follow%20USGS_R)](https://twitter.com/USGS_R)

## Examples

```{r example, eval=TRUE}
library(sbtools)
# Query ScienceBase for data about Antarctica
query_sb_text('Antarctica', limit=1)
# Query for a specific DOI
query_sb_doi('10.5066/F7M043G7')
# Inspect the contents of the above item
children <- item_list_children('557f0367e4b023124e8ef621')
sapply(children, function(child) child$title)
# Log in (requires a ScienceBase account) and create an item
authenticate_sb(Sys.getenv("sb_user")) # type in password
my_home_item <- user_id()
new_item <- item_create(title = 'new test item', parent_id = my_home_item)
test.txt <- file.path(tempdir(), 'test.txt')
writeLines(c('this is','my data file'), "test.txt")
item_append_files(new_item, "test.txt")
item_list_files(new_item)$fname
item_rm(new_item)
unlink("test.txt")
```

## Release Procedure

For release of the sbtools package, a number of steps are required.

1. Ensure all checks pass and code coverage is adequate.
1. Ensure `NEWS.md` reflects updates in version.
1. Update `DESCRIPTION` to reflect release version.
1. Build source package and upload to CRAN.
1. Once accepted to CRAN, convert `DISCLAIMER.md` to approved language.
1. Change references to main branch in `code.json` to release version.
1. Commit changes and tag repository at release version. Push tag.
1. Change `code.json` and `DISCLAIMER.md` back to development mode.

```{r disclaimer, child="DISCLAIMER.md", eval=TRUE}
```

[
![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png)
](https://creativecommons.org/publicdomain/zero/1.0/)
164 changes: 94 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,150 @@
ScienceBase R Tools
===

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

# ScienceBase R Tools

Tools for interfacing R with ScienceBase data services.

## Package Description

This package provides a rich interface to USGS's [ScienceBase](https://www.sciencebase.gov/), a data cataloging and collaborative data management platform. For further information, see the [sbtools manuscript in The R Journal](https://journal.r-project.org/archive/2016-1/winslow-chamberlain-appling-etal.pdf) (USGS IP-075498). See `citation('sbtools')` for how to cite the package.
This package provides a rich interface to USGS’s
[ScienceBase](https://www.sciencebase.gov/), a data cataloging and
collaborative data management platform. For further information, see the
[sbtools manuscript in The R
Journal](https://journal.r-project.org/archive/2016-1/winslow-chamberlain-appling-etal.pdf)
(USGS IP-075498). See `citation('sbtools')` for how to cite the package.

### Recommended Citation:

```
Winslow, LA, S Chamberlain, AP Appling, and JS Read. 2016. sbtools:
A package connecting R to cloud-based data for collaborative online
research. The R Journal 8:387-398.
```
Winslow, LA, S Chamberlain, AP Appling, and JS Read. 2016. sbtools:
A package connecting R to cloud-based data for collaborative online
research. The R Journal 8:387-398.

Package source code DOI: https://doi.org/10.5066/P912NGFV
Package source code DOI: <https://doi.org/10.5066/P912NGFV>

|Linux|Test Coverage|
|----------|------------|
| ![R-CMD-check](https://github.com/usgs-r/sbtools/workflows/R-CMD-check/badge.svg) |[![codecov.io](https://codecov.io/github/USGS-R/sbtools/coverage.svg?branch=master)](https://codecov.io/github/USGS-R/sbtools?branch=master)|
| Linux | Test Coverage |
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| ![R-CMD-check](https://github.com/usgs-r/sbtools/workflows/R-CMD-check/badge.svg) | [![codecov.io](https://codecov.io/github/USGS-R/sbtools/coverage.svg?branch=master)](https://codecov.io/github/USGS-R/sbtools?branch=master) |

### Current CRAN information

|Version|Monthly Downloads|Total Downloads|
|----------|------------|------------|
|[![CRAN version](https://www.r-pkg.org/badges/version/sbtools)](https://cran.r-project.org/package=sbtools)|[![](https://cranlogs.r-pkg.org/badges/sbtools)](https://cran.r-project.org/package=sbtools)|[![](https://cranlogs.r-pkg.org/badges/grand-total/sbtools)](https://cran.r-project.org/package=sbtools)|
| Version | Monthly Downloads | Total Downloads |
|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [![CRAN version](https://www.r-pkg.org/badges/version/sbtools)](https://cran.r-project.org/package=sbtools) | [![](https://cranlogs.r-pkg.org/badges/sbtools)](https://cran.r-project.org/package=sbtools) | [![](https://cranlogs.r-pkg.org/badges/grand-total/sbtools)](https://cran.r-project.org/package=sbtools) |

## Package Installation
To install the `sbtools` package, you must be using R 3.0 or greater and run the following command:

```r
To install the `sbtools` package, you must be using R 3.0 or greater and
run the following command:

``` r
install.packages("sbtools")
```

To get cutting-edge changes, install from GitHub using the `devtools` packages:
To get cutting-edge changes, install from GitHub using the `devtools`
packages:

```r
``` r
remotes::install_github("USGS-R/sbtools")
```

## Reporting bugs

Please consider reporting bugs and asking questions on the Issues page:

[https://github.com/USGS-R/sbtools/issues](https://github.com/USGS-R/sbtools/issues)

<https://github.com/USGS-R/sbtools/issues>

Follow `@USGS_R` on Twitter for updates on USGS R packages:

[![Twitter Follow](https://img.shields.io/twitter/follow/USGS_R.svg?style=social&label=Follow%20USGS_R)](https://twitter.com/USGS_R)
[![Twitter
Follow](https://img.shields.io/twitter/follow/USGS_R.svg?style=social&label=Follow%20USGS_R)](https://twitter.com/USGS_R)

## Examples

```r
``` r
library(sbtools)

# Query ScienceBase for data about Antarctica
query_sb_text('Antarctica', limit=1)
## [[1]]
## <ScienceBase Item>
## Title: Antarctica. Unnamed peak in the Nunataks near camp 18. January 21, 1978.
## Creator/LastUpdatedBy: /
## Provenance (Created / Updated): /
## Children:
## Item ID: 51dc2e89e4b0f81004b79cf6
## Parent ID: 519ba0a3e4b0e4e151ef5dd9
#> [[1]]
#> <ScienceBase Item>
#> Title: Tectonics of Antarctica
#> Creator/LastUpdatedBy: /
#> Provenance (Created / Updated): /
#> Children:
#> Item ID: 505ba488e4b08c986b3203fa
#> Parent ID: 4f4e4771e4b07f02db47e1e4

# Query for a specific DOI
query_sb_doi('10.5066/F7M043G7')
## [[1]]
## <ScienceBase Item>
## Title: 2013 Raw Ground Penetrating Radar Data on Alaska's Glaciers
## Creator/LastUpdatedBy: /
## Provenance (Created / Updated): 2015-06-15T16:55:03Z / 2015-12-15T20:39:06Z
## Children: TRUE
## Item ID: 557f0367e4b023124e8ef621
## Parent ID: 5474ec49e4b04d7459a7eab2
#> list()

# Inspect the contents of the above item
children <- item_list_children('557f0367e4b023124e8ef621')
#> Request failed [404]. Retrying in 1 seconds...
#> Request failed [404]. Retrying in 2.2 seconds...
#> Item not found for ID=557f0367e4b023124e8ef621. Either the item does not exist or the item is secured and requires authentication to access.FALSE
#> Request failed [404]. Retrying in 1.7 seconds...
#> Request failed [404]. Retrying in 1 seconds...
sapply(children, function(child) child$title)
## [1] "Raw Ground Penetrating Radar Data, Valdez Glacier, Alaska; 2013"
## [2] "Raw Ground Penetrating Radar Data, Gulkana Glacier, Alaska; 2013"
## [3] "Raw Ground Penetrating Radar Data, Eklutna Glacier, Alaska; 2013"
## [4] "Raw Ground Penetrating Radar Data, Eureka Glacier, Alaska; 2013"
## [5] "Raw Ground Penetrating Radar Data, Taku Glacier, Alaska; 2013"
## [6] "Raw Ground Penetrating Radar Data, Scott Glacier, Alaska; 2013"
## [7] "Raw Ground Penetrating Radar Data, Wolverine Glacier, Alaska; 2013"
#> list()

# Log in (requires a ScienceBase account) and create an item
authenticate_sb() # type in username and password
authenticate_sb(Sys.getenv("sb_user")) # type in password
my_home_item <- user_id()
new_item <- item_create(title = 'new test item', parent_id = my_home_item)
test.txt <- file.path(tempdir(), 'test.txt')
writeLines(c('this is','my data file'), test.txt)
item_append_files(new_item, test.txt)
writeLines(c('this is','my data file'), "test.txt")
item_append_files(new_item, "test.txt")
#> <ScienceBase Item>
#> Title: new test item
#> Creator/LastUpdatedBy: [email protected] / [email protected]
#> Provenance (Created / Updated): 2022-11-03T19:47:46Z / 2022-11-03T19:47:48Z
#> Children: FALSE
#> Item ID: 63641ae2d34ebe4425074d93
#> Parent ID: 4f7afec1e4b0b2f259355f30
item_list_files(new_item)$fname
## [1] "test.txt"
#> [1] "test.txt"

item_rm(new_item)
#> Response [https://www.sciencebase.gov/catalog/item/63641ae2d34ebe4425074d93?format=json]
#> Date: 2022-11-03 19:47
#> Status: 200
#> Content-Type: <unknown>
#> <EMPTY BODY>
unlink("test.txt")
```

## Release Procedure

For release of the sbtools package, a number of steps are required.

1. Ensure all checks pass and code coverage is adequate.
1. Ensure `NEWS.md` reflects updates in version.
1. Update `DESCRIPTION` to reflect release version.
1. Build source package and upload to CRAN.
1. Once accepted to CRAN, convert `DISCLAIMER.md` to approved language.
1. Change references to main branch in `code.json` to release version.
1. Commit changes and tag repository at release version. Push tag.
1. Change `code.json` and `DISCLAIMER.md` back to development mode.

## Disclaimer

This information is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The information has not received final approval by the U.S. Geological Survey (USGS) and is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the information.

From: https://www2.usgs.gov/fsp/fsp_disclaimers.asp#5

This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the [official USGS copyright policy](https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits "official USGS copyright policy")

Although this software program has been used by the USGS, no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith.
This software is provided "AS IS."

1. Ensure all checks pass and code coverage is adequate.
2. Ensure `NEWS.md` reflects updates in version.
3. Update `DESCRIPTION` to reflect release version.
4. Build source package and upload to CRAN.
5. Once accepted to CRAN, convert `DISCLAIMER.md` to approved language.
6. Change references to main branch in `code.json` to release version.
7. Commit changes and tag repository at release version. Push tag.
8. Change `code.json` and `DISCLAIMER.md` back to development mode.

# Disclaimer

This software has been approved for release by the U.S. Geological
Survey (USGS). Although the software has been subjected to rigorous
review, the USGS reserves the right to update the software as needed
pursuant to further analysis and review. No warranty, expressed or
implied, is made by the USGS or the U.S. Government as to the
functionality of the software and related material nor shall the fact of
release constitute any such warranty. Furthermore, the software is
released on condition that neither the USGS nor the U.S. Government
shall be held liable for any damages resulting from its authorized or
unauthorized use.

This software is in the public domain because it contains materials that
originally came from the U.S. Geological Survey, an agency of the United
States Department of Interior. For more information, see the [official
USGS copyright
policy](https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits "official USGS copyright policy")

[![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/)
Loading

0 comments on commit 3a1dc91

Please sign in to comment.