Skip to content

Commit

Permalink
Merge pull request #37 from cct-datascience/release-prep
Browse files Browse the repository at this point in the history
Prep for 0.1.0 release
  • Loading branch information
Aariq authored Feb 14, 2023
2 parents 980e41f + 1bde09c commit 084da51
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: azmetr
Title: Access the AZMet API
Version: 0.0.0.9000
Version: 0.1.0
Authors@R:
person("Eric", "Scott", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7430-7879"))
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# azmetr (development version)
# azmetr 0.1.0

- functions now check if supplied `station_id` is valid and an active station before querying the API
- added `station_info` dataset with station names, IDs, and location.
Expand Down
2 changes: 1 addition & 1 deletion R/az_add_units.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @export
#'
#' @examples
#' \donttest{
#' \dontrun{
#' daily <- az_daily()
#'
#' daily_units <-
Expand Down
2 changes: 2 additions & 0 deletions R/az_daily.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#' @export
#'
#' @examples
#' \dontrun{
#' # Most recent data for all stations:
#' az_daily()
#'
Expand All @@ -40,6 +41,7 @@
#' # Specify dates:
#' az_daily(start_date = "2022-09-25")
#' az_daily(start_date = "2022-09-25", end_date = "2022-09-26")
#' }
#'
az_daily <- function(station_id = NULL, start_date = NULL, end_date = NULL) {

Expand Down
2 changes: 2 additions & 0 deletions R/az_heat.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#' @export
#'
#' @examples
#' \dontrun{
#' # Most recent data for all stations:
#' az_heat()
#'
Expand All @@ -45,6 +46,7 @@
#' yr <- format(Sys.Date(), "%Y")
#'
#' az_heat(end_date = paste(yr, "03", "31", sep = "-"))
#' }
#'
az_heat <- function(station_id = NULL, start_date = NULL, end_date = NULL) {

Expand Down
2 changes: 2 additions & 0 deletions R/az_hourly.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#' @export
#'
#' @examples
#' \dontrun{
#' # Most recent data for all stations:
#' az_hourly()
#'
Expand All @@ -39,6 +40,7 @@
#' # Specify dates:
#' az_hourly(start_date_time = "2022-09-25 01")
#' az_hourly(start_date_time = "2022-09-25 01", end_date = "2022-09-25 20")
#' }
#'
az_hourly <- function(station_id = NULL, start_date_time = NULL, end_date_time = NULL) {

Expand Down
4 changes: 2 additions & 2 deletions R/parse_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ parse_params <- function(station_id, start, end, hour = FALSE) {
}
} else {
parse_fun <- function(x) {
lubridate::parse_date_time(x, orders = c("Ymd", "YmdHMS", "YmdHM", "YmdH")) |>
lubridate::floor_date(unit = "day") |>
lubridate::parse_date_time(x, orders = c("Ymd", "YmdHMS", "YmdHM", "YmdH")) %>%
lubridate::floor_date(unit = "day") %>%
lubridate::as_date()
}
}
Expand Down
6 changes: 6 additions & 0 deletions R/release_questions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
release_bullets <- function() {
c(
"[Pre-compute vignettes](https://ropensci.org/blog/2019/12/08/precompute-vignettes/)",
"Check that only magrittr pipe (`%>%`) and not base pipe (`|>`) is used"
)
}
5 changes: 5 additions & 0 deletions R/retrieve_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ retrieve_data <- function(station_id, start_f, time_interval,
endpoint = c("daily", "hourly", "hueto")) {
endpoint <- match.arg(endpoint)
path <- c("v1", "observations", endpoint, station_id, start_f, time_interval)

# TODO: there are probably better ways to do this:
# limit request rate
Sys.sleep(0.2)

res <- httr::GET(base_url, path = path, httr::accept_json())
check_status(res)
data_raw <- httr::content(res, as = "parsed")
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ The goal of azmetr is to provide programmatic access to the [Arizona Meteorologi
You can install the development version of `azmetr` from r-universe:

```r
# Enable repository from cct-datascience
options(repos = c(
cctdatascience = 'https://cct-datascience.r-universe.dev',
CRAN = 'https://cloud.r-project.org'))

# Download and install azmetr in R
install.packages('azmetr')
install.packages('azmetr', repos = c('https://cct-datascience.r-universe.dev', 'https://cloud.r-project.org'))
```

Alternatively, you can install a development version directly from GitHub with the `remotes` package:
Expand Down
2 changes: 1 addition & 1 deletion man/az_add_units.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/az_daily.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/az_heat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/az_hourly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vignettes/metadata.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ You can add the correct units to data returned by `az_daily()`, `az_hourly()`, o

```{r}
hourly <-
az_hourly() |>
az_hourly() %>%
az_add_units()
hourly |>
select(-starts_with("meta_"), -starts_with("date_")) |>
hourly %>%
select(-starts_with("meta_"), -starts_with("date_")) %>%
head()
```

Expand All @@ -41,7 +41,7 @@ This requires that you have the `units` package installed and will prompt you to
`az_add_units()` converts numeric vectors to those of class "units". These units columns behave differently than ordinary numeric vectors and have a few useful properties. First, you can do unit conversion using `set_units()` from the `units` package.

```{r}
hourly |>
hourly %>%
transmute(wind_spd_kph = set_units(wind_spd_mps, "km/h"),
sol_rad_total = set_units(sol_rad_total, "W h m-2"),
temp_airK = set_units(temp_airF, "Kelvins"))
Expand All @@ -51,7 +51,7 @@ Second, it won't allow you to do math where the units aren't compatible.

```{r}
#| error: true
hourly |>
hourly %>%
transmute(wind_rain = wind_spd_mps + precip_total)
```

Expand Down

0 comments on commit 084da51

Please sign in to comment.