Skip to content

Commit

Permalink
README/License/Contributing created. Minimized queries for examples. …
Browse files Browse the repository at this point in the history
…Other tweaks in response to `devtools::check()`
  • Loading branch information
rywhale committed Jan 19, 2023
1 parent 0d78cf4 commit 921fa17
Show file tree
Hide file tree
Showing 28 changed files with 874 additions and 151,587 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
47 changes: 47 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to mscgeometR

This outlines how to propose a change to mscgeometR.
For more detailed info about contributing to this, and other tidyverse packages, please see the
[**development contributing guide**](https://rstd.io/tidy-contrib).

## Fixing typos

You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the _source_ file.
This generally means you'll need to edit [roxygen2 comments](https://roxygen2.r-lib.org/articles/roxygen2.html) in an `.R`, not a `.Rd` file.
You can find the `.R` file that generates the `.Rd` by reading the comment in the first line.

## Bigger changes

If you want to make a bigger change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed.
If you’ve found a bug, please file an issue that illustrates the bug with a minimal
[reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed).

### Pull request process

* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("rywhale/mscgeometR", fork = TRUE)`.

* Install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
* Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`.

* Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser.
The title of your PR should briefly describe the change.
The body of your PR should contain `Fixes #issue-number`.

* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in <https://style.tidyverse.org/news.html>.

### Code style

* New code should follow the tidyverse [style guide](https://style.tidyverse.org).
You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR.

* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.

* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests.
Contributions with test cases included are easier to accept.

## Code of Conduct

Please note that the mscgeometR project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this
project you agree to abide by its terms.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author: Who wrote it
Maintainer: The package maintainer <[email protected]>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Suggests:
Expand Down
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: mscgeometR authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 mscgeometR authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 16 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export(geomet_ahccd_data)
export(geomet_ahccd_stns)
export(geomet_api_collections)
export(geomet_api_queryables)
export(geomet_clim_means)
export(geomet_clim_normals)
export(geomet_clim_stns)
export(geomet_hydro_annuals)
export(geomet_hydro_means)
export(geomet_hydro_realtime)
export(geomet_hydro_stns)
export(geomet_ltce_data)
export(geomet_ltce_stns)
export(geomet_swob_realtime)
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# mscgeometR 0.1.0

* First iteration of package
* Added a `NEWS.md` file to track changes to the package.
* Add contribution guidelines
4 changes: 2 additions & 2 deletions R/ahccd.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ geomet_ahccd_stns <- function(query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_ahccd_data
Expand Down Expand Up @@ -84,5 +84,5 @@ geomet_ahccd_data <- function(station_number, period = "month", query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}
15 changes: 9 additions & 6 deletions R/climate.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ geomet_clim_stns <- function(query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_clim_normals
Expand Down Expand Up @@ -60,7 +60,7 @@ geomet_clim_normals <- function(station_number, query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_clim_means
Expand Down Expand Up @@ -141,7 +141,7 @@ geomet_clim_means <- function(station_number, start_date, end_date,

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_swob_realtime
Expand All @@ -161,8 +161,11 @@ geomet_clim_means <- function(station_number, start_date, end_date,
#' @examples
#' geomet_swob_realtime(
#' station_number = "1192948",
#' start_date = Sys.Date() - 2,
#' end_date = Sys.Date()
#' start_date = Sys.Date(),
#' end_date = Sys.Date(),
#' query = list(
#' "_is-minutely_obs-value" = "false"
#' )
#' )
#'
geomet_swob_realtime <- function(station_number, start_date, end_date, query) {
Expand Down Expand Up @@ -205,5 +208,5 @@ geomet_swob_realtime <- function(station_number, start_date, end_date, query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}
5 changes: 2 additions & 3 deletions R/geomet_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#' @param query List of parameters to be passed to query
#' @return \code{geomet_api_resp} object
#' @keywords internal
#' @noRd
#'
geomet_api_query <- function(endpoint = "https://api.weather.gc.ca/",
path, query = list()) {
Expand Down Expand Up @@ -61,7 +60,6 @@ geomet_api_query <- function(endpoint = "https://api.weather.gc.ca/",
#' @param req \code{geomet_api_resp} object
#' @return \code{tibble} containing all paged results
#' @keywords internal
#' @noRd
#'
geomet_api_paginate <- function(req, geometry = TRUE) {
parsed_req <- req$content$features
Expand Down Expand Up @@ -137,7 +135,8 @@ geomet_api_queryables <- function(collection){
purrr::map_df(
parsed_req,
~{
dplyr::tibble(queryable = .x$title, type = .x$type)
# dplyr::tibble(queryable = .x$title, type = .x$type)
dplyr::tibble(queryable = .x[["title"]], type = .x[["type"]])
}
)

Expand Down
5 changes: 2 additions & 3 deletions R/geomet_wcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' repeating large queries.
#' @return `httr` response or path to file if `save_to_disk`
#' @keywords internal
#' @noRd
#'
geomet_wcs_query <- function(query, end_point = "geomet", save_to_disk = FALSE){

Expand Down Expand Up @@ -136,8 +135,8 @@ geomet_wcs_bands <- function(coverage_id, end_point = "geomet"){
#' geomet_wcs_data
#'
#' @description Performs query for specified product and query parameters. Saves
#' output to temporary file and provides file path. Note that temporary files are
#' deleted when the current R session ends.
#' output to temporary GeoTIFF file and returns file path.
#' Note that temporary files are deleted when the current R session ends.
#' @param coverage_id Product identifier, see `geomet_wcs_capabilities`
#' @param query List of parameters to pass to query, see
#' \href{https://eccc-msc.github.io/open-data/msc-geomet/web-services_en/#web-coverage-service-wcs}{ECCC Docs}
Expand Down
14 changes: 9 additions & 5 deletions R/hydrometric.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
#' @return \code{tibble} containing hydrometric station information
#' @export
#' @examples
#' geomet_hydro_stns()
#' geomet_hydro_stns(
#' query = list(
#' "PROV_TERR_STATE_LOC" = "ON"
#' )
#' )
#'
geomet_hydro_stns <- function(query) {
query_path <- "collections/hydrometric-stations/items"
Expand All @@ -21,7 +25,7 @@ geomet_hydro_stns <- function(query) {
# Check for/handle pagination
parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -c(links, type))
dplyr::select(parsed_req, -c("links", "type"))
}

#' geomet_hydro_means
Expand Down Expand Up @@ -99,7 +103,7 @@ geomet_hydro_means <- function(station_number, start_date, end_date,

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_hydro_annuals
Expand Down Expand Up @@ -175,7 +179,7 @@ geomet_hydro_annuals <- function(station_number, start_date, end_date,

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_hydro_realtime
Expand Down Expand Up @@ -221,5 +225,5 @@ geomet_hydro_realtime <- function(station_number, query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}
10 changes: 7 additions & 3 deletions R/ltce.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#' @return \code{tibble} containing LTCE station metadata
#' @export
#' @examples
#' geomet_ltce_stns()
#' geomet_ltce_stns(
#' query = list(
#' "PROVINCE_CODE" = "ON"
#' )
#' )
#'
geomet_ltce_stns <- function(query) {
query_path <- "collections/ltce-stations/items"
Expand All @@ -25,7 +29,7 @@ geomet_ltce_stns <- function(query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}

#' geomet_ltce_data
Expand Down Expand Up @@ -87,5 +91,5 @@ geomet_ltce_data <- function(station_number, param, query) {

parsed_req <- geomet_api_paginate(req)

dplyr::select(parsed_req, -type)
dplyr::select(parsed_req, -"type")
}
151,526 changes: 0 additions & 151,526 deletions README.html

This file was deleted.

Loading

0 comments on commit 921fa17

Please sign in to comment.