Add values to a variable in a netCDF file, the main use is to combine different emissions like top-down emission (EmissV emissions) and inventary emission (sush as EDGAR, GAINS, RETRO, etc).

wrf_add(file = file.choose(), name = NA, POL)

Arguments

file

name of file interactively (default) or specified

name

name of the variable (any variable)

POL

variable to be written

Note

this function might be deprecated in future

Author

Daniel Schuch

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),mean = 5,sd = 1)
wrf_put(file = files[1], name = "E_CO", POL = CO)
# open, put some different numbers and write
CO[] = rnorm(length(CO),mean = 10,sd = 1)
wrf_add(file = files[1], name = "E_CO", POL = CO)
}
#> creating emission for domain 1 ...
#> output file: /tmp/Rtmp1IAn5y/EMISS/wrfchemi_d01_2011-08-01_00:00:00