Skip to content

Repository files navigation

pik

Fetch 3-hourly meteorological observations from pogodaiklimat.ru (aka PiK).

Successor to the archived rp5pik package. Station-month pages are fetched politely, parsed into Observations, and stored in an on-disk Cache as nanoparquet.

Installation

# install.packages("pak")
pak::pak("atsyplenkov/pik")

Example

library(pik)

# Station Catalog (offline snapshot; refresh = TRUE re-scrapes PiK)
stations <- pik_stations()

# One-call front door: fetch missing Station-months, return Observations
pik_observations(
  wmo_id = "27524",
  start_date = "2022-05-01",
  end_date = "2022-05-31"
)
#> # A tibble: 248 × 11
#>    wmo_id datetime_utc           ta    td    rh    ps   psl  prec windd
#>    <chr>  <dttm>              <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
#>  1 27524  2022-05-01 00:00:00  -0.4  -5      71  998  1026.    NA   225
#>  2 27524  2022-05-01 03:00:00  -0.3  -5.1    70  998. 1026.    NA   225
#>  3 27524  2022-05-01 06:00:00   8.1  -5.7    37  998. 1025.    NA   225
#>  4 27524  2022-05-01 09:00:00  10.9  -6.4    29  997. 1024.    NA   225
#>  5 27524  2022-05-01 12:00:00  11.6  -6.7    27  995. 1022.    NA   270
#>  6 27524  2022-05-01 15:00:00  11.3  -6      29  994. 1020.    NA   270
#>  7 27524  2022-05-01 18:00:00   9.3  -4.2    38  994. 1021.    NA   225
#>  8 27524  2022-05-01 21:00:00   7.7  -3.2    46  993. 1020.    NA   180
#>  9 27524  2022-05-02 00:00:00   6.8  -2.3    52  993. 1020.    NA   180
#> 10 27524  2022-05-02 03:00:00   5.2  -0.2    68  993. 1020.    NA   225
#> # ℹ 238 more rows
#> # ℹ 2 more variables: winds_mean <dbl>, winds_max <dbl>

# Bulk prefetch with a Station-month job report
pik_fetch(
  wmo_id = "27524",
  start_date = "2022-05-01",
  end_date = "2022-05-31"
)

# Read Observations from Cache only
pik_read(
  wmo_id = "27524",
  start_date = "2022-05-01",
  end_date = "2022-05-31"
)

Cache root defaults to tools::R_user_dir("pik", "cache") and can be overridden with the cache_dir argument, the pik.cache_dir option, or the PIK_CACHE_DIR environment variable (pik_cache_dir() resolves the path).

pik_fetch() / pik_observations() use a small worker pool and a process-wide rate cap (default 30 requests per minute). Raising workers or rate may risk PiK IP blocks.

About

Fetch 3-hourly meteorological observations from pogodaiklimat.ru (PiK)

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages