From 63cfad4d4c6698ae938dc1938a543dc98ddb5a0f Mon Sep 17 00:00:00 2001 From: masalmon Date: Fri, 9 Sep 2016 12:05:49 +0200 Subject: [PATCH] updates vignette --- .gitignore | 1 - inst/doc/riem_package.R | 28 ++++++ inst/doc/riem_package.Rmd | 109 ++++++++++++++++++++++ inst/doc/riem_package.html | 181 +++++++++++++++++++++++++++++++++++++ vignettes/riem_package.Rmd | 3 + 5 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 inst/doc/riem_package.R create mode 100644 inst/doc/riem_package.Rmd create mode 100644 inst/doc/riem_package.html diff --git a/.gitignore b/.gitignore index c833a2c..5b6a065 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ .Rhistory .RData .Ruserdata -inst/doc diff --git a/inst/doc/riem_package.R b/inst/doc/riem_package.R new file mode 100644 index 0000000..99138fb --- /dev/null +++ b/inst/doc/riem_package.R @@ -0,0 +1,28 @@ +## ---- echo = FALSE------------------------------------------------------- +NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true") +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + purl = NOT_CRAN, + eval = NOT_CRAN +) + +## ----eval = FALSE-------------------------------------------------------- +# install.packages("riem") + +## ---- eval = FALSE------------------------------------------------------- +# library("devtools") +# install_github("ropenscilabs/riem") +# + +## ---- warning = FALSE, message = FALSE----------------------------------- +library("riem") +riem_networks() + +## ------------------------------------------------------------------------ +riem_stations(network = "IN__ASOS") + +## ------------------------------------------------------------------------ +measures <- riem_measures(station = "VOHY", date_start = "2000-01-01", date_end = "2016-04-22") +head(measures) + diff --git a/inst/doc/riem_package.Rmd b/inst/doc/riem_package.Rmd new file mode 100644 index 0000000..e375d06 --- /dev/null +++ b/inst/doc/riem_package.Rmd @@ -0,0 +1,109 @@ +--- +title: "R package riem" +author: "M. Salmon" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{riem intro} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, echo = FALSE} +NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true") +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + purl = NOT_CRAN, + eval = NOT_CRAN +) +``` + +This package allows to get weather data from ASOS stations (airports) via the awesome website of the [Iowa Environment Mesonet](https://mesonet.agron.iastate.edu/request/download.phtml?network=IN__ASOS). + + +# Installation + +Install the package with: + +```{r eval = FALSE} +install.packages("riem") +``` + +Or install the development version using [devtools](https://github.com/hadley/devtools) with: + +```{r, eval = FALSE} +library("devtools") +install_github("ropenscilabs/riem") + +``` + +# Get available networks + +```{r, warning = FALSE, message = FALSE} +library("riem") +riem_networks() +``` + +# Get available stations for one network + +```{r} +riem_stations(network = "IN__ASOS") +``` + + +# Get measures for one station + +Possible variables are (copied from [here](https://mesonet.agron.iastate.edu/request/download.phtml), see also the [ASOS user guide](http://www.nws.noaa.gov/asos/pdfs/aum-toc.pdf)) + +* station: three or four character site identifier + +* valid: timestamp of the observation (UTC) + +* tmpf: Air Temperature in Fahrenheit, typically @ 2 meters + +* dwpf: Dew Point Temperature in Fahrenheit, typically @ 2 meters + +* relh: Relative Humidity in \% + +* drct: Wind Direction in degrees from north + +* sknt: Wind Speed in knots + +* p01i: One hour precipitation for the period from the observation time to the time of the previous hourly precipitation reset. This varies slightly by site. Values are in inches. This value may or may not contain frozen precipitation melted by some device on the sensor or estimated by some other means. Unfortunately, we do not know of an authoritative database denoting which station has which sensor. + +* alti: Pressure altimeter in inches + +* mslp: Sea Level Pressure in millibar + +* vsby: Visibility in miles + +* gust: Wind Gust in knots + +* skyc1: Sky Level 1 Coverage + +* skyc2: Sky Level 2 Coverage + +* skyc3: Sky Level 3 Coverage + +* skyc4: Sky Level 4 Coverage + +* skyl1: Sky Level 1 Altitude in feet + +* skyl2: Sky Level 2 Altitude in feet + +* skyl3: Sky Level 3 Altitude in feet + +* skyl4: Sky Level 4 Altitude in feet + +* presentwx: Present Weather Codes (space seperated), see e.g. [this manual](http://www.ofcm.gov/fmh-1/pdf/H-CH8.pdf) for further explanations. + +* metar: unprocessed reported observation in METAR format + +```{r} +measures <- riem_measures(station = "VOHY", date_start = "2000-01-01", date_end = "2016-04-22") +head(measures) +``` + +For conversion of wind speed or temperature into other units, see [this package](https://github.com/geanders/weathermetrics/). + diff --git a/inst/doc/riem_package.html b/inst/doc/riem_package.html new file mode 100644 index 0000000..0ae6524 --- /dev/null +++ b/inst/doc/riem_package.html @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + +R package riem + + + + + + + + + + + + + + + + + +

