README.md

DisperseR

11 Sep 2019

PLEASE NOTE:This package as well as this readme are still under development.

Welcome to disperseR

Package Authors:

What is disperseR ?

disperseR is an R package designed based on the hyspdisp package and the SplitR package. It is very important to note that many functions in disperseR are just sightly redesigned functions from the two mentioned packages.

disperseR runs the HYSPLIT many times and calculates the HYSPLIT Average Dispersion (or HyADS) exposure metric. The results can then be aggregated to ZIP code level to create national estimates of exposure from various sources. disperseR includes functions that make it possible for the user to plot the results easily.

Thanks to the hyspdisp package, for example, plumes from several power plants can be tracked for many days and cumulative impacts estimated. disperseR laverages hyspdisp package and allows the user have a more friendly interaction with the package.

What is improved?

disperseR is a new version of the hyspdisp package. What has been improved?

Vignettes attached with the package

We know it is sometimes difficult to start working with a new package, especially if you are not very familiar with R. We also believe in reproducible research. This is why we have included several vignettes to help you with the process.

Data attached with the package

Unfortunatelly, disperseR requires a lot of data to run the models. We could not include all the data sets with the package. For example the ZCTA shapefile is more than 140 MB. You can access it very simply with the help of the disperseR::get_data() function. Here however are the data that are attached:

Example graphical output

disperseR has functions that let you plot your results. Here is just one of many examples.

Screen Shot 2019-09-11 at 10 51 52

Instructions

Download and installation.

First, not having the Rcpp package installed on your computer can lead to problems with disperseR installation (problems with version installation). We recommend you first type the following into your R console.

install.packages("Rcpp")

**Please noteIf you are using a Windows machine and you want R to render the vignettes for you, you will need to download Rtools from here. If you prefer to avoid this step you can go ahead and proceed with the instalation as we have added links to access already rendered vignettes on GitHub.

Continue by typing the following in your R console. This will download the package from GitHub, install it and build the vignettes. This might take some minutes.

devtools::install_github("lhenneman/disperseR", force = TRUE, build_vignettes = TRUE)

Load disperseR into your R session.

library(disperseR)

Docker container

