Converts data from rolf format to an openair compatible Format
Source:R/openair.R
rolf_to_openair.Rd
openair::openair provides Tools for the analysis of air pollution data. rOstluft focus lies in providing data
from different sources to the user. The openair data format is described in openair::mydata. Basically it is a
wide format with a field "date" as POSIXct or Date and the parameters as columns. Another convention are the fields
"ws" for wind speed and "wd" for wind direction. Although usually the functions allows passing of the names from the
wind fields with the arguments wd and ws. One disadvantage of the wide format is the loss of unit information.
Normally all parameters are in expressed in mass terms. See openair::importKCL()
and openair::importAURN()
.
This functions saves the parameter <> unit information in the attribute "units". unfortunately attributes tend to be
lost by data wrangling functions. But an avid user might save the information.
Usage
rolf_to_openair(
data,
as_list = FALSE,
interval = NULL,
keep_ppb = FALSE,
keep_interval = FALSE,
ws = "WVv",
wd = "WD"
)
Arguments
- data
in rolf format
- as_list
optional, if TRUE returns a list a tibble for each parameter and keeps the unit information. Handy for applying functions with purrr.
- interval
optional filter for interval
- keep_ppb
usually volume concentrations are not used for analyses and are dropped with the exception of NOx. When FALSE drops parameters with ppb/ppm units except NOx. Default FALSE
- keep_interval
keep the "interval" column. Default FALSE
- ws
renames this parameter to "ws". Default "WVv". Set ws = NULL to disable renaming
- wd
renames this parameter to "wd". Default "WD". Set wd = NULL to disable renaming
Details
Some functions, for example openair::timeAverage, have the argument "type". This argument allows to specifiy columns as grouping columns. However, if type is not supplied grouping variables (character or factor) will be dropped. Most other functions need a mandatory assignment of the argument pollutant.
Examples
h1 <- system.file("extdata", "Zch_Stampfenbachstrasse_h1_2013_Jan.csv",
package = "rOstluft.data", mustWork = TRUE)
airmo_h1 <- read_airmo_csv(h1)
rolf_to_openair(airmo_h1)
#> # A tibble: 744 × 16
#> date site CO Hr NO NO2 NOx O3 p PM10
#> <dttm> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2013-01-01 00:00:00 Zch_Stam… 0.805 82.9 80.5 63.9 98.0 3.44 962. 184.
#> 2 2013-01-01 01:00:00 Zch_Stam… 0.833 83.0 78.4 61.6 95.1 3.07 962. 272.
#> 3 2013-01-01 02:00:00 Zch_Stam… 0.874 83.6 81.3 60.9 97.0 3.04 962. 226.
#> 4 2013-01-01 03:00:00 Zch_Stam… 0.755 84.7 62.3 56.7 79.6 2.78 962. 198.
#> 5 2013-01-01 04:00:00 Zch_Stam… 0.767 83.7 67.1 59.2 84.8 2.72 961. 179.
#> 6 2013-01-01 05:00:00 Zch_Stam… 0.566 82.7 11.8 46.9 34.0 5.36 961. 124.
#> 7 2013-01-01 06:00:00 Zch_Stam… 0.509 83.1 10.5 46.5 32.7 4.94 961. 78.7
#> 8 2013-01-01 07:00:00 Zch_Stam… 0.460 79.3 6.45 44.2 28.3 7.03 961. 65.1
#> 9 2013-01-01 08:00:00 Zch_Stam… 0.334 60.3 1.71 21.2 12.4 42.7 961. 41.2
#> 10 2013-01-01 09:00:00 Zch_Stam… 0.285 62.2 1.92 21.1 12.6 41.0 961. 22.8
#> # ℹ 734 more rows
#> # ℹ 6 more variables: RainDur <dbl>, SO2 <dbl>, StrGlo <dbl>, T <dbl>,
#> # wd <dbl>, ws <dbl>