wrf_get: Function to read variables of emission files

View source: R/wrf_get.R

wrf_getR Documentation

Function to read variables of emission files

Description

Read a variable

Usage

wrf_get(
  file = file.choose(),
  name = NA,
  as_raster = FALSE,
  raster_crs = "WRF",
  raster_lev = 1,
  k = NA,
  verbose = FALSE,
  ...
)

Arguments

file

name of file interactively (default) or specified

name

name of the variable (any variable) or time to return a POSIXlt object from model

as_raster

return a raster instead of an array

raster_crs

crs of outputif as_raster is TRUE, see details

raster_lev

level for rasters from a 4D variable

k

multiplier

verbose

display additional information

...

additional parameters passed to wrf_raster

Format

array or raster object

Details

wrf_get can return a raster object with the option as_raster = TRUE, raster_crs can be used to specify the output crs of the raster object, raster_crs = 'latlon' can be especifyed to use latlon option in wrf_raster. If raster_crs is 'WRF' (default), the output projection is equivalent to the WRF grid.

Author(s)

Daniel Schuch

See Also

wrf_plot and wrf_put

Examples

{

# create the folder and emission file
dir.create(file.path(tempdir(), "EMISS"))
wrf_create(wrfinput_dir = system.file("extdata", package = "eixport"),
         wrfchemi_dir = file.path(tempdir(), "EMISS"))

# get the name of created file
files <- list.files(path = file.path(tempdir(), "EMISS"),
                   pattern = "wrfchemi",
                   full.names = TRUE)

# open, put some numbers and write
CO <- wrf_get(file = files[1],
              name = "E_CO")

CO[] = rnorm(length(CO))

wrf_put(file = files[1],
        name = "E_CO",
        POL = CO)

COr <- wrf_get(file = files[1],
               name = "E_CO",
               as_raster = TRUE)

}

eixport documentation built on Sept. 30, 2024, 9:42 a.m.