Create a NetCDF file from a inventory output or add new variables to an existing file

saveInventory(gi, filename = NA, dates, variable, unit = NA, mw = 1,
  time_unit = "year", COMPRESS = NA, force_ncdf4 = F, verbose = T)

Arguments

gi

a sf output from griding (or stacker)

filename

name of the file

dates

date(s) for the data

variable

name(s) of the pollutant(s) to write

unit

inventory unit

mw

molecular weight

time_unit

time unit, default is "year"

COMPRESS

compression level from 1 to 9, or NA for no compression

force_ncdf4

force NetCDF4 format

verbose

display additional information

Examples

grinded_so2 <- readRDS(paste0(system.file("extdata",package="inventory"),"/grid_so2.Rds")) dir.create(file.path(tempdir(), "INV")) saveInventory(grinded_so2,filename = paste0(file.path(tempdir(), "INV"),"test.nc"), variable = "so2", dates = '2010-01-01')
#> creating C:\Users\Schuch\AppData\Local\Temp\RtmpEPlZvv/INVtest.nc #> #> File C:\Users\Schuch\AppData\Local\Temp\RtmpEPlZvv/INVtest.nc (NC_FORMAT_CLASSIC): #> #> 2 variables (excluding dimension variables): #> integer date[time] #> units: days since 1850-01-01 00:00 #> float so2[lon,lat,time] #> units: t km-2 year-1 #> long_name: so2 emissions #> standard_name: tendency_of_atmosphere_mass_of_so2 #> molecular_weight: 1 #> molecular_weight_units: g mole-1 #> #> 3 dimensions: #> time Size:1 *** is unlimited *** #> units: days since 1850-01-01 00:00 #> long_name: time #> calendar: gregorian #> standard_name: time #> lon Size:72 #> units: degrees_east #> long_name: longitude #> standard_name: longitude #> comment: center_of_cell #> lat Size:36 #> units: degrees_north #> long_name: latitude #> standard_name: latitude #> comment: center_of_cell #> #> 9 global attributes: #> Title: Emissions #> Author: Schuch #> Creation: created on 2018-11-22 at 16:12 using the R-package inventory 0.4.0 #> Description: add description #> Reference: add reference #> institution: add institution #> projection: latlon #> Conventions: CF-1.0 #> source: no source provided #> #> file: C:\Users\Schuch\AppData\Local\Temp\RtmpEPlZvv/INVtest.nc written successfully! #> writing so2 #> done!