tests/testthat/test-wrf_create.R

context("wrf_create")

dir.create(file.path(tempdir(), "EMISS"))
wrf_create(wrfinput_dir          = system.file("extdata", package = "eixport"),
            wrfchemi_dir         = file.path(tempdir(), "EMISS"),
            domains              = 2,
            frames_per_auxinput5 = 1,
            n_aero               = 2,
            variables            = "ecbmz_mosaic",
            verbose              = TRUE)

f1 <- dir(path = file.path(tempdir(), "EMISS"),
          pattern = "wrfchemi_d02", full.names = T)

f2 <- unzip(zipfile = paste0(system.file("extdata", package = "eixport"),
                             "/wrfchemi_d02_2011-08-02.zip"),
            exdir = file.path(tempdir()))

nc1 <- ncdf4::nc_open(f1)
nc2 <- ncdf4::nc_open(f2)

test_that("wrf_create works", {
  expect_equal(nc1$nvars,
               nc2$nvars
  )
})

Try the eixport package in your browser

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

eixport documentation built on Oct. 4, 2023, 9:13 a.m.