R package riem

+

M. Salmon

+

2016-09-09

+ + + +

This package allows to get weather data from ASOS stations (airports) via the awesome website of the Iowa Environment Mesonet.

+
+

Installation

+

Install the package with:

+
install.packages("riem")
+

Or install the development version using devtools with:

+
library("devtools")
+install_github("ropenscilabs/riem")
+
+
+

Get available networks

+
library("riem")
+riem_networks() 
+#> # A tibble: 266 × 2
+#>        code                      name
+#>       <chr>                     <chr>
+#> 1  AE__ASOS United Arab Emirates ASOS
+#> 2  AF__ASOS          Afghanistan ASOS
+#> 3  AG__ASOS  Antigua and Barbuda ASOS
+#> 4  AI__ASOS             Anguilla ASOS
+#> 5   AK_ASOS               Alaska ASOS
+#> 6   AL_ASOS              Alabama ASOS
+#> 7  AL__ASOS              Albania ASOS
+#> 8  AM__ASOS              Armenia ASOS
+#> 9  AN__ASOS Netherlands Antilles ASOS
+#> 10 AO__ASOS               Angola ASOS
+#> # ... with 256 more rows
+
+
+

Get available stations for one network

+
riem_stations(network = "IN__ASOS") 
+#> # A tibble: 117 × 4
+#>       id                   name      lon      lat
+#>    <chr>                  <chr>    <dbl>    <dbl>
+#> 1   VEAT       AGARTALA         91.24045 23.88698
+#> 2   VIAG       AGRA (IN-AFB)    77.96089 27.15583
+#> 3   VAAH       AHMADABAD        72.63465 23.07724
+#> 4   VAAK       AKOLA AIRPORT    77.05863 20.69901
+#> 5   VIAH       ALIGARH          78.06667 27.88333
+#> 6   VIAL       ALLAHABAD (IN-AF 81.73387 25.44006
+#> 7   VIAR       AMRITSAR         74.86667 31.63333
+#> 8   VAOR                Arkonam 79.69120 13.07120
+#> 9   VOAR                Arkonam 79.69120 13.07120
+#> 10  VAAU Aurangabad Chikalthan  75.39810 19.86270
+#> # ... with 107 more rows
+
+
+

Get measures for one station

+

Possible variables are (copied from here, see also the ASOS user guide)

+ +
measures <- riem_measures(station = "VOHY", date_start = "2000-01-01", date_end = "2016-04-22") 
+head(measures)
+#> # A tibble: 6 × 24
+#>   station               valid     lon     lat  tmpf  dwpf  relh  drct
+#>     <chr>              <dttm>   <dbl>   <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1    VOHY 2011-08-23 00:40:00 78.4676 17.4531  73.4  69.8 88.51     0
+#> 2    VOHY 2011-08-23 01:40:00 78.4676 17.4531  73.4  69.8 88.51     0
+#> 3    VOHY 2011-08-23 05:10:00 78.4676 17.4531  82.4  68.0 61.81   270
+#> 4    VOHY 2011-08-23 05:40:00 78.4676 17.4531  84.2  66.2 54.80   270
+#> 5    VOHY 2011-08-23 06:40:00 78.4676 17.4531  84.2  68.0 58.32   260
+#> 6    VOHY 2011-08-23 07:40:00 78.4676 17.4531  84.2  66.2 54.80   250
+#> # ... with 16 more variables: sknt <dbl>, p01i <dbl>, alti <dbl>,
+#> #   mslp <lgl>, vsby <dbl>, gust <dbl>, skyc1 <chr>, skyc2 <chr>,
+#> #   skyc3 <chr>, skyc4 <chr>, skyl1 <dbl>, skyl2 <dbl>, skyl3 <dbl>,
+#> #   skyl4 <dbl>, presentwx <chr>, metar <chr>
+

For conversion of wind speed or temperature into other units, see this package.

+
+ + + + + + + + diff --git a/vignettes/riem_package.Rmd b/vignettes/riem_package.Rmd index c6d849c..e375d06 100644 --- a/vignettes/riem_package.Rmd +++ b/vignettes/riem_package.Rmd @@ -8,6 +8,8 @@ vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- + +```{r, echo = FALSE} NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true") knitr::opts_chunk$set( collapse = TRUE, @@ -15,6 +17,7 @@ knitr::opts_chunk$set( purl = NOT_CRAN, eval = NOT_CRAN ) +``` This package allows to get weather data from ASOS stations (airports) via the awesome website of the [Iowa Environment Mesonet](https://mesonet.agron.iastate.edu/request/download.phtml?network=IN__ASOS).