Learn R Programming

eixport (version 0.3.0)

wrf_get: Function to read variables of emission files

Description

Read a variable

Usage

wrf_get(file = file.choose(), name = NA, as_raster = F,
  raster_crs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")

Arguments

file

name of file interactively (default) or specified

name

name of the variable (any variable)

as_raster

return a raster instead of a array

raster_crs

crs to used if as_raster is TRUE

Format

array or raster object

See Also

wrf_plot and wrf_put

Examples

Run this code
# NOT RUN {
{

# 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)
}
# }

Run the code above in your browser using DataLab