The audiracmichelle/disperser image has Rstudio and all the R and unix dependencies already installed to run disperseR quickly and reliably. The image is based on rocker project (https://www.rocker-project.org/).

More information on disperseR docker image is found in its DockerHub site https://hub.docker.com/r/audiracmichelle/disperser or in its GitHub repository https://github.com/audiracmichelle/docker_disperser.

See the vignettes

You should be able to see the main vignette like this. This will be opened by your RStudio.

vignette("Vignette_DisperseR")

The rest of the vignettes can be accessed by typing the corresponding commands.

vignette("Vignette_Crosswalk_Preparation")
vignette("Vignette_Load_Data_One_by_One")
vignette("Vignette_Units_Preparation")
vignette("Vignette_Zip_Code_Coordinate_Data_Preparation")
vignette("Vignette_Planetary_Layers_Data_Preparation")
vignette("Vignette_ZCTA_Shapefile_Preparation")

** NOTE: IF THIS DOES NOT WORK:**

In case this does not work for you. We have rendered all the vignettes for you and you can access them from your browser by clicking at the corresponding hyperlinks in Vignettes attached with the package section above.

Set up the project.

The vignettes will instruct you to do so but you can already start by creating the project folder. Use disperseR::create_dirs() function to do so. Point disperseR to the location where you want your project to be created. For example the following code will create the project in the user’s Dropbox. If you do not specify the location and just type disperseR::create_dirs() it will still work and the project will be created on your desktop.

disperseR::create_dirs(location = "/Users/username/Dropbox")

This will set up is the following folders and paths to them :

Here is a screen shot of what it should look like:

Screen Shot 2019-09-01 at 16 43 58

And these are the variables with paths that will appear in your environment.

Screen Shot 2019-09-03 at 19 06
54

Get the data

You can get most of the data required for the analysis by using the following function. This function will download the data necessary and for the data that is already attached with the package it will automatically assign it to variables in your R environment. If you want to load the data step by step check our vignette here. It also contains more information about the data and their sources.

The arguments start.year, start.month,end.year, and end.month are necessary to download the meteorology reanalysis files. They will be downloaded if they are not already in the meteo_dir folder. The reanalysis met files are about 120 MB each.

If you, for example, you want to download files for January-March 2005, you just have to use the get_data() function and set data = "all", start.year = "2005", start.month = "01", end.year = "2005", and end.month = "03". See below.

disperseR::get_data(data = "all", 
  start.year = "2005", 
  start.month = "01", 
  end.year="2005", 
  end.month="03")

If it runs correctly you should see the following in our R environment.

Screen Shot 2019-09-03 at 19 10
34

The units data

The units data should be loaded separately so that you are able to select which units to process.

This package contains annual emissions and stack height data from EPA’s Air Markets Program Data and the Energy Information Agency for years 2003-2012. Again, if you would like to know how these data were prepared please see the special vignette that we have attached to this package. Access it here

You can visualize the data like this in RStudio:

view(disperseR::units)

Please note: If you decide to use a specific unit but for many years you must have a row of data for each year. For example this is out data from the main vignette. Look at row 1 and row 3. They contain data for the same unit but a different year.

Screen Shot 2019-09-11 at 13 05 52

Analysis

We suggest you have a look at our main vignette here for details about the analysis.

Graphical output

Graphical output is authomatically saved to the graph_dir by the plotting functions.

Packages used in functions and vignettes.

References / Resources Used

NCEP Reanalysis data provided by the NOAA/OAR/ESRL PSD, Boulder, Colorado, USA, from their Web site at https://www.esrl.noaa.gov/psd/ Mesinger, F., G. DiMego, E. Kalnay, K. Mitchell, P.C. Shafran, W. Ebisuzaki, D. Jović, J. Woollen, E. Rogers, E.H. Berbery, M.B. Ek, Y. Fan, R. Grumbine, W. Higgins, H. Li, Y. Lin, G. Manikin, D. Parrish, and W. Shi, 2006: North American Regional Reanalysis. Bull. Amer. Meteor. Soc., 87, 343–360, https://doi.org/10.1175/BAMS-87-3-343

hyspdisp package

SplitR package

Auguie, Baptiste. 2017. *gridExtra: Miscellaneous Functions for "Grid" Graphics*. .
Birk, Matthew A. 2019. *Measurements: Tools for Units of Measurement*. .
Bivand, Roger S., Edzer Pebesma, and Virgilio Gomez-Rubio. 2013. *Applied Spatial Data Analysis with R, Second Edition*. Springer, NY. .
“Crosswalk ZIP Code to ZCTA Crosswalk Table Developed by John Snow, Inc. (JSI) for Use with UDS Service Area Data. Not an Official USPS or Census Product.” n.d. .
Dowle, Matt, and Arun Srinivasan. 2019. *Data.table: Extension of ‘Data.frame‘*. .
“EIA Data.” n.d. .
EPA’s Air Markets Program Data Data.” n.d. .
Garnier, Simon. 2018. *Viridis: Default Color Maps from ’Matplotlib’*. .
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” *Journal of Statistical Software* 40 (3): 1–25. .
Henneman, Lucas, Christine Choirat, and Maja Garbulinska. n.d. *disperseR: Run HYSPLIT Many Times in Parallel, Aggregate to Zip Code Level, Plot the Results, Save the Plots.* .
Hijmans, Robert J. 2019. *Raster: Geographic Data Analysis and Modeling*. .
Kahle, David, and Hadley Wickham. 2013. “Ggmap: Spatial Visualization with Ggplot2.” *The R Journal* 5 (1): 144–61. .
Pebesma, Edzer. 2018. “Simple Features for R: Standardized Support for Spatial Vector Data.” *The R Journal* 10 (1): 439–46. .
Pierce, David. 2019. *Ncdf4: Interface to Unidata netCDF (Version 4 or Earlier) Format Data Files*. .
R Core Team. 2019a. *R: A Language and Environment for Statistical Computing*. Vienna, Austria: R Foundation for Statistical Computing. .
———. 2019b. *R: A Language and Environment for Statistical Computing*. Vienna, Austria: R Foundation for Statistical Computing. .
Santos Baquero, Oswaldo. 2019. *Ggsn: North Symbols and Scale Bars for Maps Created with ’Ggplot2’ or ’Ggmap’*. .
Slowikowski, Kamil. 2019. *Ggrepel: Automatically Position Non-Overlapping Text Labels with ’Ggplot2’*. .
“United States Census Bureau ZCTA Shape Files.” n.d. .
Wickham, Hadley. 2016. *Ggplot2: Elegant Graphics for Data Analysis*. Springer-Verlag New York. .
———. 2017. *Tidyverse: Easily Install and Load the ’Tidyverse’*. .
———. 2018. *Scales: Scale Functions for Visualization*. .
Wickham, Hadley, and Jennifer Bryan. 2019. *Readxl: Read Excel Files*. .
Wickham, Hadley, Romain François, Lionel Henry, and Kirill Müller. 2019. *Dplyr: A Grammar of Data Manipulation*. .
Wickham, Hadley, and Lionel Henry. 2019. *Tidyr: Easily Tidy Data with ’Spread()’ and ’Gather()’ Functions*. .
ZIP code latitude and longitude PUBLIC OPEN DATASOFT.” n.d. ['https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/download/?format=csv&timezone=Europe/Berlin&use\_labels\_for\_header=true']('https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true').


lhenneman/disperseR documentation built on Nov. 14, 2021, 6:24 p.m.