Skip to content

Commit

Permalink
Merge pull request #140 from ropensci/dev
Browse files Browse the repository at this point in the history
v0.7.1
  • Loading branch information
steffilazerte authored Sep 20, 2023
2 parents cadb121 + 64ffd57 commit f90bb10
Show file tree
Hide file tree
Showing 117 changed files with 333 additions and 8,244 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: weathercan
Type: Package
Title: Download Weather Data from Environment and Climate Change Canada
Version: 0.7.0
Version: 0.7.1
Authors@R: c(
person("Steffi", "LaZerte", email = "sel@steffilazerte.ca", role = c("aut","cre"), comment = c(ORCID = "0000-0002-7690-8360")),
person("Sam", "Albers", email = "sam.albers@gmail.com", role = c("ctb"), comment = c(ORCID = "0000-0002-9270-7884")),
Expand Down Expand Up @@ -54,4 +54,4 @@ Suggests:
VignetteBuilder:
knitr
Encoding: UTF-8
Config/testthat/edition: 3
Config/testthat/edition: 3
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# weathercan 0.7.1
- `stations()` now uses the most recent version of the data even if it hasn't changed
(prevent message regarding age of stations data frame).
- Remove startup message about deprecated stations data frame
- Move Mapping Article from docs to website (https://steffilazerte.ca/posts/weathercan-mapping/)

# weathercan 0.7.0
- Internal updates to tests (testthat 3rd edition)
- Small changes to messages
Expand Down
11 changes: 8 additions & 3 deletions R/stations.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ stations_read <- function() {
if (file.exists(stations_file())) {
local_file <- stations_file() %>%
readr::read_rds()
if(pkg_file$meta$ECCC_modified < local_file$meta$ECCC_modified) return(local_file)
}
pkg_file
# If pkg version is newer than local, use pkg else use local
if(pkg_file$meta$ECCC_modified > local_file$meta$ECCC_modified) {
r <- pkg_file
} else {
r <- local_file
}
} else r <- pkg_file
r
}

stations_file <- function() {
Expand Down
8 changes: 0 additions & 8 deletions R/weathercan-pkg.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.onAttach <- function(libname, pkgname) {
packageStartupMessage(
"weathercan v", utils::packageVersion("weathercan"), "\n",
"The internal `stations` data has been ",
"deprecated in favour of the function `stations()`.\n",
"See ?stations for more details.")
}

#' Easy downloading of weather data from Environment and Climate Change Canada
#'
#' \code{weathercan} is an R package for simplifying the downloading of
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This package makes it easier to search for and download multiple months/years of

Bear in mind that these downloads can be fairly large and performing multiple downloads may use up ECCC's bandwidth unnecessarily. Try to stick to what you need.

For more details and tutorials checkout the [weathercan website](https://docs.ropensci.org/weathercan/)
For more details and tutorials checkout the [weathercan website](https://docs.ropensci.org/weathercan/) (or see the [development docs](http://ropensci.github.io/weathercan/))

> Check out the Demo weathercan shiny dashboard ([html](https://steffilazerte.shinyapps.io/weathercan_shiny/); [source](https://github.com/steffilazerte/weathercan_shiny))
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ multiple downloads may use up ECCC’s bandwidth unnecessarily. Try to
stick to what you need.

For more details and tutorials checkout the [weathercan
website](https://docs.ropensci.org/weathercan/)
website](https://docs.ropensci.org/weathercan/) (or see the [development
docs](http://ropensci.github.io/weathercan/))

> Check out the Demo weathercan shiny dashboard
> ([html](https://steffilazerte.shinyapps.io/weathercan_shiny/);
Expand Down Expand Up @@ -115,17 +116,12 @@ You can also search by proximity:
stations_search(coords = c(50.667492, -120.329049), dist = 20, interval = "hour")
```

## The legacy packages maptools, rgdal, and rgeos, underpinning this package
## will retire shortly. Please refer to R-spatial evolution reports on
## https://r-spatial.org/r/2023/05/15/evolution4.html for details.
## This package is now running under evolution status 0

## # A tibble: 3 × 17
## prov station_name station_id climate_id WMO_id TC_id lat lon elev tz interval start end normals normals_1981_2010 normals_1971_2000 distance
## <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <lgl> <lgl> <lgl> <dbl>
## 1 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/GMT+8 hour 1953 2013 TRUE TRUE TRUE 8.64
## 2 BC KAMLOOPS AUT 42203 1163842 71741 ZKA 50.7 -120. 345 Etc/GMT+8 hour 2006 2023 FALSE FALSE FALSE 8.64
## 3 BC KAMLOOPS A 51423 1163781 71887 YKA 50.7 -120. 345. Etc/GMT+8 hour 2013 2023 FALSE FALSE FALSE 9.28
## 1 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/GMT+8 hour 1953 2013 TRUE TRUE TRUE 8.61
## 2 BC KAMLOOPS AUT 42203 1163842 71741 ZKA 50.7 -120. 345 Etc/GMT+8 hour 2006 2023 FALSE FALSE FALSE 8.61
## 3 BC KAMLOOPS A 51423 1163781 71887 YKA 50.7 -120. 345. Etc/GMT+8 hour 2013 2023 FALSE FALSE FALSE 9.26

You can update this list of stations with

Expand All @@ -152,7 +148,7 @@ stations_meta()
## [1] "2023-01-24 23:30:00 UTC"
##
## $weathercan_modified
## [1] "2023-07-21"
## [1] "2023-09-20"

**Note:** For reproducibility, if you are using the stations list to
gather your data, it can be a good idea to take note of the ECCC date of
Expand Down
6 changes: 5 additions & 1 deletion data-raw/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ h <- paste0("https://www.canada.ca/en/environment-climate-change/services/",
"technical-documentation-climate-normals.html") %>%
xml2::read_html()

glossary_normals <- tibble(ECCC_name = html_nodes(h, "h3") %>% html_text(),

ECCC_name <- html_nodes(h, "h3") %>% html_text() %>%
str_subset("(Environment and Climate Change Canada)|(Government of Canada)", negate = TRUE)

glossary_normals <- tibble(ECCC_name,
description = html_nodes(h, "h3+p") %>% html_text()) %>%
filter(!str_detect(ECCC_name, "Thank you")) %>%
mutate(weathercan_name =
Expand Down
Binary file modified data/codes.rda
Binary file not shown.
Binary file modified data/flags.rda
Binary file not shown.
Binary file modified data/glossary.rda
Binary file not shown.
Binary file modified data/glossary_normals.rda
Binary file not shown.
Binary file modified data/kamloops.rda
Binary file not shown.
Binary file modified inst/extdata/stations.rds
Binary file not shown.
60 changes: 0 additions & 60 deletions pkgdown/extra.css

This file was deleted.

30 changes: 16 additions & 14 deletions release_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ devtools::build_readme()
# Check/update URLS
urlchecker::url_check()

# Precompile Vignettes
source("vignettes/precompile.R")


## Checks

# Precompile Vignettes
source("vignettes/precompile.R")

# Run WITH and WITHOUT internet
#devtools::run_examples(run_donttest = TRUE)
Expand All @@ -53,6 +53,20 @@ devtools::check(remote = TRUE, manual = TRUE, run_dont_test = TRUE,
devtools::check(remote = TRUE, manual = TRUE, run_dont_test = TRUE)


## Update codemeta
codemetar::write_codemeta()

## Build site (so website uses newest version)
## Update website
## BUILD PACKAGE FIRST!
#pkgdown::build_articles(lazy = TRUE)
# pkgdown::build_home()
# pkgdown::build_news()
# pkgdown::build_reference()
#pkgdown::build_articles(lazy = FALSE)

pkgdown::build_site(lazy = FALSE)

## Once it is released create signed release on github
usethis::use_github_release()

Expand Down Expand Up @@ -125,19 +139,7 @@ rhub::check_for_cran(path = paste0("../weathercan_", version, ".tar.gz"),
# Update cran-comments


## Update codemeta
codemetar::write_codemeta()

## Build site (so website uses newest version)
## Update website
## BUILD PACKAGE FIRST!
#pkgdown::build_articles(lazy = TRUE)
# pkgdown::build_home()
# pkgdown::build_news()
# pkgdown::build_reference()
#pkgdown::build_articles(lazy = FALSE)

pkgdown::build_site(lazy = TRUE)


## Push to github
Expand Down
Loading

0 comments on commit f90bb10

Please sign in to comment.