stationaRy
Get hourly meteorological data from one of thousands of global stations.
https://github.com/rich-iannone/stationaRy
Category: Atmosphere
Sub Category: Meteorological Observation and Forecast
Keywords
dataset global met-data r
Last synced: about 6 hours ago
JSON representation
Repository metadata
Get hourly meteorological data from one of thousands of global stations
- Host: GitHub
- URL: https://github.com/rich-iannone/stationaRy
- Owner: rich-iannone
- License: other
- Created: 2013-11-21T02:06:45.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2021-07-07T01:54:28.000Z (almost 4 years ago)
- Last Synced: 2025-04-25T12:04:56.887Z (5 days ago)
- Topics: dataset, global, met-data, r
- Language: R
- Homepage: http://rich-iannone.github.io/stationaRy/
- Size: 37.6 MB
- Stars: 249
- Watchers: 16
- Forks: 32
- Open Issues: 4
- Releases: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
README.Rmd
--- output: github_document --- ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) ``` ```{r packages, message=FALSE, warning=FALSE, include=FALSE} library(stationaRy) library(tidyverse) library(lubridate) ``` # stationaRy[](https://CRAN.R-project.org/package=stationaRy) [](https://github.com/rich-iannone/stationaRy/actions) [](https://codecov.io/gh/rich-iannone/stationaRy?branch=master) ## Overview Get meteorological data from met stations located all over the world. That's what you can do with this **R** package. There are *LOTS* of stations too (29,729 available in this dataset) and many have data that go pretty far back in time. The data comes from the Integrated Surface Dataset (ISD), which is maintained by the National Oceanic and Atmospheric Administration (NOAA). ### Retrieving Met Data with a `station_id` Let's get some met data from La Guardia Airport in New York City (the station ID value is `"725030-14732"`). This station has a pretty long history (starting operations in 1973) but we'll just obtain data from the years of 2017 and 2018. ```{r get_met_data, echo=TRUE, results="hide"} lga_met_data <- get_met_data( station_id = "725030-14732", years = 2017:2018 ) ``` ```{r lga_met_data} lga_met_data ``` ### Discovering Met Stations At a minimum we need a station's identifier to obtain its met data. We can start the process of getting an identifier by accessing the entire catalog of station metadata with the `get_station_metadata()` function. The output tibble has station `id` values in the first column. Let's get a subset of stations from that: those stations that are located in Norway. ```{r stations_norway} stations_norway <- get_station_metadata() %>% dplyr::filter(country == "NO") stations_norway ``` This table can be even more greatly reduced to isolate the stations of interest. For example, we could elect to get only high-altitude stations (above 1000 meters) in Norway. ```{r norway_high_elev} norway_high_elev <- stations_norway %>% dplyr::filter(elev > 1000) norway_high_elev ``` The station IDs from the tibble can be transformed into a vector of station IDs with `dplyr::pull()`. ```{r norway_high_elev_ids} norway_high_elev %>% dplyr::pull(id) ``` Suppose you'd like to collect several years of met data from a particular station and fetch only the observations that meet some set of conditions. Here's an example of obtaining temperatures above 15 degrees Celsius from the high-altitude `"JUVVASSHOE"` station in Norway and adding a column with temperatures in degrees Fahrenheit. ```{r echo=TRUE, results="hide"} station_data <- get_station_metadata() %>% dplyr::filter(name == "JUVVASSHOE") %>% dplyr::pull(id) %>% get_met_data(years = 2011:2019) high_temp_data <- station_data %>% dplyr::select(id, time, wd, ws, temp) %>% dplyr::filter(temp > 16) %>% dplyr::mutate(temp_f = ((temp * (9/5)) + 32) %>% round(1)) %>% dplyr::arrange(dplyr::desc(temp_f)) ``` ```{r high_temp_data} high_temp_data ``` ### Additional Data Fields There can be a substantial amount of additional met data beyond wind speed, ambient temperature, etc. However, these additional fields can vary greatly across stations. The nomenclature for the additional categories of data uses 'two-letter + digit' identifiers (e.g., `AA1`, `GA1`, etc.). Within each category are numerous fields, where the variables are coded as `[identifer]_[index]`). More information about these additional data fields can be found in [this PDF document](http://www1.ncdc.noaa.gov/pub/data/ish/ish-format-document.pdf). To find out which categories of additional data fields are available for a station, we can use the `station_coverage()` function. You'll get a tibble with the available additional categories and their counts over the specified period. ```{r echo=TRUE, results="hide"} additional_data_fields <- get_station_metadata() %>% dplyr::filter(name == "JUVVASSHOE") %>% dplyr::pull(id) %>% station_coverage(years = 2015) ``` ```{r additional_data_fields} additional_data_fields ``` We can use **purrr**'s `map_df()` function to get additional data field coverage for a subset of stations (those that are near sea level and have data in 2019). With the `station_coverage()` function set to output tibbles in `wide` mode (one row per station, field categories as columns, and counts of observations as values), we can ascertain which stations have the particular fields we need. ```{r many_stations_fields, echo=TRUE, results="hide"} stns <- get_station_metadata() %>% dplyr::filter(country == "NO", elev <= 5 & end_year == 2019) coverage_tbl <- purrr::map_df( seq(nrow(stns)), function(x) { stns %>% dplyr::pull(id) %>% .[[x]] %>% station_coverage( years = 2019, wide_tbl = TRUE ) } ) ``` ```{r coverage_tbl} coverage_tbl ``` For the `"KAWAIHAE"` station in Hawaii, some interesting data fields are available. In particular, its `SA1` category provides sea surface temperature data, where the `sa1_1` and `sa1_2` variables represent the sea surface temperature and its quality code. Combining the use of `get_met_data()` with functions from **dplyr**, we can create a table of the mean ambient and sea-surface temperatures by month. The additional data is included in the met data table by using the `add_fields` argument and specifying the `"SA1"` category (multiple categories can be included). ```{r sa1_field, echo=TRUE, results="hide"} kawaihae_sst <- get_met_data( station_id = "997173-99999", years = 2017:2018, add_fields = "SA1" ) %>% dplyr::mutate( year = lubridate::year(time), month = lubridate::month(time) ) %>% dplyr::filter(sa1_2 == 1) %>% dplyr::group_by(year, month) %>% dplyr::summarize( avg_temp = mean(temp, na.rm = TRUE), avg_sst = mean(sa1_1, na.rm = TRUE) ) ``` ```{r kawaihae_sst} kawaihae_sst ``` ## Installation The **stationaRy** package can be easily installed from CRAN. ```{r install_cran, eval=FALSE} install.packages("stationaRy") ``` To install the development version of **stationaRy**, use the following: ```{r install_github, eval=FALSE} install.packages("devtools") remotes::install_github("rich-iannone/stationaRy") ``` If you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an [issue](https://github.com/rich-iannone/stationaRy/issues). ## License MIT © Richard Iannone
Owner metadata
- Name: Richard Iannone
- Login: rich-iannone
- Email:
- Kind: user
- Description: I enjoy creating useful things for data analysis, transformation, and visualization. It's super fun too! ₍⸍⸌̣ʷ̣̫⸍̣⸌₎
- Website:
- Location: Toronto, Canada
- Twitter: riannone
- Company: @posit-dev
- Icon url: https://avatars.githubusercontent.com/u/5612024?u=9a0fe49a5f3648af258b2871ded57e281c44c695&v=4
- Repositories: 48
- Last ynced at: 2024-06-11T15:37:35.133Z
- Profile URL: https://github.com/rich-iannone
GitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers metadata
Last synced: 9 days ago
Total Commits: 901
Total Committers: 4
Avg Commits per committer: 225.25
Development Distribution Score (DDS): 0.004
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
Name | Commits | |
---|---|---|
rich-iannone | r****e@m****m | 897 |
Hadley Wickham | h****m@g****m | 2 |
nutterb | b****r@g****m | 1 |
paulponcet | p****t@y****r | 1 |
Committer domains:
- me.com: 1
Issue and Pull Request metadata
Last synced: about 6 hours ago
Total issues: 26
Total pull requests: 4
Average time to close issues: 5 months
Average time to close pull requests: about 2 hours
Total issue authors: 18
Total pull request authors: 3
Average comments per issue: 2.46
Average comments per pull request: 1.25
Merged pull request: 4
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
Top Issue Authors
- pssguy (4)
- rich-iannone (3)
- salauer (2)
- hansthompson (2)
- nutterb (2)
- erikbrown83 (1)
- cebaraldi (1)
- sinclairjesse (1)
- ghost (1)
- grantmcdermott (1)
- MartaDiaz (1)
- hadley (1)
- ethanewe (1)
- jobonaf (1)
- richardsc (1)
Top Pull Request Authors
- hadley (2)
- nutterb (1)
- paulponcet (1)
Top Issue Labels
- Type: ⁇ Question (2)
- Difficulty: [2] Intermediate (1)
- Effort: [3] High (1)
- Priority: [3] High (1)
- Type: ✎ Docs (1)
Top Pull Request Labels
Package metadata
- Total packages: 1
-
Total downloads:
- cran: 230 last-month
- Total docker downloads: 41,971
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
cran.r-project.org: stationaRy
Detailed Meteorological Data from Stations All Over the World
- Homepage: https://github.com/rich-iannone/stationaRy
- Documentation: http://cran.r-project.org/web/packages/stationaRy/stationaRy.pdf
- Licenses: MIT + file LICENSE
- Latest release: 0.5.1 (published over 5 years ago)
- Last Synced: 2025-04-29T14:01:29.957Z (1 day ago)
- Versions: 6
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 230 Last month
- Docker Downloads: 41,971
-
Rankings:
- Stargazers count: 1.772%
- Forks count: 2.445%
- Average: 23.762%
- Dependent packages count: 29.797%
- Dependent repos count: 35.455%
- Downloads: 49.339%
- Maintainers (1)
Dependencies
- R >= 3.2.1 depends
- downloader >= 0.4 imports
- dplyr >= 0.8.3 imports
- lubridate >= 1.7.4 imports
- lutz >= 0.3.1 imports
- magrittr * imports
- progress >= 1.2.2 imports
- readr >= 1.3.1 imports
- stringr >= 1.4.0 imports
- tidyr >= 0.8.3 imports
- covr * suggests
- testthat * suggests
Score: 17.56997782626523