SwissMetNet, the automatic monitoring network of MeteoSwiss the Federal Office for Meteorology and Climatology, comprises about 160 automatic monitoring stations. These stations deliver a multitude of current data on the weather and climate in Switzerland every ten minutes. The monitoring network is supplemented by automatic precipitation stations.
This Function autodetects the delimeter and tries to find the interval. In Addition the time information in the files is utc and end time. The time is converted to start time and the time zone defined trough the argument tz. The argument time_shift provides a way to manuelly shift the time series. In this case no automatically shifting is applied. The provided values is directly added to information in the file.
Usage
read_smn(
  fn,
  tz = "Etc/GMT-1",
  encoding = "UTF-8",
  time_shift = NULL,
  time_format = NULL,
  interval = NULL,
  na.rm = TRUE
)Arguments
- fn
 path to input file
- tz
 of the output data. Default "Etc/GMT-1"
- encoding
 encoding of the data file. Default = "UTF-8"
- time_shift
 a lubridate period to add to the time. Default NULL
- time_format
 optional time_format. Use if auto detect fails. Default NULL
- interval
 optional interval of the data. Use if auto detect fails. Default NULL. If used it is necessary to define time_shift manuelly. lubridate::period(0) can be used for no shifting
- na.rm
 remove na values. Default TRUE
Examples
input <- system.file("extdata", "smn.txt", package = "rOstluft.data", mustWork = TRUE)
read_smn(input)
#> # A tibble: 54 × 6
#>    starttime           site  parameter interval unit  value
#>    <dttm>              <fct> <fct>     <fct>    <fct> <dbl>
#>  1 2018-01-01 00:50:00 CHU   dkl010z0  min10    NA    216  
#>  2 2018-01-01 01:00:00 CHU   dkl010z0  min10    NA    209  
#>  3 2018-01-01 01:10:00 CHU   dkl010z0  min10    NA    216  
#>  4 2018-01-01 01:20:00 CHU   dkl010z0  min10    NA    227  
#>  5 2018-01-01 01:30:00 CHU   dkl010z0  min10    NA    212  
#>  6 2018-01-01 01:40:00 CHU   dkl010z0  min10    NA    200  
#>  7 2018-01-01 00:50:00 CHU   fkl010z0  min10    NA      1.7
#>  8 2018-01-01 01:00:00 CHU   fkl010z0  min10    NA      1.9
#>  9 2018-01-01 01:10:00 CHU   fkl010z0  min10    NA      2  
#> 10 2018-01-01 01:20:00 CHU   fkl010z0  min10    NA      2.6
#> # ℹ 44 more rows
