Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Dec 20, 2018
2 parents 1034224 + 73d4e46 commit db7e4c2
Show file tree
Hide file tree
Showing 45 changed files with 1,091 additions and 1,282 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:
command: |
R -e "devtools::install_deps(dependencies = TRUE)"
R -e "devtools::install_github('MangoTheCat/goodpractice')"
no_output_timeout: 30m
- run:
command: |
R -e "devtools::check()"
R -e "devtools::check(run_dont_test = TRUE)"
no_output_timeout: 30m
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "DESCRIPTION" }}-{{ checksum ".circleci/config.yml" }}
paths:
Expand All @@ -31,6 +33,7 @@ jobs:
R -e "goodpractice::gp(checks = grep('(rcmdcheck|covr)', goodpractice::all_checks(), invert=TRUE, value=TRUE))"
R -e "cv <- covr::package_coverage(); print(cv); covr::report(x = cv, file = '/root/main/artifacts/gsodr-coverage.html', browse=FALSE)"
R CMD Rd2pdf --force --output='/root/main/artifacts/gsodr-manual.pdf' .
no_output_timeout: 30m
- store_artifacts:
path: /root/main/artifacts/
destination: artifacts
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: GSODR
Type: Package
Title: Global Surface Summary of the Day ('GSOD') Weather Data Client
Version: 1.3.0
Version: 1.3.1
Authors@R: c(person("Adam", "Sparks", role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-0061-8359")),
Expand Down
22 changes: 16 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# GSODR 1.3.1

## Bug fixes

- Fix examples that did not run properly

## Minor changes

- Update internal database of station locations

# GSODR 1.3.0

## New Functionality
Expand All @@ -10,10 +20,10 @@
## Bug fixes

- Refactor internal functionality to be more clear and efficient in execution

- `country-list` is not loaded unless user has specified a country in
`get_GSOD()`

- An instance where the FIPS code was determined twice was removed

- Replace `\dontrun{}` with `\donttest{}` in documentation examples
Expand All @@ -28,19 +38,19 @@

- Store internal database of station locations fields `BEGIN` and `END` as
integer, not double

- Clarify code of conduct statement in README that it only applies to this,
GSODR, project

- Prompt user for input with warning about reproducibility if using the
`update_station_list()` function

- Adds metadata header to the `tibble` returned by `get_inventory()`

- Remove startup message to conform with rOpenSci guidelines

- Remove extra code, clean up code-chunks and use `hrbrthemes::theme_ipsum()`
for
for
[data-raw/fetch_isd-history.md](https://github.com/ropensci/GSODR/blob/master/data-raw/fetch_isd-history.md)

--------------------------------------------------------------------------------
Expand Down
19 changes: 4 additions & 15 deletions R/get_GSOD.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#'
#' Parallel processing can be enabled using \code{\link[future]{plan}} to set
#' up a parallel backend of your choice, e.g.,
#' \code{future::plan(multisession)}. See examples for more.
#' \code{future::plan("multisession")}. See examples for more.
#'
#' @details
#' Stations reporting a latitude of < -90 or > 90 or longitude of < -180 or >
Expand Down Expand Up @@ -85,15 +85,15 @@
#' AUS
#'
#' # Download agroclimatology data for 2015 using parallel processing
#' future::plan(multisession)
#' future::plan("multisession")
#' ag <- get_GSOD(years = 2015, agroclimatology = TRUE)
#'
#' ag
#'
#' # Download global data for 2010 to 2015 with a maximum allowed 5 missing days
#' # of data using parallel processing
#'
#' future::plan(multisession)
#' future::plan("multisession")
#' global <- get_GSOD(years = 2010:2015, max_missing = 5)
#'
#' global
Expand Down Expand Up @@ -194,16 +194,5 @@ get_GSOD <- function(years,

GSOD_XY <- apply_process_gz(file_list, isd_history)
return(GSOD_XY)
# Cleanup --------------------------------------------------------------------
files <-
list.files(
cache_dir,
ignore.case = TRUE,
include.dirs = TRUE,
full.names = TRUE,
recursive = TRUE,
pattern = ".gz$"
)
unlink(files, force = TRUE, recursive = TRUE)
rm(cache_dir)
}

8 changes: 4 additions & 4 deletions R/internal_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
tryCatch(
Map(
function(ftp, dest)
utils::download.file(
curl::curl_download(
url = ftp,
destfile = dest,
mode = "wb"
Expand Down Expand Up @@ -190,7 +190,7 @@
return()
}
}

pb <- dplyr::progress_estimated(length(years))
purrr::walk(years, function(yr) {
year_url <- sprintf(ftp_base, yr)
Expand All @@ -202,7 +202,7 @@
purrr::map(station, ~ grep(., fils, value = TRUE)) %>%
purrr::keep( ~ length(.) > 0) %>%
purrr::flatten_chr() -> fils

if (length(fils) > 0) {
# grab the station files
purrr::walk(paste0(year_url, fils), retry_cfd)
Expand Down Expand Up @@ -247,7 +247,7 @@
isd_history,
cache_dir,
years) {

station_list <-
isd_history[isd_history$CTRY == country, ]$STNID
station_list <- do.call(paste0,
Expand Down
2 changes: 1 addition & 1 deletion R/reformat_GSOD.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' Parallel processing can be enabled using \code{\link[future]{plan}} to set
#' up a parallel backend of your choice, e.g.,
#' \code{future::plan(multisession)}. See examples for more.
#' \code{future::plan("multisession")}. See examples for more.
#'
#' @param dsn User supplied file path to location of data files on local disk
#' for tidying.
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"keywords": ["US-NCEI", "meteorological-data", "global-weather", "weather", "weather-data", "meteorology", "station-data", "surface-weather", "data-access", "US-NCDC", "r", "gsod", "ncdc", "weather-stations", "global-data", "ncei", "weather-information", "historical-weather", "historical-data", "daily-data", "daily-weather", "rstats", "r-package", "peer-reviewed"],
"license": "https://spdx.org/licenses/MIT",
"title": "GSODR",
"version": "1.3.0",
"version": "1.3.1",
"name": "GSODR: Global Surface Summary of the Day ('GSOD') Weather Data Client",
"issueTracker": "https://github.com/ropensci/GSODR/issues",
"programmingLanguage": {
Expand Down Expand Up @@ -447,7 +447,7 @@
"contIntegration": "https://travis-ci.org/ropensci/GSODR",
"releaseNotes": "https://github.com/ropensci/GSODR/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/GSODR/blob/master/README.md",
"fileSize": "1237.803KB",
"fileSize": "1236.959KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down
9 changes: 4 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

- macOS, R version 3.5.1 (2018-07-02)

- Debian Linux, R version 3.5.1 (2018-07-02)
- Ubuntu Linux 18.04.1, R version 3.5.1 (2018-07-02)

- win-builder, R Under development (unstable) (2018-09-20 r75339)
- win-builder, R Under development (unstable) (2018-12-17 r75857)

- win-builder, R version 3.5.1 (2018-04-23)

Expand All @@ -13,10 +13,9 @@

0 errors | 0 warnings | 1 note

# New Minor Release
# New Patch Release

- This release adds functionality to support using the `future` package for
parallel processing
- This release fixes examples that were incorrectly written and would not run

# Reverse dependencies

Expand Down
18 changes: 11 additions & 7 deletions data-raw/fetch_country-list.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ codes are used when a user selects a single country for a data query.
Read "country-list.txt" file from NCEI FTP server and merge with _countrycode_
data.

```{r download_merge_inspect, echo=TRUE, messages=FALSE}
```{r download-merge-inspect, echo=TRUE, messages=FALSE}
if (!require("countrycode"))
{
install.packages("countrycode",
Expand All @@ -32,7 +32,11 @@ if (!require("dplyr"))
install.packages("dplyr",
repos = c(CRAN = "https://cran.rstudio.com"))
}
```

```{r read-table, echo=TRUE, messages=FALSE}
```{r download-and-merge, echo=TRUE, message=FALSE}
countries <- readr::read_table(
"ftp://ftp.ncdc.noaa.gov/pub/data/noaa/country-list.txt")[-1, c(1, 3)]
names(countries)[2] <- "COUNTRY_NAME"
Expand All @@ -46,10 +50,12 @@ print(country_list)
There are unnecessary data in several columns. _GSODR_ only requires FIPS, name,
and ISO codes to function.

```{r remove_uncessesary, echo=TRUE, messages=FALSE}
country_list <- select(country_list, c("FIPS", "COUNTRY_NAME", "iso2c", "iso3c"))

```{r remove-uncessesary, echo=TRUE, messages=FALSE}
country_list <- dplyr::select(country_list, c("FIPS",
"COUNTRY_NAME",
"iso2c",
"iso3c"))
country_list
```

Expand All @@ -65,9 +71,7 @@ save(country_list, file = "../inst/extdata/country_list.rda",

Users of these data should take into account the following (from the
[NCEI website](http://www7.ncdc.noaa.gov/CDO/cdoselect.cmd?datasetabbv=GSOD&countryabbv=&georegionabbv=)):

> "The following data and products may have conditions placed on their
> international commercial use. They can be used within the U.S. or for
> "The following data and products may have conditions placed on their international commercial use. They can be used within the U.S. or for
> non-commercial international activities without restriction. The non-U.S.
> data cannot be redistributed for commercial purposes. Re-distribution of these
> data by others must provide this same notification."
Expand Down
Loading

0 comments on commit db7e4c2

Please sign in to comment.