tests/testthat/testbasic.r

library(ncdump)
library(testthat)
context("Basic read")

ifile <- system.file("extdata", "S2008001.L3m_DAY_CHL_chlor_a_9km.nc", package = "ncdump")
con <- NetCDF(ifile)
test_that("File exists and can be read", {
  expect_true(file.exists(ifile))
  expect_that(con, is_a("NetCDF"))
  expect_that(vars(con), is_a("tbl_df"))
  expect_that(atts(con), is_a("tbl_df"))
  expect_that(dims(con), is_a("tbl_df"))
})


context("Differentiate attributes global and var-based")
test_that("get global attributes", {
  expect_that(atts(con), is_a("tbl_df"))
  ## something changed here, need to explore 
  #expect_that(atts(con, "chlor_a"), is_a("tbl_df"))
  expect_that(dimvars(con), is_a("tbl_df"))
})

Try the ncdump package in your browser

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

ncdump documentation built on May 2, 2019, 4:05 a.m.