A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

canadaHCD

Access Canadian Historical Climate Data from R.
https://github.com/gavinsimpson/canadaHCD

Category: Climate Change
Sub Category: Climate Data Access and Visualization

Last synced: about 11 hours ago
JSON representation

Repository metadata

Access Canadian Historical Climate Data from R

README.Rmd

          ```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", cache = FALSE)
options(tibble.width = 120)
```
# canadaHCD


[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![R build status](https://github.com/gavinsimpson/canadaHCD/workflows/R-CMD-check/badge.svg)](https://github.com/gavinsimpson/canadaHCD/actions)
[![codecov](https://codecov.io/gh/gavinsimpson/canadaHCD/branch/main/graph/badge.svg?token=vDjUqs13Fb)](https://app.codecov.io/gh/gavinsimpson/canadaHCD)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/canadaHCD)](https://cran.r-project.org/package=canadaHCD)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/canadaHCD)](https://cran.r-project.org/package=canadHCD)


Access Canadian Historical Climate Data from R. The Government of Canada's
Historical Climate Data [website](http://climate.weather.gc.ca/index_e.html)
provides access to hourly, daily, and monthly weather records for stations
throughout Canada.

These are raw data that have undergone some quality control, but issues such
as changes in station location are unmanged; the data for the original
`stationID` stops at a certain point and a new `stationID` continues recording.
For a more curated data set for climate change research at broad spatial and
temporal scales see the [Adjusted and Homogenized Canadian Climate Data (AHCCD)](http://ec.gc.ca/dccha-ahccd/default.asp?lang=En&n=B1F8423A-1).

## Installation

*canadaHCD* is still under active development towards a 0.1 release. In the
meantime, if you wish to use the package, please install it from this github
repo, which is most easily achieved using Hadley Wickham's *remotes* package:

```{r, eval = FALSE}
## install.packages("devtools")
remotes::install_github("gavinsimpson/canadaHCD")
```

## Usage

Say I'm interested in climate data for stations in Yellowknife, I can search
for all known `stationID`s with `"Yellowknife"` in their name using
`find_station()`

```{r find-station}
library("canadaHCD")
find_station("Yellowknife")
```

To download the monthly HCD from `YELLOWKNIFE HYDRO` I can use `hcd_monthly()`,
providing it with the `StationID` for that particular weather station

```{r download-monthly, results = "hide"}
yh <- hcd_monthly(1707)
```

The data are returned as a [*tibble*](https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html)
(a `tbl_df`), which shows a compact version of the data frame.

```{r show-data}
yh
```

You should be able to work with these objects mostly as if they were data frames.

Allthough not yet exposed through any functions in the package, you can
access a snapshot of the station metadata via the `canadaHCD:::station_data`
data frame.

```{r station-data}
canadaHCD:::station_data
```

If we wanted to know which resolutions of data were available for the
`YELLOWKNIFE HYDRO` station, we can extract certain columns from the station
data object

```{r extract-station_data, tidy = TRUE, tidy.opts=list(blank=FALSE, width.cutoff=80)}
id <- grep("YELLOWKNIFE HYDRO", canadaHCD:::station_data$Name)
vars <- c("HourlyFirstYr", "HourlyLastYr", "DailyFirstYr", "DailyLastYr",
    "MonthlyFirstYr", "MonthlyLastYr")
canadaHCD:::station_data[id, vars]
```

The output shows that this station has no hourly data, but daily and monthly
data sets exist.

        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 151
Total Committers: 2
Avg Commits per committer: 75.5
Development Distribution Score (DDS): 0.099

Commits in past year: 40
Committers in past year: 1
Avg Commits per committer in past year: 40.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Gavin Simpson u****s@g****m 136
Conor Anderson c****r@c****a 15

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 17
Total pull requests: 12
Average time to close issues: about 1 year
Average time to close pull requests: 3 months
Total issue authors: 4
Total pull request authors: 1
Average comments per issue: 1.82
Average comments per pull request: 1.92
Merged pull request: 6
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/gavinsimpson/canadaHCD

Top Issue Authors

  • gavinsimpson (7)
  • ConorIA (5)
  • BastienFR (3)
  • dankelley (2)

Top Pull Request Authors

  • ConorIA (12)

Top Issue Labels

  • bug (10)
  • enhancement (6)

Top Pull Request Labels


Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
  • r-lib/actions/setup-tinytex v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/readme-renderer.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 4.1 depends
  • curl * imports
  • dplyr * imports
  • lubridate * imports
  • lutz * imports
  • readr * imports
  • sf * imports
  • tibble * imports
  • tidyr * imports
  • tidyselect * imports
  • tools * imports
  • utils * imports
  • zoo * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests

Score: 3.258096538021482