Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update v0.7.3 #157

Merged
merged 8 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
10 changes: 8 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
Package: weathercan
Type: Package
Title: Download Weather Data from Environment and Climate Change Canada
Version: 0.7.2
Version: 0.7.3
Authors@R: c(
person("Steffi", "LaZerte", email = "[email protected]", role = c("aut","cre"), comment = c(ORCID = "0000-0002-7690-8360")),
person("Sam", "Albers", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0002-9270-7884")),
person("Nick", "Brown", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0002-2719-0671")),
person("Kevin", "Cazelles", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0001-6619-9874")))
person("Kevin", "Cazelles", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0001-6619-9874")),
person("Richard", "Littauer", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0001-5428-7535")),
person("Shandiya", "Balasubramaniam", role = "ctb", comment = c(ORCID = "0000-0001-9928-9964")),
person("Mark", "Ciechanowski", role = "ctb", comment = c(ORCID = "0000-0002-3732-5939")),
person("Jeremy", "Selva", email = "[email protected]", role = "ctb", comment = c(ORCID = "0000-0002-4498-2662")),
person(c("Kelli", "F."), "Johnson", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0002-5149-451X"))
)
Description: Provides means for downloading historical weather data from
the Environment and Climate Change Canada website
(<https://climate.weather.gc.ca/historical_data/search_historic_data_e.html>).
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# weathercan (development version)
# weathercan 0.7.3
- Switch stations inventory list to new location
- Don't try to download future weather
- Better test coverage (#149; 🙏 thanks @shandiya, @mciechanumich!)
- Replaced superseded dplyr functions (#150; 🙏 thanks @JauntyJJS, @RichardLitt!)
- Fixed test coverage GitHub Action (🙏 thanks @kellijohnson-NOAA!)

# weathercan 0.7.2
- Fix normals to work with new ECCC data format
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 2 additions & 0 deletions R/weather.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ weather_dl <- function(station_ids,
msg.start <- "earliest date"
} else {
s.start <- as.Date(start)
if(s.start > Sys.Date()) s.start <- Sys.Date()
msg.start <- start
}

Expand Down Expand Up @@ -393,6 +394,7 @@ weather_dl <- function(station_ids,
}

weather_single <- function(date_range, s, interval, encoding) {

w <- dplyr::tibble(date_range = date_range)
w <- dplyr::mutate(w, html = purrr::map(.data$date_range,
~ weather_html(station_id = s,
Expand Down
26 changes: 15 additions & 11 deletions R/weathercan-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,21 @@ NULL
get_html <<- memoise::memoise(get_html, ~memoise::timeout(24 * 60 * 60))
normals_html <<- memoise::memoise(normals_html, ~memoise::timeout(24 * 60 * 60))

options(weathercan.urls.weather =
"https://climate.weather.gc.ca/climate_data/bulk_data_e.html",
weathercan.urls.normals =
"https://climate.weather.gc.ca/climate_normals/bulk_data_e.html",
# Download from google drive: https://stackoverflow.com/a/50533232/3362144
weathercan.urls.stations =
paste0("https://drive.google.com/uc?export=download&id=",
"1HDRnj41YBWpMioLPwAFiLlK4SK8NV72C"),
weathercan.urls.stations.normals =
"https://climate.weather.gc.ca/climate_normals/station_inventory_e.html",
weathercan.time.message = FALSE)
options(
weathercan.urls.weather =
"https://climate.weather.gc.ca/climate_data/bulk_data_e.html",
weathercan.urls.normals =
"https://climate.weather.gc.ca/climate_normals/bulk_data_e.html",
# Download from google drive: https://stackoverflow.com/a/50533232/3362144
weathercan.urls.stations =
paste0("https://collaboration.cmc.ec.gc.ca/cmc/climate/",
"Get_More_Data_Plus_de_donnees/Station%20Inventory%20EN.csv"),
#weathercan.urls.stations =
# paste0("https://drive.google.com/uc?export=download&id=",
# "1HDRnj41YBWpMioLPwAFiLlK4SK8NV72C"),
weathercan.urls.stations.normals =
"https://climate.weather.gc.ca/climate_normals/station_inventory_e.html",
weathercan.time.message = FALSE)

# CRAN Note avoidance
if(getRversion() >= "2.15.1")
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 data/kamloops_day.rda
Binary file not shown.
Binary file modified data/pg.rda
Binary file not shown.
Binary file modified inst/extdata/stations.rds
Binary file not shown.
5 changes: 5 additions & 0 deletions man/weathercan-package.Rd

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

1 change: 1 addition & 0 deletions release_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ usethis::use_github_release()
## Prep for next
usethis::pr_init("dev")
usethis::use_dev_version()
usethis::pr_push()


# Good practices --------------------
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test_00_onLoad.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test_that("URLS correctly set", {
expect_true(stringr::str_detect(w, "climate.weather.gc.ca"))

expect_type(w <- getOption("weathercan.urls.stations"), "character")
expect_true(stringr::str_detect(w, "drive.google.com"))
#expect_true(stringr::str_detect(w, "drive.google.com"))
expect_true(stringr::str_detect(w, "collaboration.cmc.ec.gc.ca"))

expect_type(w <- getOption("weathercan.urls.stations.normals"), "character")
expect_true(stringr::str_detect(w, "climate.weather.gc.ca"))
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test_03_station_dl.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ test_that("stations_dl() runs and updates data", {
expect_type(s$meta, "list") %>%
expect_length(2)

# Ensure that we're getting recent data
expect_equal(max(s$stn$end, na.rm = TRUE), lubridate::year(Sys.Date()))

# stations_read() ----

# Without local file, use package file
Expand Down
3 changes: 3 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.html
*.R
normals_cache
Loading