tests/testthat/test.GHCN.R

library(FedData)
library(httr)
context("Global Historical Climatology Network tests")
skip_on_cran()

test_that("The GHCN inventory is available at the correct URL", {
  expect_false(suppressWarnings(httr::http_error("https://www.ncei.noaa.gov/pub/data/ghcn/daily/ghcnd-inventory.txt")))
  expect_true(suppressWarnings(httr::http_error("https://www.ncei.noaa.gov/pub/data/ghcn/daily/blah.txt")))
})

test_that("The GHCN daily weather stations are available at the correct URL", {
  expect_false(suppressWarnings(httr::http_error("https://www.ncei.noaa.gov/pub/data/ghcn/daily/all/USC00051886.dly")))
  expect_true(suppressWarnings(httr::http_error("https://www.ncei.noaa.gov/pub/data/ghcn/daily/all/xxxxxx.dly")))
})

closeAllConnections()

Try the FedData package in your browser

Any scripts or data that you put into this service are public.

FedData documentation built on Oct. 3, 2023, 9:07 a.m.