diff --git a/.Rbuildignore b/.Rbuildignore index b48bace..03f5792 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -16,3 +16,6 @@ ^codecov\.yml$ ^.github inst/extdata/dmsp_hi-res.tiff +^_pkgdown\.yml$ +^pkgdown$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..c9f0165 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index adb1aa9..363f44e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .RData paper.pdf tests/testthat/Rplots.pdf +docs diff --git a/README.md b/README.md index c2ccb4b..86f8c2e 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1451027.svg)](https://doi.org/10.5281/zenodo.1451027) [![status](http://joss.theoj.org/papers/071d027997ac93d8992099cb5010a044/status.svg)](http://joss.theoj.org/papers/071d027997ac93d8992099cb5010a044) -![hex_logo](https://raw.githubusercontent.com/atmoschem/EmissV/master/hex_logo_true.png) - This package provides tools to create emissions (with a focus on vehicular emissions) for use in numeric air quality models such as [WRF-Chem](https://ruc.noaa.gov/wrf/wrf-chem/). ## Installation diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..8a97949 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://atmoschem.github.io/EmissV/ +template: + bootstrap: 5 + light-switch: true diff --git a/docs/404.html b/docs/404.html index 961f760..89e92b8 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,100 +4,86 @@ - + Page not found (404) • EmissV - - - - - - - + + + + + + + + + + + + - - - -
-
-
- +
+
+
Content not found. Please use links in the navbar. -
- - - +
- -
- - + diff --git a/docs/CONDUCT.html b/docs/CONDUCT.html index c272f5c..2e1d4c1 100644 --- a/docs/CONDUCT.html +++ b/docs/CONDUCT.html @@ -1,49 +1,40 @@ -Contributor Code of Conduct • EmissV - - -
-
-
- +
+
+
@@ -56,30 +47,22 @@

Contributor Code of Conduct

This Code of Conduct is adapted from the Contributor Covenant (http:contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/

-
+
- +
- - -
-
- - diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 40419dd..66b4dd1 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -1,49 +1,40 @@ -Contributing to EmissV • EmissV - - -
-
- +
-
- +
+
+
@@ -96,30 +87,22 @@

Code formatting

-
+
- +
-
- - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index d58a220..948154a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,79 +1,62 @@ -License • EmissV - - -
-
-
-
YEAR: 2018
 COPYRIGHT HOLDER: DANIEL ANDRADE SCHUCH
 
-
+
- +
- - -
-
- - diff --git a/docs/apple-touch-icon-120x120.png b/docs/apple-touch-icon-120x120.png new file mode 100644 index 0000000..e964a84 Binary files /dev/null and b/docs/apple-touch-icon-120x120.png differ diff --git a/docs/apple-touch-icon-180x180.png b/docs/apple-touch-icon-180x180.png new file mode 100644 index 0000000..99a094d Binary files /dev/null and b/docs/apple-touch-icon-180x180.png differ diff --git a/docs/apple-touch-icon-60x60.png b/docs/apple-touch-icon-60x60.png new file mode 100644 index 0000000..b3515a5 Binary files /dev/null and b/docs/apple-touch-icon-60x60.png differ diff --git a/docs/apple-touch-icon-76x76.png b/docs/apple-touch-icon-76x76.png new file mode 100644 index 0000000..a812e35 Binary files /dev/null and b/docs/apple-touch-icon-76x76.png differ diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png new file mode 100644 index 0000000..7fdf18d Binary files /dev/null and b/docs/apple-touch-icon.png differ diff --git a/docs/authors.html b/docs/authors.html index 0f233ed..3e5bc3c 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,53 +1,44 @@ -Authors and Citation • EmissV - - -
-
-
-
- - - +
+

Authors

+
  • Daniel Schuch. Author, maintainer.

    @@ -57,20 +48,17 @@

    Authors

-
-
-

Citation

- Source: inst/CITATION -
-
+
+

Citation

+

Source: inst/CITATION

-

Schuch D, Ibarra-Espinosa S, Dias de Freitas E (2018). +

Schuch D, Ibarra-Espinosa S, Dias de Freitas E (2018). “EmissV: An R package to create vehicular and other emissions by Top-down methods to air quality models.” The Journal of Open Source Software, 6. -doi: 10.21105/joss.00662, https://joss.theoj.org/papers/10.21105/joss.00662. +doi:10.21105/joss.00662, https://joss.theoj.org/papers/10.21105/joss.00662.

-
@Article{,
+      
@Article{,
   title = {{EmissV: An R package to create vehicular and other emissions by Top-down methods to air quality models}},
   author = {Daniel Schuch and Sergio Ibarra-Espinosa and Edmilson {Dias de Freitas}},
   year = {2018},
@@ -79,12 +67,12 @@ 

Citation

pages = {6}, doi = {10.21105/joss.00662}, }
-

Schuch D, Ibarra-Espinosa S, Dias de Freitas E, Andrade M (2018). +

Schuch D, Ibarra-Espinosa S, Dias de Freitas E, Andrade M (2018). “EmissV: A preprocessor for WRF-Chem model.” Journal of Atmospheric Science Research, 5. -doi: 10.30564/jasr.v1i1.347, https://journals.bilpubgroup.com/index.php/jasr/article/view/347. +doi:10.30564/jasr.v1i1.347, https://journals.bilpubgroup.com/index.php/jasr/article/view/347.

-
@Article{,
+      
@Article{,
   title = {{EmissV: A preprocessor for WRF-Chem model}},
   author = {Daniel Schuch and Sergio Ibarra-Espinosa and Edmilson {Dias de Freitas} and Maria Andrade},
   year = {2018},
@@ -93,35 +81,36 @@ 

Citation

pages = {5}, doi = {10.30564/jasr.v1i1.347}, }
-

Daniel Schuch and Sergio Ibarra-Espinosa (2023). EmissV: Tools for Create Emissions for Air Quality Models. R package version 0.665.6.6. https://atmoschem.github.io/EmissV/

-
@Manual{,
+      

Schuch D, Ibarra-Espinosa S (2023). +EmissV: Tools for Create Emissions for Air Quality Models. +R package version 0.665.6.7, https://atmoschem.github.io/EmissV/. +

+
@Manual{,
   title = {EmissV: Tools for Create Emissions for Air Quality Models},
   author = {Daniel Schuch and Sergio Ibarra-Espinosa},
   year = {2023},
-  note = {R package version 0.665.6.6},
+  note = {R package version 0.665.6.7},
   url = {https://atmoschem.github.io/EmissV/},
 }
+
-
- -
- +
-
+
+ - - diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png new file mode 100644 index 0000000..be21bf9 Binary files /dev/null and b/docs/favicon-16x16.png differ diff --git a/docs/favicon-32x32.png b/docs/favicon-32x32.png new file mode 100644 index 0000000..e70aaa7 Binary files /dev/null and b/docs/favicon-32x32.png differ diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000..90339a9 Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/index.html b/docs/index.html index c6e9b87..ce278c9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,84 +4,70 @@ - + Tools for Create Emissions for Air Quality Models • EmissV - - - - - - - - + + + + + + + + + + + + + + - - + + Skip to contents -
-
-
-
- +
+
+
+
+ -
-

hex_logo

-

This package provides tools to create emissions (with a focus on vehicular emissions) for use in numeric air quality models such as WRF-Chem.

Installation @@ -95,26 +81,26 @@

System dependenciesTo Ubuntu

The following steps are required for installation on Ubuntu:

-
  sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
-  sudo apt-get --yes --force-yes update -qq
-  # netcdf dependencies:
-  sudo apt-get install --yes libnetcdf-dev netcdf-bin
-  # units/udunits2 dependency:
-  sudo apt-get install --yes libudunits2-dev
-  # sf dependencies (without libudunits2-dev):
-  sudo apt-get install --yes libgdal-dev libgeos-dev libproj-dev
+
  sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
+  sudo apt-get --yes --force-yes update -qq
+  # netcdf dependencies:
+  sudo apt-get install --yes libnetcdf-dev netcdf-bin
+  # units/udunits2 dependency:
+  sudo apt-get install --yes libudunits2-dev
+  # sf dependencies (without libudunits2-dev):
+  sudo apt-get install --yes libgdal-dev libgeos-dev libproj-dev

To Fedora

The following steps are required for installation on Fedora:

-
  sudo dnf update
-  # netcdf dependencies:
-  sudo yum install netcdf-devel
-  # units/udunits2 dependency:
-  sudo yum install udunits2-devel
-  # sf dependencies (without libudunits2-dev):
-  sudo yum install gdal-devel proj-devel proj-epsg proj-nad geos-devel
+
  sudo dnf update
+  # netcdf dependencies:
+  sudo yum install netcdf-devel
+  # units/udunits2 dependency:
+  sudo yum install udunits2-devel
+  # sf dependencies (without libudunits2-dev):
+  sudo yum install gdal-devel proj-devel proj-epsg proj-nad geos-devel

To Windows @@ -126,28 +112,28 @@

To WindowsTo conda (miniconda / anaconda)

First create a new environment called rspatial (or a better name):

-
  conda create -n rspatial -y
-  conda activate rspatial
+
  conda create -n rspatial -y
+  conda activate rspatial

and to install some requisites:

-
  conda install -c conda-forge r-sf -y
-  conda install -c conda-forge r-rgdal -y
-  conda install -c conda-forge r-lwgeom -y
-  conda install -c conda-forge r-raster -y
+
  conda install -c conda-forge r-sf -y
+  conda install -c conda-forge r-rgdal -y
+  conda install -c conda-forge r-lwgeom -y
+  conda install -c conda-forge r-raster -y

Package installation

To install the CRAN version (0.665.5.2):

-install.packages("EmissV")
+install.packages("EmissV")

To install the development version (0.665.5.3) using remotes:

-require("remotes")
-remotes::install_github("atmoschem/EmissV")
+require("remotes") +remotes::install_github("atmoschem/EmissV")

or to install the development version (0.665.5.3) using devtools:

-require("devtools")
-devtools::install_github("atmoschem/EmissV")
+require("devtools") +devtools::install_github("atmoschem/EmissV")
@@ -155,57 +141,57 @@

Using EmissV with EDG

EmissV can be used to process emissions of atmospheric pollutants and green house gases from inventories such as EDGAR, RCP, GAINS and other datasets in NetCDF format, the GEIA-ACCENT and ECCAD emission data portal makes available some of these inventories. You can verify the supported format with:

-EmissV::read()
+EmissV::read()

To generate a simple emission it’s a straightforward process in 4 steps:

-library(EmissV)
-### 1. download the EDGAR Netcdf using the function get_edgar from the eixport R-package 
-### or from the http://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/EDGAR/datasets/v50_AP/ 
-### EDGAR 5.0 website and unzip inside a temporary directory
-# create the temporary directory to download the data
-dir.create(file.path(tempdir(), "EDGAR"))
-# download the total emissions of NOx from EDGAR v50_AP for 2015
-eixport::get_edgar(dataset = "v50_AP",
-                   pol     = 'NOx',
-                   sector  = "TOTALS",
-                   year    = 2015,
-                   type    = 'nc', ask = FALSE, copyright = FALSE,
-                   destpath = file.path(tempdir(), "EDGAR"))
-# unzip the file
-unzip(zipfile = paste0(file.path(tempdir(), "EDGAR"),'/v50_NOx_2015.0.1x0.1.zip'),
-      exdir   = paste0(file.path(tempdir(), "EDGAR")))
-
-### 2. read the emissions (using the spec argument to split NOx into NO and NO2)
-NOx <- read(paste0(file.path(tempdir(), "EDGAR"),'/v50_NOx_2015.0.1x0.1.nc'),
-            version = 'EDGAR',
-            spec    = c(E_NO  = 0.9 ,   # optional, 90% of NOx used to NO
-                        E_NO2 = 0.1 ))  # optional, 10% of NOx uset to NO2
-
-### 3. get the information from a WRF grid from a initial conditions file (wrfinput)
-g   <- gridInfo(paste(system.file("extdata", package = "EmissV"),"/wrfinput_d01",sep=""))
-
-### 4. calculate the emissions for grid g
-NO  <- emission(grid = g, inventory = NOx$E_NO, pol = "NO", mm = 30.01,   plot = T)
-NO2 <- emission(grid = g, inventory = NOx$E_NO2,pol = "NO2",mm = 46.0055, plot = T)
+library(EmissV) +### 1. download the EDGAR Netcdf using the function get_edgar from the eixport R-package +### or from the http://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/EDGAR/datasets/v50_AP/ +### EDGAR 5.0 website and unzip inside a temporary directory +# create the temporary directory to download the data +dir.create(file.path(tempdir(), "EDGAR")) +# download the total emissions of NOx from EDGAR v50_AP for 2015 +eixport::get_edgar(dataset = "v50_AP", + pol = 'NOx', + sector = "TOTALS", + year = 2015, + type = 'nc', ask = FALSE, copyright = FALSE, + destpath = file.path(tempdir(), "EDGAR")) +# unzip the file +unzip(zipfile = paste0(file.path(tempdir(), "EDGAR"),'/v50_NOx_2015.0.1x0.1.zip'), + exdir = paste0(file.path(tempdir(), "EDGAR"))) + +### 2. read the emissions (using the spec argument to split NOx into NO and NO2) +NOx <- read(paste0(file.path(tempdir(), "EDGAR"),'/v50_NOx_2015.0.1x0.1.nc'), + version = 'EDGAR', + spec = c(E_NO = 0.9 , # optional, 90% of NOx used to NO + E_NO2 = 0.1 )) # optional, 10% of NOx uset to NO2 + +### 3. get the information from a WRF grid from a initial conditions file (wrfinput) +g <- gridInfo(paste(system.file("extdata", package = "EmissV"),"/wrfinput_d01",sep="")) + +### 4. calculate the emissions for grid g +NO <- emission(grid = g, inventory = NOx$E_NO, pol = "NO", mm = 30.01, plot = T) +NO2 <- emission(grid = g, inventory = NOx$E_NO2,pol = "NO2",mm = 46.0055, plot = T)

The next step is to save the emission in a emission file, the next example show how to save emissions using the eixport R-package:

-library(eixport)
-### create a temporary folder for emissions
-dir.create(file.path(tempdir(), "EMISSION"))
-
-### create the emision file
-wrf_create(wrfinput_dir = system.file("extdata", package = "EmissV"),
-           wrfchemi_dir = file.path(tempdir(), "EMISSION"),
-           domains      = 1)
-           
-### get the file path of the emission file
-emis_file <- list.files(path = file.path(tempdir(), "EMISSION"),
-                        pattern = "wrfchemi_d01",
-                        full.names = TRUE)
-
-### save the emission
-wrf_put(NO,  file = emis_file, name = "E_NO",  verbose = TRUE)
-wrf_put(NO2, file = emis_file, name = "E_NO2", verbose = TRUE)
+library(eixport) +### create a temporary folder for emissions +dir.create(file.path(tempdir(), "EMISSION")) + +### create the emision file +wrf_create(wrfinput_dir = system.file("extdata", package = "EmissV"), + wrfchemi_dir = file.path(tempdir(), "EMISSION"), + domains = 1) + +### get the file path of the emission file +emis_file <- list.files(path = file.path(tempdir(), "EMISSION"), + pattern = "wrfchemi_d01", + full.names = TRUE) + +### save the emission +wrf_put(NO, file = emis_file, name = "E_NO", verbose = TRUE) +wrf_put(NO2, file = emis_file, name = "E_NO2", verbose = TRUE)

Check the wrf_create, wrf_put and to_wrf to more information and customize for your application.

NOTE: The emission file must be compatible with the WRF-Chem options (many arguments are the same as the namelist.input from WRF) check the eixport R-Package documentation and the WRF-Chem manual for more information.

Other R-packages are available to write netcdf such as ncdf4, RNetCDF, tidync are available on CRAN. Other languages such as NCL leanguage and the Python package wrf-python, and preprocessor anthro_emiss are aternative to write NetCDF files.

@@ -216,118 +202,120 @@

Using EmissV

In EmissV the vehicular emissions are estimated by a top-down approach, i.e. the emissions are calculated using the statistical description of the fleet at avaliable level (National, Estadual, City, etc).The following steps show an example workflow for calculating vehicular emissions, these emissions are initially temporally and spatially disaggregated, and then distributed spatially and temporally.

I. Total: emission of pollutants is estimated from the fleet, use and emission factors and for the interest area (cities, states, countries, etc).

-library(EmissV)
-
-fleet <- vehicles(example = T)
-# using a example of vehicles (DETRAN 2016 data and SP vahicle distribution):
-#                              Category   Type Fuel      Use       SP ...
-# Light Duty Vehicles Gasohol   LDV_E25    LDV  E25  41 km/d 11624342 ...
-# Light Duty Vehicles Ethanol  LDV_E100    LDV E100  41 km/d   874627 ...
-# Light Duty Vehicles Flex        LDV_F    LDV FLEX  41 km/d  9845022 ...
-# Diesel Trucks               TRUCKS_B5 TRUCKS   B5 110 km/d   710634 ...
-# Diesel Urban Busses           CBUS_B5    BUS   B5 165 km/d   792630 ...
-# Diesel Intercity Busses       MBUS_B5    BUS   B5 165 km/d    21865 ...
-# Gasohol Motorcycles          MOTO_E25   MOTO  E25 140 km/d  3227921 ...
-# Flex Motorcycles               MOTO_F   MOTO FLEX 140 km/d   235056 ...
-
-fleet <- fleet[,c(-6,-8,-9)] # dropping RJ, PR and SC
-
-EF     <- emissionFactor(example = T)
-# using a example emission factor (values calculated from CETESB 2015):
-#                                     CO          PM
-# Light duty Vehicles Gasohol  1.75 g/km 0.0013 g/km
-# Light Duty Vehicles Ethanol 10.04 g/km 0.0000 g/km
-# Light Duty Vehicles Flex     0.39 g/km 0.0010 g/km
-# Diesel trucks                0.45 g/km 0.0612 g/km
-# Diesel urban busses          0.77 g/km 0.1052 g/km
-# Diesel intercity busses      1.48 g/km 0.1693 g/km
-# Gasohol motorcycles          1.61 g/km 0.0000 g/km
-# Flex motorcycles             0.75 g/km 0.0000 g/km
-
-TOTAL  <- totalEmission(fleet,EF,pol = c("CO"),verbose = T)
-# Total of CO : 1128297.0993334 t year-1
+library(EmissV) + +fleet <- vehicles(example = T) +# using a example of vehicles (DETRAN 2016 data and SP vahicle distribution): +# Category Type Fuel Use SP ... +# Light Duty Vehicles Gasohol LDV_E25 LDV E25 41 km/d 11624342 ... +# Light Duty Vehicles Ethanol LDV_E100 LDV E100 41 km/d 874627 ... +# Light Duty Vehicles Flex LDV_F LDV FLEX 41 km/d 9845022 ... +# Diesel Trucks TRUCKS_B5 TRUCKS B5 110 km/d 710634 ... +# Diesel Urban Busses CBUS_B5 BUS B5 165 km/d 792630 ... +# Diesel Intercity Busses MBUS_B5 BUS B5 165 km/d 21865 ... +# Gasohol Motorcycles MOTO_E25 MOTO E25 140 km/d 3227921 ... +# Flex Motorcycles MOTO_F MOTO FLEX 140 km/d 235056 ... + +fleet <- fleet[,c(-6,-8,-9)] # dropping RJ, PR and SC + +EF <- emissionFactor(example = T) +# using a example emission factor (values calculated from CETESB 2015): +# CO PM +# Light duty Vehicles Gasohol 1.75 g/km 0.0013 g/km +# Light Duty Vehicles Ethanol 10.04 g/km 0.0000 g/km +# Light Duty Vehicles Flex 0.39 g/km 0.0010 g/km +# Diesel trucks 0.45 g/km 0.0612 g/km +# Diesel urban busses 0.77 g/km 0.1052 g/km +# Diesel intercity busses 1.48 g/km 0.1693 g/km +# Gasohol motorcycles 1.61 g/km 0.0000 g/km +# Flex motorcycles 0.75 g/km 0.0000 g/km + +TOTAL <- totalEmission(fleet,EF,pol = c("CO"),verbose = T) +# Total of CO : 1128297.0993334 t year-1

II. Spatial distribution: The package has functions to read information from tables, georeferenced images (tiff), shapefiles (sh), OpenStreet maps (osm), global inventories in NetCDF format (nc) to calculate point, line and area sources.

-raster <- raster::raster(paste(system.file("extdata", package = "EmissV"),
-                         "/dmsp.tiff",sep=""))
-
-grid   <- gridInfo(paste(system.file("extdata", package = "EmissV"),
-                   "/wrfinput_d02",sep=""))
-# Grid information from: .../EmissV/extdata/wrfinput_d02
-
-shape  <- raster::shapefile(paste(system.file("extdata", package = "EmissV"),
-                            "/BR.shp",sep=""),verbose = F)[12,1]
-Minas_Gerais <- areaSource(shape,raster,grid,name = "Minas Gerais")
-# processing Minas Gerais area ...
-# fraction of Minas Gerais area inside the domain = 0.0145921494236101
-
-shape  <- raster::shapefile(paste(system.file("extdata", package = "EmissV"),
-                            "/BR.shp",sep=""),verbose = F)[22,1]
-Sao_Paulo <- areaSource(shape,raster,grid,name = "Sao Paulo")
-# processing Sao Paulo area ...
-# fraction of Sao Paulo area inside the domain = 0.474658563750987
-
-sp::spplot(raster::merge(drop_units(TOTAL$CO[[1]]) * Sao_Paulo, 
-                         drop_units(TOTAL$CO[[2]]) * Minas_Gerais),
-           scales = list(draw=TRUE),ylab="Lat",xlab="Lon",
-           main=list(label="Emissions of CO [g/d]"),
-           col.regions = c("#031638","#001E48","#002756","#003062",
-                           "#003A6E","#004579","#005084","#005C8E",
-                           "#006897","#0074A1","#0081AA","#008FB3",
-                           "#009EBD","#00AFC8","#00C2D6","#00E3F0"))
-
-

Figure 1 - Emissions of CO using nocturnal lights.

+raster <- raster::raster(paste(system.file("extdata", package = "EmissV"), + "/dmsp.tiff",sep="")) + +grid <- gridInfo(paste(system.file("extdata", package = "EmissV"), + "/wrfinput_d02",sep="")) +# Grid information from: .../EmissV/extdata/wrfinput_d02 + +shape <- raster::shapefile(paste(system.file("extdata", package = "EmissV"), + "/BR.shp",sep=""),verbose = F)[12,1] +Minas_Gerais <- areaSource(shape,raster,grid,name = "Minas Gerais") +# processing Minas Gerais area ... +# fraction of Minas Gerais area inside the domain = 0.0145921494236101 + +shape <- raster::shapefile(paste(system.file("extdata", package = "EmissV"), + "/BR.shp",sep=""),verbose = F)[22,1] +Sao_Paulo <- areaSource(shape,raster,grid,name = "Sao Paulo") +# processing Sao Paulo area ... +# fraction of Sao Paulo area inside the domain = 0.474658563750987 + +sp::spplot(raster::merge(drop_units(TOTAL$CO[[1]]) * Sao_Paulo, + drop_units(TOTAL$CO[[2]]) * Minas_Gerais), + scales = list(draw=TRUE),ylab="Lat",xlab="Lon", + main=list(label="Emissions of CO [g/d]"), + col.regions = c("#031638","#001E48","#002756","#003062", + "#003A6E","#004579","#005084","#005C8E", + "#006897","#0074A1","#0081AA","#008FB3", + "#009EBD","#00AFC8","#00C2D6","#00E3F0"))
+
+Figure 1 - Emissions of CO using nocturnal lights.
+Figure 1 - Emissions of CO using nocturnal lights.

III. Emission calculation: calculate the final emission from all different sources and converts to model units and resolution.

-CO_emissions <- emission(total = TOTAL,
-                         pol   = "CO",
-                         area  = list(SP = Sao_Paulo, MG = Minas_Gerais),
-                         grid  = grid,
-                         mm    = 28, 
-                         plot  = T)
-# calculating emissions for CO using molar mass = 28 ...
-
-

Figure 2 - CO emissions ready for use in air quality model.

+CO_emissions <- emission(total = TOTAL, + pol = "CO", + area = list(SP = Sao_Paulo, MG = Minas_Gerais), + grid = grid, + mm = 28, + plot = T) +# calculating emissions for CO using molar mass = 28 ...
+
+Figure 2 - CO emissions ready for use in air quality model.
+Figure 2 - CO emissions ready for use in air quality model.

IV. Temporal distribution: the package has a set of hourly profiles that represent the mean activity for each day of the week calculated from traffic counts of toll stations located in São Paulo city.

-data(perfil)
-names(perfil)
+data(perfil) +names(perfil)

The package has additional functions for read netcdf data, create line and point sources (with plume rise) and to estimate the total emissions of of volatile organic compounds from exhaust (through the exhaust pipe), liquid (carter and evaporative) and vapor (fuel transfer operations).

Functions:

Sample datasets: